Skip to content

CreateType Method ​

Definition ​

  • Namespace: JASE.Reflection
  • Assembly: JASE.ReflectionTools.dll

Overloads ​

NameDescription
Type CreateType(string name, Dictionary<string, Type> properties, Type[] implements = null, bool dataContract = null, bool autoVersioning = null)Creates a dynamic Type with the specified name, properties and optionally implements one or more interfaces.
Type CreateType(string name, IList<PropertyAttribute> attributes, IList<Property> properties, Type[] implements = null, bool dataContract = null, Type inheritsFrom = null, bool autoVersioning = null)Creates a new dynamic Type with the specified name and properties.

Type CreateType(string name, Dictionary<string, Type> properties, Type[] implements = null, bool dataContract = null, bool autoVersioning = null) ​

csharp
Type CreateType(string name, Dictionary<string, Type> properties, Type[] implements = null, bool dataContract = null, bool autoVersioning = null)

Creates a dynamic Type with the specified name, properties and optionally implements one or more interfaces.

Parameters ​

NameDescription
autoVersioningAn optional flag indicating whether to automatically version the dynamic Type by adding a version number to its name if a Type with the same name already exists.
dataContractAn optional flag indicating whether to add a DataContract attribute to the dynamic Type and its properties.
implementsAn optional array of interfaces to be implemented by the dynamic Type.
nameThe name of the dynamic Type.
propertiesA dictionary containing the name and Type of each property to be added to the Type.

Returns ​

The created dynamic Type.

Type CreateType(string name, IList<PropertyAttribute> attributes, IList<Property> properties, Type[] implements = null, bool dataContract = null, Type inheritsFrom = null, bool autoVersioning = null) ​

csharp
Type CreateType(string name, IList<PropertyAttribute> attributes, IList<Property> properties, Type[] implements = null, bool dataContract = null, Type inheritsFrom = null, bool autoVersioning = null)

Creates a new dynamic Type with the specified name and properties.

Parameters ​

NameDescription
attributesA list of custom attributes to be applied to the Type.
autoVersioningSpecifies whether to automatically version the new Type if a Type with the same name already exists.
dataContractSpecifies whether the new Type will have a DataContractAttribute.
implementsAn array of Type objects that the new Type will implement.
inheritsFromThe Type that the new Type will inherit from.
nameThe name of the new Type to be created.
propertiesA list of properties to be defined on the Type.

Returns ​

A new Type with the specified name and properties.