Class CsvBinding
Base class representing a binding of a member or parameter to a CSV field.
[EditorBrowsable(EditorBrowsableState.Advanced)]
public abstract class CsvBinding : IComparable<CsvBinding>
- Inheritance
-
CsvBinding
- Implements
- Derived
-
CsvBinding<T>
Properties
DeclaringType
Returns the declaring type of the target.
public abstract Type? DeclaringType { get; }
Property Value
Header
The CSV field header of this binding (optional).
public string? Header { get; }
Property Value
Index
The CSV field index of this binding.
public int Index { get; }
Property Value
IsIgnored
Returns whether the binding is on an ignored field.
public bool IsIgnored { get; }
Property Value
Sentinel
Equality contract of the binding. The target of the binding (member or parameter), or typeof CsvIgnored if ignored field.
protected abstract object Sentinel { get; }
Property Value
Type
Returns the type of the binding's target (property/field/parameter type).
For ignored fields, returns typeof(object)
.
public abstract Type Type { get; }
Property Value
Exceptions
Methods
AreSame(object?, object?)
Returns true if the objects are the same instance, or both are the same member.
protected static bool AreSame(object? a, object? b)
Parameters
Returns
CompareTo(CsvBinding?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(CsvBinding? other)
Parameters
other
CsvBindingAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes other
in the sort order.Zero This instance occurs in the same position in the sort order as other
.Greater than zero This instance follows other
in the sort order.
ForMember<T>(int, MemberInfo, string?)
Returns a binding for the specified member.
[RequiresDynamicCode("This code path uses reflection. Use the overloads accepting source generated CsvTypeMap for AOT/trimming compatible code.")]
public static CsvBinding<T> ForMember<T>(int index, MemberInfo member, string? header = null)
Parameters
index
intmember
MemberInfoheader
string
Returns
- CsvBinding<T>
Type Parameters
T
Exceptions
ForParameter<T>(int, ParameterInfo)
Returns a binding for the specified parameter.
public static CsvBinding<T> ForParameter<T>(int index, ParameterInfo parameter)
Parameters
index
intparameter
ParameterInfo
Returns
- CsvBinding<T>
Type Parameters
T
Exceptions
For<T>(int, Expression<Func<T, object?>>)
Returns a binding for the specified member.
[RequiresDynamicCode("This code path uses reflection. Use the overloads accepting source generated CsvTypeMap for AOT/trimming compatible code.")]
public static CsvBinding<T> For<T>(int index, Expression<Func<T, object?>> memberExpression)
Parameters
index
intmemberExpression
Expression<Func<T, object>>
Returns
- CsvBinding<T>
Type Parameters
T
Ignore<T>(int)
Returns a binding that ignores the field at index
.
public static CsvBinding<T> Ignore<T>(int index)
Parameters
index
int
Returns
- CsvBinding<T>
Type Parameters
T
TargetEquals(CsvBinding?)
Returns whether the binding targets the same property/field/parameter, or both bindings are ignored fields.
public bool TargetEquals(CsvBinding? other)
Parameters
other
CsvBinding