Class DynamicRowConverter

Describes how to convert a dynamic row value into an instance of a type.

Conversions can implemented as constructors taking a single dynamic/object, constructors taking typed parameters, an empty constructor paired with setter methods, or static methods.

Inheritance
System.Object
DynamicRowConverter
Implements
System.IEquatable<DynamicRowConverter>
Namespace: Cesil
Assembly: Cesil.dll
Syntax
public sealed class DynamicRowConverter : Object, IElseSupporting<DynamicRowConverter>, IEquatable<DynamicRowConverter>

Methods

Else(DynamicRowConverter)

Create a new converter that will try this converter, but if it returns false it will then try the given fallback DynamicRowConverter.

Declaration
public DynamicRowConverter Else(DynamicRowConverter fallbackConverter)
Parameters
Type Name Description
DynamicRowConverter fallbackConverter
Returns
Type Description
DynamicRowConverter

Equals(DynamicRowConverter)

Returns true if the given DynamicRowConverter is equivalent to this one

Declaration
public bool Equals(DynamicRowConverter rowConverter)
Parameters
Type Name Description
DynamicRowConverter rowConverter
Returns
Type Description
System.Boolean

Equals(Object)

Returns true if the given object is equivalent to this one

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean

ForConstructorTakingDynamic(ConstructorInfo)

Create a DynamicRowConverter from the given constructor.

Constructor must take an object (which can be dynamic in source).

Declaration
public static DynamicRowConverter ForConstructorTakingDynamic(ConstructorInfo constructor)
Parameters
Type Name Description
System.Reflection.ConstructorInfo constructor
Returns
Type Description
DynamicRowConverter

ForConstructorTakingTypedParameters(ConstructorInfo, IEnumerable<ColumnIdentifier>)

Create a DynamicRowConverter for the given constructor, which maps specific columns to the parameters for the of the constructor.

Constructor must take the same number of parameters as column indexes passed in.

Mapping will use column names if available, and fallback to indexes.

Declaration
public static DynamicRowConverter ForConstructorTakingTypedParameters(ConstructorInfo constructor, IEnumerable<ColumnIdentifier> columnsForParameters)
Parameters
Type Name Description
System.Reflection.ConstructorInfo constructor
System.Collections.Generic.IEnumerable<ColumnIdentifier> columnsForParameters
Returns
Type Description
DynamicRowConverter

ForDelegate<TOutput>(DynamicRowConverterDelegate<TOutput>)

Create a DynamicRowConverter from the given delegate.

Declaration
public static DynamicRowConverter ForDelegate<TOutput>(DynamicRowConverterDelegate<TOutput> del)
Parameters
Type Name Description
DynamicRowConverterDelegate<TOutput> del
Returns
Type Description
DynamicRowConverter
Type Parameters
Name Description
TOutput

ForEmptyConstructorAndSetters(ConstructorInfo, IEnumerable<Setter>, IEnumerable<ColumnIdentifier>)

Create a DynamicRowConverter for the given zero parameter constructor, which will call each setter with the column indicated in the passed column to setters.

The same number of setters and columns must be passed.

Mapping will use column names if available, and fallback to indexes.

Declaration
public static DynamicRowConverter ForEmptyConstructorAndSetters(ConstructorInfo constructor, IEnumerable<Setter> setters, IEnumerable<ColumnIdentifier> columnsForSetters)
Parameters
Type Name Description
System.Reflection.ConstructorInfo constructor
System.Collections.Generic.IEnumerable<Setter> setters
System.Collections.Generic.IEnumerable<ColumnIdentifier> columnsForSetters
Returns
Type Description
DynamicRowConverter

ForMethod(MethodInfo)

Create a DynamicRowConverter from the given method.

Method must be static, return a bool, take an object (which can be dynamic in source) as it's first parameter, a ReadContext as it's second parameter, and have a third parameter that is an out for the result value.

Declaration
public static DynamicRowConverter ForMethod(MethodInfo method)
Parameters
Type Name Description
System.Reflection.MethodInfo method
Returns
Type Description
DynamicRowConverter

GetHashCode()

Returns a stable hash for this DynamicRowConverter.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

ToString()

Returns a representation of this DynamicRowConverter object.

Only for debugging, this value is not guaranteed to be stable.

Declaration
public override string ToString()
Returns
Type Description
System.String

Operators

Equality(DynamicRowConverter, DynamicRowConverter)

Compare two DynamicRowConverters for equality

Declaration
public static bool operator ==(DynamicRowConverter a, DynamicRowConverter b)
Parameters
Type Name Description
DynamicRowConverter a
DynamicRowConverter b
Returns
Type Description
System.Boolean

Explicit(Delegate to DynamicRowConverter)

Convenience operator, equivalent to calling DynamicRowConverter.ForDelegate if non-null.

Returns null if cons is null.

Declaration
public static explicit operator DynamicRowConverter(Delegate del)
Parameters
Type Name Description
System.Delegate del
Returns
Type Description
DynamicRowConverter

Explicit(ConstructorInfo to DynamicRowConverter)

Convenience operator, equivalent to calling DynamicRowConverter.ForConstructorTakingDynamic if non-null.

Returns null if cons is null.

Declaration
public static explicit operator DynamicRowConverter(ConstructorInfo cons)
Parameters
Type Name Description
System.Reflection.ConstructorInfo cons
Returns
Type Description
DynamicRowConverter

Explicit(MethodInfo to DynamicRowConverter)

Convenience operator, equivalent to calling DynamicRowConverter.ForMethod if non-null.

Returns null if method is null.

Declaration
public static explicit operator DynamicRowConverter(MethodInfo method)
Parameters
Type Name Description
System.Reflection.MethodInfo method
Returns
Type Description
DynamicRowConverter

Inequality(DynamicRowConverter, DynamicRowConverter)

Compare two DynamicRowConverters for inequality

Declaration
public static bool operator !=(DynamicRowConverter a, DynamicRowConverter b)
Parameters
Type Name Description
DynamicRowConverter a
DynamicRowConverter b
Returns
Type Description
System.Boolean

Implements

System.IEquatable<>
In This Article
Back to top Generated by DocFX