C# Class Yea.Reflection.Emit.TypeBuilder

Helper class for defining types
Inheritance: IType
Show file Open project: OxPatient/Rule-Engine Class Usage Examples

Public Methods

Method Description
Create ( ) : Type

Creates the type

CreateConstructor ( MethodAttributes attributes = MethodAttributes.Public, IEnumerable parameterTypes = null, CallingConventions callingConventions = CallingConventions.Standard ) : IMethodBuilder

Creates a constructor

CreateDefaultConstructor ( MethodAttributes attributes = MethodAttributes.Public ) : IMethodBuilder

Creates a default constructor

CreateDefaultProperty ( string name, Type propertyType, PropertyAttributes attributes = PropertyAttributes.SpecialName, MethodAttributes getMethodAttributes = MethodAttributes.Public|MethodAttributes.Virtual, MethodAttributes setMethodAttributes = MethodAttributes.Public|MethodAttributes.Virtual, IEnumerable parameters = null ) : IPropertyBuilder

Creates a default property (ex int Property{get;set;}

CreateField ( string name, Type fieldType, FieldAttributes attributes = FieldAttributes.Public ) : FieldBuilder

Creates a field

CreateMethod ( string name, MethodAttributes attributes = MethodAttributes.Public|MethodAttributes.Virtual, Type returnType = null, IEnumerable parameterTypes = null ) : IMethodBuilder

Creates a method

CreateProperty ( string name, Type propertyType, PropertyAttributes attributes = PropertyAttributes.SpecialName, MethodAttributes getMethodAttributes = MethodAttributes.Public|MethodAttributes.Virtual, MethodAttributes setMethodAttributes = MethodAttributes.Public|MethodAttributes.Virtual, IEnumerable parameters = null ) : IPropertyBuilder

Creates a property

ToString ( ) : string

Writes out the type builder to a readable string

TypeBuilder ( Assembly assembly, string name, IEnumerable interfaces, Type baseClass, TypeAttributes attributes ) : System

Constructor

Method Details

Create() public method

Creates the type
public Create ( ) : Type
return System.Type

CreateConstructor() public method

Creates a constructor
public CreateConstructor ( MethodAttributes attributes = MethodAttributes.Public, IEnumerable parameterTypes = null, CallingConventions callingConventions = CallingConventions.Standard ) : IMethodBuilder
attributes MethodAttributes attributes for the constructor (public, private, etc.)
parameterTypes IEnumerable The types for the parameters
callingConventions CallingConventions The calling convention used
return IMethodBuilder

CreateDefaultConstructor() public method

Creates a default constructor
public CreateDefaultConstructor ( MethodAttributes attributes = MethodAttributes.Public ) : IMethodBuilder
attributes MethodAttributes attributes for the constructor (public, private, etc.)
return IMethodBuilder

CreateDefaultProperty() public method

Creates a default property (ex int Property{get;set;}
public CreateDefaultProperty ( string name, Type propertyType, PropertyAttributes attributes = PropertyAttributes.SpecialName, MethodAttributes getMethodAttributes = MethodAttributes.Public|MethodAttributes.Virtual, MethodAttributes setMethodAttributes = MethodAttributes.Public|MethodAttributes.Virtual, IEnumerable parameters = null ) : IPropertyBuilder
name string name of the property
propertyType System.Type Type of the property
attributes PropertyAttributes attributes for the property (special name, etc.)
getMethodAttributes MethodAttributes Get method's attributes (public, private, etc.)
setMethodAttributes MethodAttributes Set method's attributes (public, private, etc.)
parameters IEnumerable Parameter types
return IPropertyBuilder

CreateField() public method

Creates a field
public CreateField ( string name, Type fieldType, FieldAttributes attributes = FieldAttributes.Public ) : FieldBuilder
name string name of the field
fieldType System.Type Type of the field
attributes FieldAttributes attributes for the field (public, private, etc.)
return FieldBuilder

CreateMethod() public method

Creates a method
public CreateMethod ( string name, MethodAttributes attributes = MethodAttributes.Public|MethodAttributes.Virtual, Type returnType = null, IEnumerable parameterTypes = null ) : IMethodBuilder
name string Method name
attributes MethodAttributes attributes for the method (public, virtual, etc.)
returnType System.Type Return type
parameterTypes IEnumerable Parameter types
return IMethodBuilder

CreateProperty() public method

Creates a property
public CreateProperty ( string name, Type propertyType, PropertyAttributes attributes = PropertyAttributes.SpecialName, MethodAttributes getMethodAttributes = MethodAttributes.Public|MethodAttributes.Virtual, MethodAttributes setMethodAttributes = MethodAttributes.Public|MethodAttributes.Virtual, IEnumerable parameters = null ) : IPropertyBuilder
name string name of the property
propertyType System.Type Type of the property
attributes PropertyAttributes attributes for the property (special name, etc.)
getMethodAttributes MethodAttributes Get method's attributes (public, private, etc.)
setMethodAttributes MethodAttributes Set method's attributes (public, private, etc.)
parameters IEnumerable Parameter types
return IPropertyBuilder

ToString() public method

Writes out the type builder to a readable string
public ToString ( ) : string
return string

TypeBuilder() public method

Constructor
public TypeBuilder ( Assembly assembly, string name, IEnumerable interfaces, Type baseClass, TypeAttributes attributes ) : System
assembly Assembly Assembly to generate the type within
name string name of the type
interfaces IEnumerable Interfaces that the type implements
baseClass System.Type Base class for the type
attributes TypeAttributes attributes for the type (public, private, etc.)
return System