Struct ShapeShiftPathElement
- Namespace
- ShapeShift
- Assembly
- ShapeShift.dll
Identifies a single step within a ShapeShiftPath: either the name of a map property, or the 0-based index of an element within a vector.
public readonly struct ShapeShiftPathElement : IEquatable<ShapeShiftPathElement>
- Implements
- Inherited Members
Properties
Index
Gets the 0-based index within a vector that this element identifies.
public int Index { get; }
Property Value
Exceptions
- InvalidOperationException
Thrown when IsPropertyName is true.
IsPropertyName
Gets a value indicating whether this element identifies a map property by name.
public bool IsPropertyName { get; }
Property Value
- bool
true if this element was created by Property(string); false if it was created by Vector(int).
PropertyName
Gets the property name that this element identifies.
public string PropertyName { get; }
Property Value
Exceptions
- InvalidOperationException
Thrown when IsPropertyName is false.
Methods
Equals(ShapeShiftPathElement)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ShapeShiftPathElement other)
Parameters
otherShapeShiftPathElementAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Property(string)
Creates a path element that identifies a value stored at the given propertyName within a map.
public static ShapeShiftPathElement Property(string propertyName)
Parameters
propertyNamestringThe name of the property, exactly as it is expected to appear in the serialized data (i.e. after any naming policy has already been applied).
Returns
- ShapeShiftPathElement
The path element.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Vector(int)
Creates a path element that identifies the value at a given 0-based index within a vector.
public static ShapeShiftPathElement Vector(int index)
Parameters
indexintThe 0-based index of the element within the vector.
Returns
- ShapeShiftPathElement
The path element.
Operators
operator ==(ShapeShiftPathElement, ShapeShiftPathElement)
Checks two path elements for equality.
public static bool operator ==(ShapeShiftPathElement left, ShapeShiftPathElement right)
Parameters
leftShapeShiftPathElementThe first element.
rightShapeShiftPathElementThe second element.
Returns
implicit operator ShapeShiftPathElement(int)
Creates a path element that identifies the value at a given 0-based index within a vector.
public static implicit operator ShapeShiftPathElement(int index)
Parameters
indexintThe 0-based index of the element within the vector.
Returns
- ShapeShiftPathElement
The path element.
implicit operator ShapeShiftPathElement(string)
Creates a path element that identifies a value stored at the given propertyName within a map.
public static implicit operator ShapeShiftPathElement(string propertyName)
Parameters
propertyNamestringThe name of the property, exactly as it is expected to appear in the serialized data (i.e. after any naming policy has already been applied).
Returns
- ShapeShiftPathElement
The path element.
operator !=(ShapeShiftPathElement, ShapeShiftPathElement)
Checks two path elements for inequality.
public static bool operator !=(ShapeShiftPathElement left, ShapeShiftPathElement right)
Parameters
leftShapeShiftPathElementThe first element.
rightShapeShiftPathElementThe second element.