Static Constructor of Abstract class and Derived Classes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?c3RlZW5idA==?=

    #1

    Static Constructor of Abstract class and Derived Classes

    Is there a way (using Reflection or anything else) to know what derived class
    caused a static contructor to be called?

  • Jon Skeet [C# MVP]

    #2
    Re: Static Constructor of Abstract class and Derived Classes

    steenbt <steenbt@discus sions.microsoft .comwrote:
    Is there a way (using Reflection or anything else) to know what derived class
    caused a static contructor to be called?
    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.

    --
    Jon Skeet - <skeet@pobox.co m>
    Web site: http://www.pobox.com/~skeet
    Blog: http://www.msmvps.com/jon.skeet
    C# in Depth: http://csharpindepth.com

    Comment

    • Ignacio Machin ( .NET/ C# MVP )

      #3
      Re: Static Constructor of Abstract class and Derived Classes

      On May 6, 2:52 pm, steenbt <stee...@discus sions.microsoft .comwrote:
      Is there a way (using Reflection or anything else) to know what derived class
      caused a static contructor to be called?
      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?

      Comment

      Working...