Table of Contents

Class MethodCtorInfo

Namespace
Rinku.Mapping
Assembly
Rinku.dll

A validated candidate for object instantiation, wrapping a A validated candidate for object instantiation, wrapping a ConstructorInfo or static MethodInfo.

public class MethodCtorInfo
Inheritance
MethodCtorInfo
Inherited Members
Extension Methods

Constructors

MethodCtorInfo(MethodBase)

Initializes a new instance of MethodCtorInfo.

public MethodCtorInfo(MethodBase MethodBase)

Parameters

MethodBase MethodBase

The constructor or method to wrap.

Exceptions

Exception

Thrown if validation fails.

MethodCtorInfo(MethodBase, ParamInfo[])

Initializes a new instance of MethodCtorInfo.

public MethodCtorInfo(MethodBase MethodBase, ParamInfo[] Parameters)

Parameters

MethodBase MethodBase

The constructor or method to wrap.

Parameters ParamInfo[]

The matchers for the method parameters.

Exceptions

Exception

Thrown if validation fails.

MethodCtorInfo(MethodBase, ParamInfo[], AdditionalFlags)

Initializes a new instance of MethodCtorInfo with explicit member-completion control.

public MethodCtorInfo(MethodBase MethodBase, ParamInfo[] Parameters, MethodCtorInfo.AdditionalFlags Flags)

Parameters

MethodBase MethodBase

The constructor or method to wrap.

Parameters ParamInfo[]

The matchers for the method parameters.

Flags MethodCtorInfo.AdditionalFlags

The additional flags.

Fields

MethodBase

The constructor or static method used for instantiation.

public readonly MethodBase MethodBase

Field Value

MethodBase

Parameters

The matchers for each parameter in the method signature.

public readonly ParamInfo[] Parameters

Field Value

ParamInfo[]

Properties

CanCompleteWithMembers

Gets whether properties and fields may be filled after construction.

public bool CanCompleteWithMembers { get; }

Property Value

bool

Flags

Flags indicating additional info used in various situations

public MethodCtorInfo.AdditionalFlags Flags { get; set; }

Property Value

MethodCtorInfo.AdditionalFlags

GroupKey

The first grouping rule tried for this construction. Returning no boundary allows the type rule or inference. null starts with the type rule. Attribute rules are read once.

public IGroupingRule? GroupKey { get; set; }

Property Value

IGroupingRule

ParametersAreReadable

Automatically registers the parameter types if they are not already registered.

public bool ParametersAreReadable { get; }

Property Value

bool

RegistrationInitializer

Adjusts each construction path produced by TryNew(MethodBase, out MethodCtorInfo) before automatic registration can publish it. Return the received path after changing it or return a replacement. Configure this once during application startup. Direct construction does not invoke it.

public static Func<MethodCtorInfo, MethodCtorInfo>? RegistrationInitializer { get; set; }

Property Value

Func<MethodCtorInfo, MethodCtorInfo>

TargetType

Resolves the type that this method/constructor produces.

public Type TargetType { get; }

Property Value

Type

Methods

GetOrderedInfos(Span<MethodCtorInfo>)

Orders construction candidates from the most specific to the least specific.

public static MethodCtorInfo[] GetOrderedInfos(Span<MethodCtorInfo> infos)

Parameters

infos Span<MethodCtorInfo>

Returns

MethodCtorInfo[]

InsertInto(ref MethodCtorInfo[])

Adds or replaces this candidate in a list ordered from the most specific choice to the least specific.

public void InsertInto(ref MethodCtorInfo[] infos)

Parameters

infos MethodCtorInfo[]

The candidate list to update.

IsMoreSpecific(MethodCtorInfo)

Determines if this candidate is more specific (takes precedence) than another. Precedence is based on parameter count and type assignment compatibility.

public bool IsMoreSpecific(MethodCtorInfo info)

Parameters

info MethodCtorInfo

Returns

bool

IsSameSignature(MethodCtorInfo)

Compares signatures to determine if two candidates are functionally identical.

public bool IsSameSignature(MethodCtorInfo b)

Parameters

b MethodCtorInfo

Returns

bool

ToString()

Provides a string representation of the method signature for debugging.

public override string ToString()

Returns

string

TryMakeParameters(MethodBase)

Automatically generates default matchers for all parameters of a method.

public static ParamInfo[]? TryMakeParameters(MethodBase methodBase)

Parameters

methodBase MethodBase

Returns

ParamInfo[]

An array of matchers, or null if any parameter is invalid.

TryNew(MethodBase, out MethodCtorInfo)

Attempts to create a new MethodCtorInfo, returning false if validation fails.

public static bool TryNew(MethodBase MethodBase, out MethodCtorInfo mci)

Parameters

MethodBase MethodBase
mci MethodCtorInfo

Returns

bool

TryNew(MethodBase, ParamInfo[]?, AdditionalFlags, out MethodCtorInfo)

Attempts to create a new MethodCtorInfo with explicit member-completion control.

public static bool TryNew(MethodBase MethodBase, ParamInfo[]? Parameters, MethodCtorInfo.AdditionalFlags Flags, out MethodCtorInfo mci)

Parameters

MethodBase MethodBase
Parameters ParamInfo[]
Flags MethodCtorInfo.AdditionalFlags
mci MethodCtorInfo

Returns

bool

TryNew(MethodBase, ParamInfo[]?, out MethodCtorInfo)

Attempts to create a new MethodCtorInfo, returning false if validation fails.

public static bool TryNew(MethodBase MethodBase, ParamInfo[]? Parameters, out MethodCtorInfo mci)

Parameters

MethodBase MethodBase
Parameters ParamInfo[]
mci MethodCtorInfo

Returns

bool

Validate(MethodBase, ParamInfo[]?)

Validates that the provided matchers are compatible with the method's parameters.

public static Exception? Validate(MethodBase methodBase, ParamInfo[]? parameters)

Parameters

methodBase MethodBase
parameters ParamInfo[]

Returns

Exception

An Exception if invalid, otherwise null.

ValidateMethodReturn(MethodInfo)

Validates the return type and generic constraints of a static factory method.

public static Exception? ValidateMethodReturn(MethodInfo method)

Parameters

method MethodInfo

Returns

Exception