Search code examples
c#ooppostsharp

Why fields and properties are called locations in C#


Can someone please explain me why fields and properties are called locations in C#. I am taken aback as I have not come across all these years. I am reading this and after doing a bit of further research, I found its indeed the case. So my question is, is this specific to post sharp or its applicable to OOPs in general?


Solution

  • The term location is used in PostSharp and in the CLI specification. A location is anything that can contain a value. A location has three semantics: read, write and get address. From a CLI point of view, possible locations are fields, local variables, parameters and array elements. PostSharp's LocationInterceptionAspect can be applied to fields and properties, which both have read and write semantics.