CrystalJsonMemberDefinition
Namespace: SnowBank.Data.Json · class
Implements: IEquatable<CrystalJsonMemberDefinition>
Structure that holds the cached serialization metadata for a field or property of a class or struct
Constructors
CrystalJsonMemberDefinition
CrystalJsonMemberDefinition()
Properties
Attributes
JsonPropertyAttribute Attributes { get; set; }
Optional JsonPropertyAttribute attribute that was applied to this member
Binder
CrystalJsonTypeBinder Binder { get; set; }
Delegate that can bind JSON values to a type that is assignable to this member
DefaultValue
object DefaultValue { get; set; }
Default value for this member (when it is missing)
EncodedName
JsonEncodedPropertyName EncodedName { get; set; }
Cache for the various encoded versions of a property name
Flags
CrystalJsonMemberFlags Flags { get; set; }
Flags for this member
Returns: The flags are used by the various helper properties like IsReadOnly, IsReadOnly and so on
Getter
Func<object, object> Getter { get; set; }
Func that can return the value of this member in an instance of the containing type
HasDefaultValue
bool HasDefaultValue { get; }
If true, the field has a DefaultValue that is not the default for this type.
This is if the default is , , , etc...
IsConstructorBound
bool IsConstructorBound { get; }
The member is bound through a constructor parameter (see ConstructorBinder), and is not assigned after construction
IsInitOnly
bool IsInitOnly { get; }
The member is a read-only field, or a property with an init-only setter
Examples:
int Id; // IsInitOnly == false
int Id { get; set; } // IsInitOnly == false
int Id { get; } // IsInitOnly == false
readonly int Id; // IsInitOnly == true
int Id { get; init; } // IsInitOnly == true
IsKey
bool IsKey { get; }
The member has the KeyAttribute attribute
Examples:
int Id { get; ... } // IsKey == false
[Key]
int Id { get; ... } // IsKey == true
IsNonNullableValueType
bool IsNonNullableValueType { get; }
IsNotNull
bool IsNotNull { get; }
The member cannot be null, or is annotated with NotNullAttribute
Examples:
int Foo { get; ... } // IsNotNull == true
int? Foo { get; ... } // IsNotNull == false
string Foo { get; ... } // IsNotNull == true
string? Foo { get; ... } // IsNotNull == false
IsNullableRefType
bool IsNullableRefType { get; }
The member if a reference type that is declared as nullable in its parent type
Examples:
int Foo { get; ... } // IsNullableRefType == false
int? Foo { get; ... } // IsNullableRefType == false
string Foo { get; ... } // IsNullableRefType == false
string? Foo { get; ... } // IsNullableRefType == true
IsNullableValueType
bool IsNullableValueType { get; }
The member if a nullable value type
Examples:
int Foo { get; ... } // IsNullableValueType == false
int? Foo { get; ... } // IsNullableValueType == true
string Foo { get; ... } // IsNullableValueType == false
string? Foo { get; ... } // IsNullableValueType == false
IsReadOnly
bool IsReadOnly { get; }
Flag set to true when the member is read-only or init-only
IsRequired
bool IsRequired { get; }
The member has the required keyword and cannot be null
Examples:
int Foo { get; ... } // IsRequired == false
string Foo { get; ... } // IsRequired == false
required string? Foo { get; ... } // IsRequired == false
required int Foo { get; ... } // IsRequired == true
required string Foo { get; ... } // IsRequired == true
IsRequiredPresence
bool IsRequiredPresence { get; }
The member must be present in the document when binding ([DataMember(IsRequired = true)])
An absent member throws; an explicit satisfies it (DCJS semantics), unlike which rejects null as well.
Name
string Name { get; set; }
Name of the member
NullableOfType
Type NullableOfType { get; set; }
If not null, the member is an instance of Nullable and this property contains the base value type
Examples:
int Foo { get; ... } // NullableOfType == null
int? Foo { get; ... } // NullableOfType == typeof(int)
string Foo { get; ... } // NullableOfType == null
OriginalName
string OriginalName { get; set; }
Name in the enclosing type
Represent the original name in the c# code, while is the name in the JSON object
Setter
Action<object, object> Setter { get; set; }
Func that can change the value of this member in an instance of the containing type
Type
Type Type { get; set; }
Declared type of the member
Visitor
CrystalJsonTypeVisitor Visitor { get; set; }
Delegate that can serialize values of this member into JSON
Methods
<Clone>$
CrystalJsonMemberDefinition <Clone>$()
Equals
bool Equals(object obj)
bool Equals(CrystalJsonMemberDefinition other)
GetHashCode
int GetHashCode()
IsDefaultValue
bool IsDefaultValue(object value)
Returns true if a possible value for this member is the default value for this member's type (null for ref types or Nullable0 for numbers, false for booleans, ...)
ToString
string ToString()