C# Generic Static Constructor

Posted by Seattle Leonard on Stack Overflow See other posts from Stack Overflow or by Seattle Leonard
Published on 2010-05-29T20:56:26Z Indexed on 2010/05/29 21:02 UTC
Read the original article Hit count: 409

Filed under:
|

Will a static constructor on a generic class be run for every type you pass into the generic parameter such as this:

 class SomeGenericClass<T>
 {
      static List<T> _someList;
      static SomeGenericClass()
      {
          _someList = new List<T>();
      }
 }

Are there any draw backs to using this approach?

© Stack Overflow or respective owner

Related posts about c#

Related posts about generics