Struct PropertyPath
A PropertyPath is used to store a reference to a single property within a tree.
Inherited Members
Namespace: Unity.Properties
Syntax
public readonly struct PropertyPath : IEquatable<PropertyPath>
Remarks
The path is stored as an array of parts and can be easily queried for algorithms.
Constructors
PropertyPath(String)
Initializes a new instance of the PropertyPath based on the given property string.
Declaration
public PropertyPath(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path | The string path to initialize this instance with. |
Properties
IsEmpty
Gets if there is any part contained in the PropertyPath.
Declaration
public readonly bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean |
Item[Int32]
Gets the PropertyPathPart at the given index.
Declaration
public readonly PropertyPathPart this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Property Value
Type | Description |
---|---|
PropertyPathPart |
Length
Gets the number of parts contained in the PropertyPath.
Declaration
public readonly int Length { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
AppendIndex(in PropertyPath, Int32)
Returns a new PropertyPath combining the given PropertyPath and an index-type PropertyPathPart.
Declaration
public static PropertyPath AppendIndex(in PropertyPath path, int index)
Parameters
Type | Name | Description |
---|---|---|
PropertyPath | path | The PropertyPath |
Int32 | index | The index to add. |
Returns
Type | Description |
---|---|
PropertyPath | A new PropertyPath |
AppendKey(in PropertyPath, Object)
Returns a new PropertyPath combining the given PropertyPath and an key-type PropertyPathPart.
Declaration
public static PropertyPath AppendKey(in PropertyPath path, object key)
Parameters
Type | Name | Description |
---|---|---|
PropertyPath | path | The PropertyPath |
Object | key | The key to add. |
Returns
Type | Description |
---|---|
PropertyPath | A new PropertyPath |
AppendName(in PropertyPath, String)
Returns a new PropertyPath combining the given PropertyPath and an name-type PropertyPathPart.
Declaration
public static PropertyPath AppendName(in PropertyPath path, string name)
Parameters
Type | Name | Description |
---|---|---|
PropertyPath | path | The PropertyPath |
String | name | The part name to add. |
Returns
Type | Description |
---|---|
PropertyPath | A new PropertyPath |
AppendPart(in PropertyPath, in PropertyPathPart)
Returns a new PropertyPath combining the given PropertyPath and PropertyPathPart.
Declaration
public static PropertyPath AppendPart(in PropertyPath path, in PropertyPathPart part)
Parameters
Type | Name | Description |
---|---|---|
PropertyPath | path | The PropertyPath |
PropertyPathPart | part | The part to add. |
Returns
Type | Description |
---|---|
PropertyPath | A new PropertyPath |
AppendProperty(in PropertyPath, IProperty)
Returns a new PropertyPath combining the given PropertyPath and a PropertyPathPart whose type will be based on the property interfaces.
Declaration
public static PropertyPath AppendProperty(in PropertyPath path, IProperty property)
Parameters
Type | Name | Description |
---|---|---|
PropertyPath | path | The PropertyPath |
IProperty | property | The property to add. |
Returns
Type | Description |
---|---|
PropertyPath | A new PropertyPath |
Combine(in PropertyPath, String)
Returns a new PropertyPath combining the parts of the two given PropertyPath.
Declaration
public static PropertyPath Combine(in PropertyPath path, string pathToAppend)
Parameters
Type | Name | Description |
---|---|---|
PropertyPath | path | The PropertyPath |
String | pathToAppend | The string path to append. |
Returns
Type | Description |
---|---|
PropertyPath | A new PropertyPath |
Combine(in PropertyPath, in PropertyPath)
Returns a new PropertyPath combining the parts of the two given PropertyPath.
Declaration
public static PropertyPath Combine(in PropertyPath path, in PropertyPath pathToAppend)
Parameters
Type | Name | Description |
---|---|---|
PropertyPath | path | The PropertyPath |
PropertyPath | pathToAppend | The PropertyPath to append. |
Returns
Type | Description |
---|---|
PropertyPath | A new PropertyPath |
Equals(Object)
Declaration
public override readonly bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
Equals(PropertyPath)
Indicates whether this instance and a specified object are equal.
Declaration
public readonly bool Equals(PropertyPath other)
Parameters
Type | Name | Description |
---|---|---|
PropertyPath | other | The object to compare with the current instance. |
Returns
Type | Description |
---|---|
Boolean | true if obj and this instance are the same type and represent the same value; otherwise, false. |
Implements
FromIndex(Int32)
Returns a new PropertyPath from the provided index.
Declaration
public static PropertyPath FromIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the PropertyPathPart. |
Returns
Type | Description |
---|---|
PropertyPath | A new PropertyPath |
FromKey(Object)
Returns a new PropertyPath from the provided key.
Declaration
public static PropertyPath FromKey(object key)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the PropertyPathPart. |
Returns
Type | Description |
---|---|
PropertyPath | A new PropertyPath |
FromName(String)
Returns a new PropertyPath from the provided name.
Declaration
public static PropertyPath FromName(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the PropertyPathPart. |
Returns
Type | Description |
---|---|
PropertyPath | A new PropertyPath |
FromPart(in PropertyPathPart)
Returns a new PropertyPath from the provided PropertyPathPart.
Declaration
public static PropertyPath FromPart(in PropertyPathPart part)
Parameters
Type | Name | Description |
---|---|---|
PropertyPathPart | part | The PropertyPathPart |
Returns
Type | Description |
---|---|
PropertyPath | A new PropertyPath |
GetHashCode()
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
Pop(in PropertyPath)
Returns a new PropertyPath that will not include the last PropertyPathPart.
Declaration
public static PropertyPath Pop(in PropertyPath path)
Parameters
Type | Name | Description |
---|---|---|
PropertyPath | path | The PropertyPath |
Returns
Type | Description |
---|---|
PropertyPath | A new PropertyPath |
SubPath(in PropertyPath, Int32)
Returns a new PropertyPath containing the PropertyPathPart starting at the given start index.
Declaration
public static PropertyPath SubPath(in PropertyPath path, int startIndex)
Parameters
Type | Name | Description |
---|---|---|
PropertyPath | path | The PropertyPath |
Int32 | startIndex | The zero-based index where the sub path should start. |
Returns
Type | Description |
---|---|
PropertyPath | A new PropertyPath |
SubPath(in PropertyPath, Int32, Int32)
Returns a new PropertyPath containing the given number of PropertyPathPart starting at the given start index.
Declaration
public static PropertyPath SubPath(in PropertyPath path, int startIndex, int length)
Parameters
Type | Name | Description |
---|---|---|
PropertyPath | path | The PropertyPath |
Int32 | startIndex | The zero-based index where the sub path should start. |
Int32 | length | The number of parts to include. |
Returns
Type | Description |
---|---|
PropertyPath | A new PropertyPath |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
ToString()
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
String |