Class Node<TObject, TKey>
- Namespace
- DynamicData
- Assembly
- DynamicData.dll
Node describing the relationship between and item and it's ancestors and descendent.
public class Node<TObject, TKey> : IDisposable, IEquatable<Node<TObject, TKey>> where TObject : class where TKey : notnull
Type Parameters
TObject
The type of the object.
TKey
The type of the key.
- Inheritance
-
Node<TObject, TKey>
- Implements
-
IEquatable<Node<TObject, TKey>>
- Extension Methods
Constructors
Node(TObject, TKey)
Initializes a new instance of the Node<TObject, TKey> class.
public Node(TObject item, TKey key)
Parameters
item
TObjectThe item.
key
TKeyThe key.
Node(TObject, TKey, in Optional<Node<TObject, TKey>>)
Initializes a new instance of the Node<TObject, TKey> class.
public Node(TObject item, TKey key, in Optional<Node<TObject, TKey>> parent)
Parameters
Properties
Children
Gets the child nodes.
public IObservableCache<Node<TObject, TKey>, TKey> Children { get; }
Property Value
- IObservableCache<Node<TObject, TKey>, TKey>
Depth
Gets the depth i.e. how many degrees of separation from the parent.
public int Depth { get; }
Property Value
IsRoot
Gets a value indicating whether this instance is root.
public bool IsRoot { get; }
Property Value
- bool
true
if this instance is root node; otherwise,false
.
Item
Gets the item.
public TObject Item { get; }
Property Value
- TObject
Key
Gets the key.
public TKey Key { get; }
Property Value
- TKey
Parent
Gets the parent if it has one.
public Optional<Node<TObject, TKey>> Parent { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
Disposes any managed or unmanaged resources.
protected virtual void Dispose(bool isDisposing)
Parameters
isDisposing
boolIf the dispose is being called by the Dispose method.
Equals(Node<TObject, TKey>?)
Determines whether the specified object is equal to the current object.
public bool Equals(Node<TObject, TKey>? other)
Parameters
other
Node<TObject, TKey>The object to compare with the current object.
Returns
- bool
true if the specified object is equal to the current object; otherwise, false.
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
- bool
true if the specified object is equal to the current object; otherwise, false.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ToString()
Returns a string that represents this instance.
public override string ToString()
Returns
Operators
operator ==(Node<TObject, TKey>?, Node<TObject, TKey>?)
Determines whether the specified objects are equal.
public static bool operator ==(Node<TObject, TKey>? left, Node<TObject, TKey>? right)
Parameters
left
Node<TObject, TKey>The left value to compare.
right
Node<TObject, TKey>The right value to compare.
Returns
- bool
If the two values are equal.
operator !=(Node<TObject, TKey>, Node<TObject, TKey>)
Determines whether the specified objects are not equal.
public static bool operator !=(Node<TObject, TKey> left, Node<TObject, TKey> right)
Parameters
left
Node<TObject, TKey>The left value to compare.
right
Node<TObject, TKey>The right value to compare.
Returns
- bool
If the two values are not equal.