Back to Devexpress

Node<T> Class

corelibraries-devexpress-dot-dataaccess-dot-node-1.md

latest4.3 KB
Original Source

Node<T> Class

A base class that defines a node in a tree-like structure of objects.

Namespace : DevExpress.DataAccess

Assembly : DevExpress.DataAccess.v25.2.dll

NuGet Package : DevExpress.DataAccess

Declaration

csharp
public class Node<T>
vb
Public Class Node(Of T)

Type Parameters

NameDescription
T

The node value type.

|

The following members return Node<T> objects:

Remarks

The following Node<T> members define a node as part of a tree hierarchy:

  • Value - a T -type object that defines the node’s value.
  • Parent - the node’s immediate parent in a tree structure. null ( Nothing in Visual Basic) if the node is located on a tree’s top level.
  • GetParents() - returns a list of the node’s parents up to the root level.
  • Children - a collection of nodes whose Parent is set to the current node.
  • AddChildren(Node<T>[]) - adds child nodes to the node.
  • AbandonChildren() - removes all child nodes from the node.
  • ForEach(Action<Node<T>>) - performs an action on the node’s each child node.

Declare a class that inherits Node<T> to implement an element of a tree structure:

csharp
using DevExpress.DataAccess;
using DevExpress.DataAccess.Json;
// ...
// Create a new JSON source.
var jsonSource = new UriJsonSource() {
    Uri = new Uri(@"https://localhost:44367/api/values")
};
// Create the "X-Date" and "X-Id" header parameters that are added to the JSON URI requests.
jsonSource.HeaderParameters.AddRange(new[] {
    new HeaderParameter("X-Date", typeof(String), String.Format("{0:yyyy-MM-dd}", DateTime.Today)),
    // "ID" is a report parameter whose value is used for the "X-Id" header parameter.
    new HeaderParameter("X-Id", typeof(Expression), new Expression("?ID"))
});
// Assign the JSON source to the data source.
var datasource = new JsonDataSource() {
    JsonSource = jsonSource
};
vb
Imports DevExpress.DataAccess
Imports DevExpress.DataAccess.Json
' ...
' Create a new JSON source.
Dim jsonSource = New UriJsonSource() With {.Uri = New Uri("https://localhost:44367/api/values")}
' Create the "X-Date" and "X-Id" header parameters that are added to the JSON URI requests.
jsonSource.HeaderParameters.AddRange( {
    New HeaderParameter("X-Date", GetType(String), String.Format("{0:yyyy-MM-dd}", Date.Today)),
    New HeaderParameter("X-Id", GetType(Expression), New Expression("?ID"))
})
    ' "ID" is a report parameter whose value is used for the "X-Id" header parameter.
' Assign the JSON source to the data source.
Dim datasource = New JsonDataSource() With {.JsonSource = jsonSource}

The JsonSchemaNode class is based on Node<JsonNode> and defines nodes of the JsonDataSource‘s Schema. JsonNode contains properties that define the data source field that is created from the node of the JSON schema.

Inheritance

Object Node<T> JsonSchemaNode

See Also

Node<T> Members

DevExpress.DataAccess Namespace