Class Setter
Represents code used to set parsed values onto types.
Wraps a static method, an instance method, a delegate, a field, or a constructor
parameter.
Inheritance
System.Object
Setter
Namespace: Cesil
Assembly: Cesil.dll
Syntax
public sealed class Setter : Object, IEquatable<Setter>
Methods
AllowNullRows()
Returns a Setter that differs from this by explicitly allowing
null rows be passed to it.
If the backing field, delegate, or method does not expect null rows
this could result in errors at runtime.
Declaration
public Setter AllowNullRows()
Returns
AllowNullValues()
Returns a Setter that differs from this by explicitly allowing
null values be passed to it.
If the backing field, delegate, or method does not expect null values
this could result in errors at runtime.
Declaration
public Setter AllowNullValues()
Returns
Equals(Setter)
Returns true if this object equals the given Setter.
Declaration
public bool Equals(Setter setter)
Parameters
Type |
Name |
Description |
Setter |
setter |
|
Returns
Type |
Description |
System.Boolean |
|
Equals(Object)
Returns true if this object equals the given Setter.
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
ForbidNullRows()
Returns a Setter that differs from this by explicitly forbidding
null rows be passed to it.
If the .NET runtime cannot guarantee that nulls will not be passed,
null checks will be injected.
Declaration
public Setter ForbidNullRows()
Returns
ForbidNullValues()
Returns a Setter that differs from this by explicitly forbidding
null values be passed to it.
If the .NET runtime cannot guarantee that nulls will not be passed,
null checks will be injected.
Declaration
public Setter ForbidNullValues()
Returns
ForConstructorParameter(ParameterInfo)
Create a Setter from the given constructor parameter.
Declaration
public static Setter ForConstructorParameter(ParameterInfo parameter)
Parameters
Type |
Name |
Description |
System.Reflection.ParameterInfo |
parameter |
|
Returns
ForDelegate<TValue>(StaticSetterDelegate<TValue>)
Create a Setter from the given delegate.
Declaration
public static Setter ForDelegate<TValue>(StaticSetterDelegate<TValue> del)
Parameters
Returns
Type Parameters
ForDelegate<TRow, TValue>(SetterByRefDelegate<TRow, TValue>)
Create a Setter from the given delegate.
Declaration
public static Setter ForDelegate<TRow, TValue>(SetterByRefDelegate<TRow, TValue> del)
Parameters
Returns
Type Parameters
Name |
Description |
TRow |
|
TValue |
|
ForDelegate<TRow, TValue>(SetterDelegate<TRow, TValue>)
Create a Setter from the given delegate.
Declaration
public static Setter ForDelegate<TRow, TValue>(SetterDelegate<TRow, TValue> del)
Parameters
Returns
Type Parameters
Name |
Description |
TRow |
|
TValue |
|
ForField(FieldInfo)
Creates setter from a field.
Field can be either an instance field or static field.
Declaration
public static Setter ForField(FieldInfo field)
Parameters
Type |
Name |
Description |
System.Reflection.FieldInfo |
field |
|
Returns
Create a setter from a method.
The method must return void.
If the method is a static method it may:
- take 1 parameter (the result of the parser) or
- take 2 parameters, the result of the parser and an
in ReadContext
or
- take 2 parameters, the row type (which may be passed by ref), and the result of the parser or
- take 3 parameters, the row type (which may be passed by ref), the result of the parser, and
in ReadContext
If the method is an instance method:
- it must be on the row type, and take 1 parameter (the result of the parser) or
- it must be on the row type, and take 2 parameters, the result of the parser and an
in ReadContext
Declaration
public static Setter ForMethod(MethodInfo method)
Parameters
Type |
Name |
Description |
System.Reflection.MethodInfo |
method |
|
Returns
ForProperty(PropertyInfo)
Create a setter from a PropertyInfo.
Throws if the property does not have a setter.
Declaration
public static Setter ForProperty(PropertyInfo property)
Parameters
Type |
Name |
Description |
System.Reflection.PropertyInfo |
property |
|
Returns
GetHashCode()
Returns a stable hash for this Setter.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
ToString()
Describes this Setter.
This is provided for debugging purposes, and the format is not guaranteed to be stable between releases.
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Operators
Equality(Setter, Setter)
Compare two Setters for equality
Declaration
public static bool operator ==(Setter a, Setter b)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Explicit(Delegate to Setter)
Convenience operator, equivalent to calling Setter.ForDelegate if non-null.
Returns null if field is null.
Declaration
public static explicit operator Setter(Delegate del)
Parameters
Type |
Name |
Description |
System.Delegate |
del |
|
Returns
Explicit(FieldInfo to Setter)
Convenience operator, equivalent to calling Setter.ForField if non-null.
Returns null if field is null.
Declaration
public static explicit operator Setter(FieldInfo field)
Parameters
Type |
Name |
Description |
System.Reflection.FieldInfo |
field |
|
Returns
Explicit(MethodInfo to Setter)
Convenience operator, equivalent to calling Setter.ForMethod if non-null.
Returns null if method is null.
Declaration
public static explicit operator Setter(MethodInfo method)
Parameters
Type |
Name |
Description |
System.Reflection.MethodInfo |
method |
|
Returns
Explicit(ParameterInfo to Setter)
Convenience operator, equivalent to calling Setter.ForConstructorParameter if non-null.
Returns null if parameter is null.
Declaration
public static explicit operator Setter(ParameterInfo parameter)
Parameters
Type |
Name |
Description |
System.Reflection.ParameterInfo |
parameter |
|
Returns
Inequality(Setter, Setter)
Compare two Setters for inequality
Declaration
public static bool operator !=(Setter a, Setter b)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Implements
System.IEquatable<>