Show / Hide Table of Contents

Class RuntimeCompiler

Runtime compiler to generate types at runtime.

Inheritance
System.Object
RuntimeCompiler
Namespace: System.Linq.CompilerServices
Assembly: Nuqleon.Linq.CompilerServices.dll
Syntax
public class RuntimeCompiler : Object

Constructors

RuntimeCompiler()

Creates a new runtime compiler instance, causing a unique code generation module to be generated.

Declaration
public RuntimeCompiler()

Methods

CreateAnonymousType(IEnumerable<KeyValuePair<String, Type>>)

Creates an anonymous type with the specified properties, with C# language semantics (see remarks).

Declaration
public static Type CreateAnonymousType(IEnumerable<KeyValuePair<string, Type>> properties)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> properties

Sequence with names and types of properties.

Returns
Type Description
System.Type

Anonymous type with the specified properties.

Remarks

An anonymous type with C# language semantics has the following properties:

  • Properties are declared in the specified order, which gets reflected in the constructor parameter order and the ToString output.
  • All of the properties on the resulting type are get-only, making instances of the anonymous type immutable.
  • Equals and GetHashCode methods are generated with property-by-property equality semantics, using the default equality comparer for each property's type.

CreateAnonymousType(IEnumerable<KeyValuePair<String, Type>>, String[])

Creates an anonymous type with the specified properties, with Visual Basic language semantics (see remarks).

Declaration
public static Type CreateAnonymousType(IEnumerable<KeyValuePair<string, Type>> properties, params string[] keys)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> properties

Sequence with names and types of properties.

System.String[] keys

Subset of the properties that are used as keys.

Returns
Type Description
System.Type

Anonymous type with the specified properties.

Remarks

An anonymous type with Visual language semantics has the following properties:

  • Properties are declared in the specified order, which gets reflected in the constructor parameter order and the ToString output.
  • Only the properties specified as keys are immutable; other properties have setters and can be assigned to.
  • Equals and GetHashCode methods are generated with property-by-property equality semantics for the properties specified as keys, using the default equality comparer for each property's type.

CreateAnonymousType(IEnumerable<StructuralFieldDeclaration>)

Creates an anonymous type with the specified properties, with Visual Basic language semantics (see remarks).

Declaration
public static Type CreateAnonymousType(IEnumerable<StructuralFieldDeclaration> properties)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<StructuralFieldDeclaration> properties

Sequence with names, types, and custom attributes of properties.

Returns
Type Description
System.Type

Anonymous type with the specified properties.

Remarks

An anonymous type with C# language semantics has the following properties:

  • Properties are declared in the specified order, which gets reflected in the constructor parameter order and the ToString output.
  • All of the properties on the resulting type are get-only, making instances of the anonymous type immutable.
  • Equals and GetHashCode methods are generated with property-by-property equality semantics, using the default equality comparer for each property's type.

CreateAnonymousType(IEnumerable<StructuralFieldDeclaration>, String[])

Creates an anonymous type with the specified properties, with Visual Basic language semantics (see remarks).

Declaration
public static Type CreateAnonymousType(IEnumerable<StructuralFieldDeclaration> properties, params string[] keys)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<StructuralFieldDeclaration> properties

Sequence with names, types, and custom attributes of properties.

System.String[] keys

Subset of the properties that are used as keys.

Returns
Type Description
System.Type

Anonymous type with the specified properties.

Remarks

An anonymous type with Visual language semantics has the following properties:

  • Properties are declared in the specified order, which gets reflected in the constructor parameter order and the ToString output.
  • Only the properties specified as keys are immutable; other properties have setters and can be assigned to.
  • Equals and GetHashCode methods are generated with property-by-property equality semantics for the properties specified as keys, using the default equality comparer for each property's type.

CreateClosureType(IEnumerable<KeyValuePair<String, Type>>)

Creates a closure type with the specified fields.

Declaration
public static Type CreateClosureType(IEnumerable<KeyValuePair<string, Type>> fields)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> fields

Fields to declare on the resulting type.

Returns
Type Description
System.Type

Closure type with the specified public assignable fields.

CreateRecordType(IEnumerable<KeyValuePair<String, Type>>, Boolean)

Creates a record type with the specified properties.

Declaration
public static Type CreateRecordType(IEnumerable<KeyValuePair<string, Type>> properties, bool valueEquality)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> properties

