Class Getter
Represents code used to get a value from a type.
Wraps a static method, an instance method, a field, or a delegate.
Inheritance
System.Object
Getter
Namespace: Cesil
Assembly: Cesil.dll
Syntax
public sealed class Getter : Object, IEquatable<Getter>, ICreatesCacheableDelegate<Getter.DynamicGetterDelegate>
Methods
AllowNullRows()
Returns a Getter that differs from this by explicitly allowing
null rows to be passed to it.
If the backing field, method, or delegate does not expect null values, this may lead
to errors at runtime.
Declaration
public Getter AllowNullRows()
Returns
AllowNullValues()
Returns a Getter that differs from this by explicitly allowing
null values to be returned from it.
Declaration
public Getter AllowNullValues()
Returns
Equals(Getter)
Compares for equality to another Getter.
Declaration
public bool Equals(Getter getter)
Parameters
Type |
Name |
Description |
Getter |
getter |
|
Returns
Type |
Description |
System.Boolean |
|
Equals(Object)
Compares for equality to another Getter.
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
ForbidNullRows()
Returns a Getter 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 to it,
null checks will be injected.
Declaration
public Getter ForbidNullRows()
Returns
ForbidNullValues()
Returns a Getter that differs from this by explicitly forbidding
null values to be returned from it.
If the .NET runtime cannot guarantee that nulls will not be returned,
null checks will be injected.
Declaration
public Getter ForbidNullValues()
Returns
ForDelegate<TValue>(StaticGetterDelegate<TValue>)
Create a Getter from the given delegate.
Declaration
public static Getter ForDelegate<TValue>(StaticGetterDelegate<TValue> del)
Parameters
Returns
Type Parameters
ForDelegate<TRow, TValue>(GetterDelegate<TRow, TValue>)
Create a Getter from the given delegate.
Declaration
public static Getter ForDelegate<TRow, TValue>(GetterDelegate<TRow, TValue> del)
Parameters
Returns
Type Parameters
Name |
Description |
TRow |
|
TValue |
|
ForField(FieldInfo)
Create a getter from a field.
field can be an instance field or a static field.
Declaration
public static Getter ForField(FieldInfo field)
Parameters
Type |
Name |
Description |
System.Reflection.FieldInfo |
field |
|
Returns
Create a getter from a method.
getter can be an instance method or a static method
if it's a static method, it can take 0, 1, or 2 parameters
- if there is 1 parameter, it may be an
in WriteContext
or the row type
- if there are 2 parameters, the first must be the row type, and the second must be
in WriteContext
if it's an instance method, it can only take 0 or 1 parameters
- if it takes a parameter, it must be an
in WriteContext
Declaration
public static Getter ForMethod(MethodInfo method)
Parameters
Type |
Name |
Description |
System.Reflection.MethodInfo |
method |
|
Returns
ForProperty(PropertyInfo)
Create a getter from a PropertyInfo.
Throws if the property does not have a getter.
Declaration
public static Getter ForProperty(PropertyInfo property)
Parameters
Type |
Name |
Description |
System.Reflection.PropertyInfo |
property |
|
Returns
GetHashCode()
Returns a hash code for this Getter.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
ToString()
Describes this Getter.
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(Getter, Getter)
Compare two Getters for equality
Declaration
public static bool operator ==(Getter a, Getter b)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Explicit(Delegate to Getter)
Convenience operator, equivalent to calling Getter.ForDelegate if non-null.
Returns null if del is null.
Declaration
public static explicit operator Getter(Delegate del)
Parameters
Type |
Name |
Description |
System.Delegate |
del |
|
Returns
Explicit(FieldInfo to Getter)
Convenience operator, equivalent to calling Getter.ForField if non-null.
Returns null if field is null.
Declaration
public static explicit operator Getter(FieldInfo field)
Parameters
Type |
Name |
Description |
System.Reflection.FieldInfo |
field |
|
Returns
Explicit(MethodInfo to Getter)
Convenience operator, equivalent to calling Getter.ForMethod if non-null.
Returns null if method is null.
Declaration
public static explicit operator Getter(MethodInfo method)
Parameters
Type |
Name |
Description |
System.Reflection.MethodInfo |
method |
|
Returns
Inequality(Getter, Getter)
Compare two Getters for inequality
Declaration
public static bool operator !=(Getter a, Getter b)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Implements
System.IEquatable<>