Skip to content

Children<TNode>.LastOfTypeOrDefault Method ​

Definition ​

Returns the last node in the collection of the specified type or a specified default if it doesn't contain any nodes of the specified type.

c#
public TChild? LastOfTypeOrDefault<TChild>(TChild? @default = null)
   where TChild : TNode;

View source

Type Parameters ​

NameDescription
TChildThe type of the node to return.

Parameters ​

NameTypeDescription
defaultTChildThe default value to return if the collection does not contain any nodes of type TChild.

Returns ​

TChild

The last node if it is of the specified type or default if it doesn't contain any nodes of the specified type.