C# Класс Yea.Reflection.Emit.TypeBuilder

Helper class for defining types
Наследование: IType
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Описание методов

Create() публичный Метод

Creates the type
public Create ( ) : Type
Результат System.Type

CreateConstructor() публичный Метод

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
Результат IMethodBuilder

CreateDefaultConstructor() публичный Метод

Creates a default constructor
public CreateDefaultConstructor ( MethodAttributes attributes = MethodAttributes.Public ) : IMethodBuilder
attributes MethodAttributes attributes for the constructor (public, private, etc.)
Результат IMethodBuilder

CreateDefaultProperty() публичный Метод

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
Результат IPropertyBuilder

CreateField() публичный Метод

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.)
Результат FieldBuilder

CreateMethod() публичный Метод

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
Результат IMethodBuilder

CreateProperty() публичный Метод

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
Результат IPropertyBuilder

ToString() публичный Метод

Writes out the type builder to a readable string
public ToString ( ) : string
Результат string

TypeBuilder() публичный Метод

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.)
Результат System