Class DefaultConstructor<T>
- Namespace
- Gym.Reflection
- Assembly
- Gym.dll
A static-cache to the default constructor of type T: a parameterless constructor, or else
the one whose parameters are all optional (called with their defaults). The legacy deep merge uses it to create
empty containers.
[Obsolete("Part of the legacy Dict's merging: use Activator.CreateInstance<T>() or a new() constraint. Removed in 2.0 with Gym.Legacy.")]
public static class DefaultConstructor<T>
Type Parameters
TThe type to initialize a constructor for.
- Inheritance
-
DefaultConstructor<T>
- Inherited Members
Remarks
Obsolete with the legacy Dict (DR-56) and removed in 2.0: use
CreateInstance<T>() or a new() constraint. Each call of the delegate goes
through Invoke(object[]), so it costs a reflection call per object.
Properties
Activator
Gets default constructor or a construcotr that all of his parameters are optional.
public static Func<T> Activator { get; }
Property Value
- Func<T>
Exceptions
- DefaultConstructorNotFoundException
When type
Thas no empty constructor or constructor with all default values.