TypeName.GetNodeCount Method

Definition

Gets the total number of TypeName instances that are used to describe

this instance, including any generic arguments or underlying types.

public:
 int GetNodeCount();
public int GetNodeCount ();
member this.GetNodeCount : unit -> int
Public Function GetNodeCount () As Integer

Returns

Remarks

This value is computed every time this method gets called, it's not cached.

There's not really a parallel concept to this in reflection. Think of it

as the total number of TypeName instances that would be created if

you were to totally deconstruct this instance and visit each intermediate TypeName

that occurs as part of deconstruction.

"int" and "Person" each have complexities of 1 because they're standalone types.

"int[]" has a node count of 2 because to fully inspect it involves inspecting the

array type itself, plus unwrapping the underlying type ("int") and inspecting that.

"Dictionary<string, List<int[][]>>" has node count 8 because fully visiting it

involves inspecting 8 TypeName instances total:

Applies to