Show / Hide Table of Contents

Class TypeFactory

Type factory. Allows defining and compiling new types at runtime.

Inheritance
object
TypeFactory
Implements
IExposeAssembly
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TheXDS.MCART.Types
Assembly: MCART.TypeFactory.dll
Syntax
public class TypeFactory : IExposeAssembly

Constructors

| Edit this page View Source

TypeFactory()

Initializes a new instance of the TypeFactory class.

Declaration
[RequiresDynamicCode("The method makes calls to dynamic code, so it is not compatible with trimming.")]
public TypeFactory()
| Edit this page View Source

TypeFactory(bool)

Initializes a new instance of the TypeFactory class.

Declaration
[RequiresDynamicCode("The method makes calls to dynamic code, so it is not compatible with trimming.")]
public TypeFactory(bool useGuid)
Parameters
Type Name Description
bool useGuid

True to append a GUID to generated type names.

| Edit this page View Source

TypeFactory(string)

Initializes a new instance of the TypeFactory class.

Declaration
[RequiresDynamicCode("The method makes calls to dynamic code, so it is not compatible with trimming.")]
public TypeFactory(string @namespace)
Parameters
Type Name Description
string namespace

Namespace to use for the types to be built.

| Edit this page View Source

TypeFactory(string, bool)

Initializes a new instance of the TypeFactory class.

Declaration
[RequiresDynamicCode("The method makes calls to dynamic code, so it is not compatible with trimming.")]
public TypeFactory(string @namespace, bool useGuid)
Parameters
Type Name Description
string namespace

Namespace to use for the types to be built.

bool useGuid

True to append a GUID to generated type names.

Properties

| Edit this page View Source

Assembly

Gets a reference to the dynamic assembly where types built by this TypeFactory are loaded.

Declaration
public Assembly Assembly { get; }
Property Value
Type Description
Assembly

Methods

| Edit this page View Source

NewClass(string)

Creates a new public class.

Declaration
public TypeBuilder NewClass(string name)
Parameters
Type Name Description
string name

Name of the new class.

Returns
Type Description
TypeBuilder

A TypeBuilder that can be used to define members of the new class.

| Edit this page View Source

NewClass(string, IEnumerable<Type>)

Creates a new public class.

Declaration
public TypeBuilder NewClass(string name, IEnumerable<Type> interfaces)
Parameters
Type Name Description
string name

Name of the new class.

IEnumerable<Type> interfaces

Interfaces to implement.

Returns
Type Description
TypeBuilder

A TypeBuilder that can be used to define members of the new class.

| Edit this page View Source

NewClass<T>(string)

Creates a new public class, specifying the base type or single interface to implement.

Declaration
public ITypeBuilder<T> NewClass<T>(string name)
Parameters
Type Name Description
string name

Name of the new class.

Returns
Type Description
ITypeBuilder<T>

An ITypeBuilder<T> that can be used to define members of the new class.

Type Parameters
Name Description
T

Base type or interface to implement.

| Edit this page View Source

NewType(string, Type, IEnumerable<Type>)

Creates a new public class.

Declaration
public TypeBuilder NewType(string name, Type baseType, IEnumerable<Type> interfaces)
Parameters
Type Name Description
string name

Name of the new class.

Type baseType

Base type of the new class.

IEnumerable<Type> interfaces

Interfaces to implement by the new class.

Returns
Type Description
TypeBuilder

A TypeBuilder that can be used to define members of the new class.

| Edit this page View Source

NewType<T>(string)

Creates a new public class.

Declaration
public ITypeBuilder<T> NewType<T>(string name)
Parameters
Type Name Description
string name

Name of the new class.

Returns
Type Description
ITypeBuilder<T>

A TypeBuilder<T> that can be used to define members of the new class.

Type Parameters
Name Description
T

Base type of the new class.

| Edit this page View Source

NewType<T>(string, IEnumerable<Type>?)

Creates a new public class.

Declaration
public ITypeBuilder<T> NewType<T>(string name, IEnumerable<Type>? interfaces)
Parameters
Type Name Description
string name

Name of the new class.

IEnumerable<Type> interfaces

Interfaces to implement by the new class. Can be set to null to implement no additional interface.

Returns
Type Description
ITypeBuilder<T>

A TypeBuilder<T> that can be used to define members of the new class.

Type Parameters
Name Description
T

Base type of the new class.

Implements

IExposeAssembly

Extension Methods

Objects.ShallowCopyTo(object, object, Type)
ObjectExtensions.FieldsOf<T>(object)
ObjectExtensions.GetAttribute<T>(object)
ObjectExtensions.GetAttributes<T>(object)
ObjectExtensions.HasAttrValue<TAttribute, TValue>(object, out TValue)
ObjectExtensions.HasAttribute<T>(object)
ObjectExtensions.HasAttribute<T>(object, out T?)
ObjectExtensions.HasAttributes<T>(object, out IEnumerable<T>?)
ObjectExtensions.Is(object?, object?)
ObjectExtensions.IsEither(object, IEnumerable)
ObjectExtensions.IsEither(object, params object[])
ObjectExtensions.IsNeither(object, IEnumerable)
ObjectExtensions.IsNeither(object, params object[])
ObjectExtensions.IsNot(object?, object?)
ObjectExtensions.PropertiesOf<T>(object)
ObjectExtensions.WhichAre(object, IEnumerable<object>)
ObjectExtensions.WhichAre(object, params object[])
Common.IfNotNull<T>(T?, Action<T>)
Objects.Itself<T>(T)
Objects.ShallowClone<T>(T)
Objects.ShallowCopyTo<T>(T, T)
CollectionExtensions.PushInto<TItem, TCollection>(TItem, ICollection<TCollection>)
DictionaryExtensions.PushInto<TKey, TValue>(TValue, TKey, IDictionary<TKey, TValue>)
TypeFactoryVmExtensions.CreateEntityViewModelClass<TModel>(TypeFactory)
TypeFactoryVmExtensions.CreateEntityViewModelClass<TModel>(TypeFactory, IEnumerable<Type>?)
TypeFactoryVmExtensions.CreateNpcClass<TModel>(TypeFactory)
TypeFactoryVmExtensions.CreateNpcClass<TModel>(TypeFactory, IEnumerable<Type>?)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX