Class ShouldSerialize
Represents code used to determine whether or not to write a value.
Wraps a static method, an instance method, or a delegate.
Inheritance
Implements
Namespace: Cesil
Assembly: Cesil.dll
Syntax
public sealed class ShouldSerialize : Object, IEquatable<ShouldSerialize>
Methods
AllowNullRows()
Returns a ShouldSerialize that differs from this by explicitly allowing null rows be passed to it.
If the backing delegate, or method does not expect null rows this could result in errors at runtime.
Declaration
public ShouldSerialize AllowNullRows()
Returns
Type | Description |
---|---|
ShouldSerialize |
Equals(ShouldSerialize)
Returns true if this object equals the given ShouldSerialize.
Declaration
public bool Equals(ShouldSerialize shouldSerialize)
Parameters
Type | Name | Description |
---|---|---|
ShouldSerialize | shouldSerialize |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Object)
Returns true if this object equals the given ShouldSerialize.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
ForbidNullRows()
Returns a ShouldSerialize 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 ShouldSerialize ForbidNullRows()
Returns
Type | Description |
---|---|
ShouldSerialize |
ForDelegate(StaticShouldSerializeDelegate)
Create a ShouldSerialize from the given delegate.
Declaration
public static ShouldSerialize ForDelegate(StaticShouldSerializeDelegate del)
Parameters
Type | Name | Description |
---|---|---|
StaticShouldSerializeDelegate | del |
Returns
Type | Description |
---|---|
ShouldSerialize |
ForDelegate<TRow>(ShouldSerializeDelegate<TRow>)
Create a ShouldSerialize from the given delegate.
Declaration
public static ShouldSerialize ForDelegate<TRow>(ShouldSerializeDelegate<TRow> del)
Parameters
Type | Name | Description |
---|---|---|
ShouldSerializeDelegate<TRow> | del |
Returns
Type | Description |
---|---|
ShouldSerialize |
Type Parameters
Name | Description |
---|---|
TRow |
ForMethod(MethodInfo)
Create a ShouldSerialize from a method.
Method must return bool.
If method is an instance method it must:
- take zero parameters or
- take one parameter, of type
in WriteContext
If method is a static method, it must:
- take zero parameters or
- take one parameter of the type being serialized or
- take one parameter, of type
in WriteContext
- take two parameters, the first being the type being serialized and the second being
in WriteContext
Declaration
public static ShouldSerialize ForMethod(MethodInfo method)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.MethodInfo | method |
Returns
Type | Description |
---|---|
ShouldSerialize |
GetHashCode()
Returns a stable hash for this ShouldSerialize.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
ToString()
Describes this ShouldSerialize.
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(ShouldSerialize, ShouldSerialize)
Compare two ShouldSerializes for equality
Declaration
public static bool operator ==(ShouldSerialize a, ShouldSerialize b)
Parameters
Type | Name | Description |
---|---|---|
ShouldSerialize | a | |
ShouldSerialize | b |
Returns
Type | Description |
---|---|
System.Boolean |
Explicit(Delegate to ShouldSerialize)
Convenience operator, equivalent to calling ShouldSerialize.ForDelegate if non-null.
Returns null if del is null.
Declaration
public static explicit operator ShouldSerialize(Delegate del)
Parameters
Type | Name | Description |
---|---|---|
System.Delegate | del |
Returns
Type | Description |
---|---|
ShouldSerialize |
Explicit(MethodInfo to ShouldSerialize)
Convenience operator, equivalent to calling ShouldSerialize.ForMethod if non-null.
Returns null if method is null.
Declaration
public static explicit operator ShouldSerialize(MethodInfo method)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.MethodInfo | method |
Returns
Type | Description |
---|---|
ShouldSerialize |
Inequality(ShouldSerialize, ShouldSerialize)
Compare two ShouldSerializes for inequality
Declaration
public static bool operator !=(ShouldSerialize a, ShouldSerialize b)
Parameters
Type | Name | Description |
---|---|---|
ShouldSerialize | a | |
ShouldSerialize | b |
Returns
Type | Description |
---|---|
System.Boolean |