Properties to declare on the resulting type.

System.Boolean valueEquality

Indicates whether to use value equality or reference equality.

Returns
Type Description
System.Type

Record type with the specified public assignable properties.

CreateRecordType(IEnumerable<StructuralFieldDeclaration>, Boolean)

Creates a record type with the specified properties.

Declaration
public static Type CreateRecordType(IEnumerable<StructuralFieldDeclaration> properties, bool valueEquality)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<StructuralFieldDeclaration> properties

Properties to declare on the resulting type.

System.Boolean valueEquality

Indicates whether to use value equality or reference equality.

Returns
Type Description
System.Type

Record type with the specified public assignable properties.

DefineAnonymousType(TypeBuilder, IEnumerable<KeyValuePair<String, Type>>)

Defines an anonymous type with the specified properties, with C# language semantics (see remarks).

Declaration
public void DefineAnonymousType(TypeBuilder anonymousTypeBuilder, IEnumerable<KeyValuePair<string, Type>> properties)
Parameters
Type Name Description
System.Reflection.Emit.TypeBuilder anonymousTypeBuilder

Type builder to define the anonymous type on.

System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> properties

Sequence with names and types of properties.

Remarks

A call to CreateType on the TypeBuilder is required by the caller to perform the final construction step of the type. This manual step allows the TypeBuilder to be used for further customization or to declare recursive types.

An anonymous type with C# language semantics has the following properties:

  • Properties are declared in the specified order, which gets reflected in the constructor parameter order and the ToString output.
  • All of the properties on the resulting type are get-only, making instances of the anonymous type immutable.
  • Equals and GetHashCode methods are generated with property-by-property equality semantics, using the default equality comparer for each property's type.

DefineAnonymousType(TypeBuilder, IEnumerable<KeyValuePair<String, Type>>, String[])

Defines an anonymous type with the specified properties, with Visual Basic language semantics (see remarks).

Declaration
public void DefineAnonymousType(TypeBuilder anonymousTypeBuilder, IEnumerable<KeyValuePair<string, Type>> properties, params string[] keys)
Parameters
Type Name Description
System.Reflection.Emit.TypeBuilder anonymousTypeBuilder

Type builder to define the anonymous type on.

System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> properties

Sequence with names and types of properties.

System.String[] keys

Subset of the properties that are used as keys.

Remarks

A call to CreateType on the TypeBuilder is required by the caller to perform the final construction step of the type. This manual step allows the TypeBuilder to be used for further customization or to declare recursive types.

An anonymous type with Visual Basic language semantics has the following properties:

  • Properties are declared in the specified order, which gets reflected in the constructor parameter order and the ToString output.
  • Only the properties specified as keys are immutable; other properties have setters and can be assigned to.
  • Equals and GetHashCode methods are generated with property-by-property equality semantics for the properties specified as keys, using the default equality comparer for each property's type.

DefineAnonymousType(TypeBuilder, IEnumerable<StructuralFieldDeclaration>)

Defines an anonymous type with the specified properties, with C# language semantics (see remarks).

Declaration
public void DefineAnonymousType(TypeBuilder anonymousTypeBuilder, IEnumerable<StructuralFieldDeclaration> properties)
Parameters
Type Name Description
System.Reflection.Emit.TypeBuilder anonymousTypeBuilder

Type builder to define the anonymous type on.

System.Collections.Generic.IEnumerable<StructuralFieldDeclaration> properties

Sequence with names, types, and custom attribute builders of properties.

Remarks

A call to CreateType on the TypeBuilder is required by the caller to perform the final construction step of the type. This manual step allows the TypeBuilder to be used for further customization or to declare recursive types.

An anonymous type with C# language semantics has the following properties:

  • Properties are declared in the specified order, which gets reflected in the constructor parameter order and the ToString output.
  • All of the properties on the resulting type are get-only, making instances of the anonymous type immutable.
  • Equals and GetHashCode methods are generated with property-by-property equality semantics, using the default equality comparer for each property's type.

DefineAnonymousType(TypeBuilder, IEnumerable<StructuralFieldDeclaration>, String[])

Defines an anonymous type with the specified properties, with Visual Basic language semantics (see remarks).

Declaration
public void DefineAnonymousType(TypeBuilder anonymousTypeBuilder, IEnumerable<StructuralFieldDeclaration> properties, params string[] keys)
Parameters
Type Name Description
System.Reflection.Emit.TypeBuilder anonymousTypeBuilder

