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
Implements
System.IEquatable<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
Type Description
Getter

AllowNullValues()

Returns a Getter that differs from this by explicitly allowing null values to be returned from it.

Declaration
public Getter AllowNullValues()
Returns
Type Description
Getter

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
Type Description
Getter

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
Type Description
Getter

ForDelegate<TValue>(StaticGetterDelegate<TValue>)

Create a Getter from the given delegate.

Declaration
public static Getter ForDelegate<TValue>(StaticGetterDelegate<TValue> del)
Parameters
Type Name Description
StaticGetterDelegate<TValue> del
Returns
Type Description
Getter
Type Parameters
Name Description
TValue

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
Type Name Description
GetterDelegate<TRow, TValue> del
Returns
Type Description
Getter
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
Type Description
Getter

ForMethod(MethodInfo)

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
Type Description
Getter

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
Type Description
Getter

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
Type Name Description
Getter a
Getter b
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
Type Description
Getter

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
Type Description
Getter

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
Type Description
Getter

Inequality(Getter, Getter)

Compare two Getters for inequality

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

Implements

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