Posts

Showing posts with the label runtime

Change attribute class variable at runtime using Postsharp

Change attribute class variable at runtime using Postsharp I know similar questions were asked in the past about similar things arround this topic but none of them answered my concern with modern and working C#. In my case, I am trying to implement a "lazy cache" for my class variables because the API we are using enables us to ask for specific variables at the same time so we group them in small charset for convience (and to lower the number of requests to the API). I am using PostSharp to achieve such thing using the LocationInterceptionAspect and overloading the getter of each cached properties. I add my attribute above my variable to tell in which charset they are. The first variable to be used in our program should load values for others in the same charset and tell that they were loaded. LocationInterceptionAspect For instance, let's say I have 4 variables a b c d of the same charset "TEST_CHARSET" . If I do Console.WriteLine(myObject.a) this should cal...