Type builder to define the anonymous type on.

System.Collections.Generic.IEnumerable<StructuralFieldDeclaration> properties

Sequence with names, types, and custom attribute builders of properties.

System.String[] keys

Subset of the properties that are used as keys.

Remarks

A call to CreateType on the TypeBuilder is required by the caller to perform the final construction step of the type. This manual step allows the TypeBuilder to be used for further customization or to declare recursive types.

An anonymous type with Visual Basic language semantics has the following properties:

  • Properties are declared in the specified order, which gets reflected in the constructor parameter order and the ToString output.
  • Only the properties specified as keys are immutable; other properties have setters and can be assigned to.
  • Equals and GetHashCode methods are generated with property-by-property equality semantics for the properties specified as keys, using the default equality comparer for each property's type.

DefineClosureType(TypeBuilder, IEnumerable<KeyValuePair<String, Type>>)

Creates a closure type with the specified fields.

Declaration
public void DefineClosureType(TypeBuilder closureTypeBuilder, IEnumerable<KeyValuePair<string, Type>> fields)
Parameters
Type Name Description
System.Reflection.Emit.TypeBuilder closureTypeBuilder

Type builder to define the anonymous type on.

System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> fields

Fields to declare on the resulting type.

Remarks

A call to CreateType on the TypeBuilder is required by the caller to perform the final construction step of the type. This manual step allows the TypeBuilder to be used for further customization or to declare recursive types.

DefineRecordType(TypeBuilder, IEnumerable<KeyValuePair<String, Type>>, Boolean)

Creates a record type with the specified fields.

Declaration
public void DefineRecordType(TypeBuilder recordTypeBuilder, IEnumerable<KeyValuePair<string, Type>> properties, bool valueEquality)
Parameters
Type Name Description
System.Reflection.Emit.TypeBuilder recordTypeBuilder

Type builder to define the anonymous type on.

System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> properties

Fields to declare on the resulting type.

System.Boolean valueEquality

Indicates whether to use value equality or reference equality.

Remarks

A call to CreateType on the TypeBuilder is required by the caller to perform the final construction step of the type. This manual step allows the TypeBuilder to be used for further customization or to declare recursive types.

DefineRecordType(TypeBuilder, IEnumerable<StructuralFieldDeclaration>, Boolean)

Creates a record type with the specified fields.

Declaration
public void DefineRecordType(TypeBuilder recordTypeBuilder, IEnumerable<StructuralFieldDeclaration> properties, bool valueEquality)
Parameters
Type Name Description
System.Reflection.Emit.TypeBuilder recordTypeBuilder

Type builder to define the anonymous type on.

System.Collections.Generic.IEnumerable<StructuralFieldDeclaration> properties

Fields to declare on the resulting type.

System.Boolean valueEquality

Indicates whether to use value equality or reference equality.

Remarks

A call to CreateType on the TypeBuilder is required by the caller to perform the final construction step of the type. This manual step allows the TypeBuilder to be used for further customization or to declare recursive types.

GetNewAnonymousTypeBuilder()

Gets a new type builder for an anonymous type.

Declaration
public TypeBuilder GetNewAnonymousTypeBuilder()
Returns
Type Description
System.Reflection.Emit.TypeBuilder

Type builder instance used to define an anonymous type.

Remarks

A call to CreateType is required by the caller to perform the final construction step of the type, after using DefineAnonymousType.

GetNewClosureTypeBuilder()

Gets a new type builder for a closure type.

Declaration
public TypeBuilder GetNewClosureTypeBuilder()
Returns
Type Description
System.Reflection.Emit.TypeBuilder

Type builder instance used to define a closure type.

Remarks

A call to CreateType is required by the caller to perform the final construction step of the type, after using DefineClosureType(TypeBuilder, IEnumerable<KeyValuePair<String, Type>>).

GetNewRecordTypeBuilder()

Gets a new type builder for a record type.

Declaration
public TypeBuilder GetNewRecordTypeBuilder()
Returns
Type Description
System.Reflection.Emit.TypeBuilder

Type builder instance used to define a record type.

Remarks

A call to CreateType is required by the caller to perform the final construction step of the type, after using DefineRecordType.

In This Article
Back to top Generated by DocFX