Class DeserializerMemberAttribute

Attach this attribute to a method, field, property, or parameter to expose it as deserializable and configure it's "Parser", "MemberRequired", "Reset", and "Order" behaviors.

If attached to a property, the propery must have a setter and take no parameters.

If attached to a method it must return void.

If attached to a parameter, the parameter must be to a constructor, all parameters to the constructor must also be annotated, and the constructor itself must be annotated with DeserializerInstanceProviderAttribute.

If attached to 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 attached to an instance method it may:

  • be on the row type, and take 1 parameter (the result of the parser) or
  • be on the row type, and take 2 parameters, the result of the parser and an in ReadContext
Inheritance
System.Object
System.Attribute
DeserializerMemberAttribute
Implements
System.IEquatable<DeserializerMemberAttribute>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Cesil
Assembly: Cesil.dll
Syntax
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public sealed class DeserializerMemberAttribute : Attribute, IEquatable<DeserializerMemberAttribute>

Constructors

| Improve this Doc View Source

DeserializerMemberAttribute()

Create a GenerateDeserializableAttribute attribute.

Declaration
public DeserializerMemberAttribute()

Properties

| Improve this Doc View Source

HasOrder

Returns true if Order has been explicitly set.

Getting Order when HasOrder is false will throw an exception.

Declaration
public bool HasOrder { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

MemberRequired

Whether or not this column is required.

Defaults to No, except for on constructor parameters (where it must be Yes).

Declaration
public MemberRequired MemberRequired { get; set; }
Property Value
Type Description
MemberRequired
| Improve this Doc View Source

Name

The name of the column which maps to this member.

For fields and properties, this defaults to their declared name.

For methods, this must be explicitly set.

Declaration
public string Name { get; set; }
Property Value
Type Description
System.String
| Improve this Doc View Source

Order

Value used to order columns.

Set to null to leave order unspecified.

Orders with explicit values are sorted before those without values.

Check HashOrder before getting Order, or an exception will be thrown.

Declaration
public int Order { get; set; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

ParserMethodName

Name of parser method, used with ParserType.

If non-null, ParserType must also be set.

The method must:

  • be static
  • return a bool
  • have 3 parameters
  • ReadOnlySpan(char)
  • in ReadContext,
  • out assignable to outputType
Declaration
public string ParserMethodName { get; set; }
Property Value
Type Description
System.String
| Improve this Doc View Source

ParserType

Type to lookup a parser method on, used with ParserMethodName.

If null, defaults to a built in Parser for the type of this member (if any).

If non-null, ParserMethodName must also be set.

The type must be public (or internal, if declared in the same assembly as the annotated type).

Declaration
public Type ParserType { get; set; }
Property Value
Type Description
System.Type
| Improve this Doc View Source

ResetMethodName

Name of reset method, used with ResetType.

If non-null, ResetType must also be set.

The method must return void.

If referring to an instance method it can take:

  • zero parameters or
  • a single in ReadContext parameter.

If referring to a static method it can take:

  • zero parameters or
  • a single parameter of the row type or
  • a single parameter of in ReadContext or
  • two parameters, the first of the row type (which may be by ref) and the second of in ReadContext
Declaration
public string ResetMethodName { get; set; }
Property Value
Type Description
System.String
| Improve this Doc View Source

ResetType

Type to lookup a reset method on, used with ResetMethodName.

If non-null, ResetMethodName must also be set.

Declaration
public Type ResetType { get; set; }
Property Value
Type Description
System.Type

Methods

| Improve this Doc View Source

Equals(DeserializerMemberAttribute)

Returns true if the given GenerateDeserializableMemberAttribute is equal to this one.

Declaration
public bool Equals(DeserializerMemberAttribute attribute)
Parameters
Type Name Description
DeserializerMemberAttribute attribute
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Equals(Object)

Return true if the given object is a GenerateDeserializableMemberAttribute equal to this one.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.Attribute.Equals(System.Object)
| Improve this Doc View Source

GetHashCode()

Returns a stable hash code for this GenerateDeserializableMemberAttribute.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Attribute.GetHashCode()
| Improve this Doc View Source

ToString()

Returns a representation of this GenerateDeserializableMemberAttribute object.

Only for debugging, this value is not guaranteed to be stable.

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

Operators

| Improve this Doc View Source

Equality(DeserializerMemberAttribute, DeserializerMemberAttribute)

Compare two GenerateDeserializableMemberAttribute for equality

Declaration
public static bool operator ==(DeserializerMemberAttribute a, DeserializerMemberAttribute b)
Parameters
Type Name Description
DeserializerMemberAttribute a
DeserializerMemberAttribute b
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Inequality(DeserializerMemberAttribute, DeserializerMemberAttribute)

Compare two GenerateDeserializableMemberAttribute for inequality

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

Implements

System.IEquatable<T>
  • Improve this Doc
  • View Source
Back to top Generated by DocFX