Table of Contents

Class Builder<TObjectProtoType>

Namespace
Dynamitey.DynamicObjects
Assembly
Dynamitey.Community.dll

Builds Expando-Like Objects with an inline Syntax

public class Builder<TObjectProtoType> : BaseObject, IDynamicMetaObjectProvider, IEquivalentType, IBuilder

Type Parameters

TObjectProtoType

The type of the object proto type.

Inheritance
Builder<TObjectProtoType>
Implements
Derived
Inherited Members

Constructors

Builder()

Initializes a new instance of the Builder<TObjectProtoType> class.

[RequiresDynamicCode("Constructing any BaseObject-derived type (and the BuilderTrampoline/SetupTrampoline it wires up) instantiates System.Dynamic.DynamicObject, whose default constructor requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public Builder()

Fields

_buildType

Build factory storage

protected IDictionary<string, Activate?> _buildType

Field Value

IDictionary<string, Activate>

Properties

Object

Creates a Prototype object.

public dynamic Object { get; }

Property Value

dynamic

The object.

Setup

Trampoline for setting up Builders

public dynamic Setup { get; }

Property Value

dynamic

Methods

Array(params dynamic[])

Alternative name for List(params dynamic[])

[RequiresUnreferencedCode("Forwards to List, which resolves a member via the DLR binder; trimming can remove the member being resolved.")]
[RequiresDynamicCode("Forwards to List, which requires the DLR's runtime code generation; not supported when AOT-compiled.")]
public dynamic Array(params dynamic[] contents)

Parameters

contents dynamic[]

The contents.

Returns

dynamic

ArraySetup(Func<object[]>)

Alternative name for ListSetup<TList>()

public dynamic ArraySetup(Func<object[]> constructorArgsFactory)

Parameters

constructorArgsFactory Func<object[]>

The constructor args factory.

Returns

dynamic

ArraySetup(params dynamic[])

Alternative name for ListSetup(params dynamic[])

public dynamic ArraySetup(params dynamic[] constructorArgs)

Parameters

constructorArgs dynamic[]

The constructor args.

Returns

dynamic

ArraySetup<TList>()

Setup List or Array if list has a default constructor

public dynamic ArraySetup<TList>()

Returns

dynamic

Type Parameters

TList

List(params dynamic[])

Creates a prototype list

[RequiresUnreferencedCode("Calls the annotated Activate.Create and, on the returned 'dynamic' list, Add(item) through the DLR binder; trimming can remove the member being resolved.")]
[RequiresDynamicCode("The 'dynamic' Add(item) call and constructing a List both require the DLR's runtime code generation; not supported when AOT-compiled.")]
public dynamic List(params dynamic[] contents)

Parameters

contents dynamic[]

The contents.

Returns

dynamic

ListSetup(Func<object[]>)

Setup List or Array, takes either one Activate or a list of constructor args that will use objects Type

public dynamic ListSetup(Func<object[]> constructorArgsFactory)

Parameters

constructorArgsFactory Func<object[]>

The constructor args factory.

Returns

dynamic

ListSetup(params dynamic[])

Setup List or Array, takes either one Activate or a list of constructor args that will use objects Type

public dynamic ListSetup(params dynamic[] constructorArgs)

Parameters

constructorArgs dynamic[]

The constructor args.

Returns

dynamic

ListSetup<TList>()

Setup List or Array if list has a default constructor

public dynamic ListSetup<TList>()

Returns

dynamic

Type Parameters

TList

ObjectSetup(Func<object[]>)

Sets up object builder

public dynamic ObjectSetup(Func<object[]> constructorArgsFactory)

Parameters

constructorArgsFactory Func<object[]>

Returns

dynamic

ObjectSetup(params dynamic[])

Sets up object builder

public dynamic ObjectSetup(params dynamic[] constructorArgs)

Parameters

constructorArgs dynamic[]

The constructor args.

Returns

dynamic

TryInvokeMember(InvokeMemberBinder, object?[]?, out object?)

Tries the invoke member.

[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Calls the annotated InvokeHelper/TryTypeForName, and the late-bound Dynamic.Impromptu.IsAvailable/DynamicActLike (dynamic field access). This is a DynamicObject.TryInvokeMember override: it can't carry [RequiresUnreferencedCode] itself without mismatching the unannotated base member, and the DLR invokes it only after the consumer's own dynamic call site already triggered the framework's warning.")]
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Same calls as above; see the IL2026 suppression on this member.")]
public override bool TryInvokeMember(InvokeMemberBinder binder, object?[]? args, out object? result)

Parameters

binder InvokeMemberBinder

The binder.

args object[]

The args.

result object

The result.

Returns

bool

TrySetMember(SetMemberBinder, dynamic?)

Tries the set member.

[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "value is statically typed 'dynamic', so 'new Activate(value)' below binds through the DLR binder even though Activate's constructor takes a plain Type. This is a DynamicObject.TrySetMember override: it can't carry [RequiresUnreferencedCode] itself without mismatching the unannotated base member, and the DLR invokes it only after the consumer's own dynamic member assignment already triggered the framework's warning.")]
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Same 'dynamic'-forced construction as above; see the IL2026 suppression on this member.")]
public override bool TrySetMember(SetMemberBinder binder, dynamic? value)

Parameters

binder SetMemberBinder

The binder.

value dynamic

The value.

Returns

bool