S steenbt May 6, 2008 #1 Is there a way (using Reflection or anything else) to know what derived class caused a static contructor to be called?
Is there a way (using Reflection or anything else) to know what derived class caused a static contructor to be called?
J Jon Skeet [C# MVP] May 6, 2008 #2 steenbt said: Is there a way (using Reflection or anything else) to know what derived class caused a static contructor to be called? Click to expand... Not as far as I'm aware, and to be honest I'd be suspicious of a design which relied on that. What are you trying to do? We may be able to suggest a better idea.
steenbt said: Is there a way (using Reflection or anything else) to know what derived class caused a static contructor to be called? Click to expand... Not as far as I'm aware, and to be honest I'd be suspicious of a design which relied on that. What are you trying to do? We may be able to suggest a better idea.
I Ignacio Machin ( .NET/ C# MVP ) May 6, 2008 #3 Is there a way (using Reflection or anything else) to know what derived class caused a static contructor to be called? Click to expand... Not really. At least not AFAIK , not even the StackTrace can be used as the constructors are called from the top of the tree down. What are you trying to do though?
Is there a way (using Reflection or anything else) to know what derived class caused a static contructor to be called? Click to expand... Not really. At least not AFAIK , not even the StackTrace can be used as the constructors are called from the top of the tree down. What are you trying to do though?