Can a .NET object actually have no constructors, according to reflection? -


I'm actually writing simple IoC / DI containers, and I got the following code:

ConstructorInfo [] ctors = concreteType.GetConstructors (); If (ctors.Length == 0) returns the catalyst. Create the intensity (solid type); // More code goes here ...

I can not come in the case of a test that results in a type of zero constructor, along with:

  class lonely type {}  

Is it possible for a .net type no constructor, or does CLR always provide a vest? - Static classes are not a constructor:

  Fixed class too lonelytype {}  

Normal Paraslabel Constructor C # compiler , provided by CLR no.

Note that as far as CLR is concerned, the strokes generated from C # are not either the parameterized constructor. For example:

  struct foo {}  

will not be a non-parameter creator, you can do it in IL, which can ...


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -