Struct CollectionPath
Represents a path to an element.
Syntax
public readonly struct CollectionPath : IEquatable<CollectionPath>, IEquatable<string>
Constructors
CollectionPath(String)
Declaration
public CollectionPath(string path)
Parameters
Type |
Name |
Description |
String |
path |
A path.
|
Properties
IsEmpty
Returns whether the path is empty.
Declaration
public readonly bool IsEmpty { get; }
Property Value
Length
Returns the length of the path.
Declaration
public readonly int Length { get; }
Property Value
Methods
BuildPath(String[])
Creates a string path in the format of a CollectionPath from the given inputs.
Declaration
public static string BuildPath(params string[] components)
Parameters
Type |
Name |
Description |
String[] |
components |
The individual elements of the path.
|
Returns
Type |
Description |
String |
A string path combining all inputs.
|
CombinePaths(CollectionPath, CollectionPath)
Creates a new path from the given paths.
Declaration
public static CollectionPath CombinePaths(CollectionPath startPath, CollectionPath relativePath)
Parameters
Returns
Contains(String)
Checks whether the path contains the given string.
Declaration
public readonly bool Contains(string str)
Parameters
Type |
Name |
Description |
String |
str |
A string to verify.
|
Returns
Type |
Description |
Boolean |
True if the parameter string is contained within the path.
|
EndsWith(String)
Checks whether the path ends with the given string.
Declaration
public readonly bool EndsWith(string str)
Parameters
Type |
Name |
Description |
String |
str |
A string to verify.
|
Returns
Type |
Description |
Boolean |
True if the parameter string matches the end of the path.
|
Equals(Object)
Declaration
public override readonly bool Equals(object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
Overrides
Equals(String)
Declaration
public readonly bool Equals(string str)
Parameters
Type |
Name |
Description |
String |
str |
|
Returns
Implements
Equals(CollectionPath)
Declaration
public readonly bool Equals(CollectionPath other)
Parameters
Returns
Implements
GetHashCode()
Declaration
public override readonly int GetHashCode()
Returns
Overrides
GetParentPath(CollectionPath, Int32)
Trims the path
back to the specified parent.
Declaration
public static CollectionPath GetParentPath(CollectionPath path, int trimCount = 1)
Parameters
Type |
Name |
Description |
CollectionPath |
path |
The path to query.
|
Int32 |
trimCount |
The number of components to trim from the path.
|
Returns
GetPathComponents()
Returns the components of the path.
Declaration
public readonly string[] GetPathComponents()
Returns
Type |
Description |
String[] |
An array of string representing every element in the path.
|
StartsWith(String)
Checks whether the path starts with the given string.
Declaration
public readonly bool StartsWith(string str)
Parameters
Type |
Name |
Description |
String |
str |
A string to verify.
|
Returns
Type |
Description |
Boolean |
True if the parameter string matches the beginning of the path.
|
ToString()
Declaration
public override readonly string ToString()
Returns
Overrides
Operators
Equality(CollectionPath, CollectionPath)
Declaration
public static bool operator ==(CollectionPath a, CollectionPath b)
Parameters
Returns
Implicit(String to CollectionPath)
Declaration
public static implicit operator CollectionPath(string a)
Parameters
Type |
Name |
Description |
String |
a |
|
Returns
Implicit(CollectionPath to String)
Declaration
public static implicit operator string (CollectionPath a)
Parameters
Returns
Inequality(CollectionPath, CollectionPath)
Declaration
public static bool operator !=(CollectionPath a, CollectionPath b)
Parameters
Returns