OPC Studio User's Guide and Reference
PreventRecursion<T>(ITreeTraversable<T>) Method



OpcLabs.BaseLib Assembly > OpcLabs.BaseLib.Graphs.Extensions Namespace > ITreeTraversableExtension Class > PreventRecursion Method : PreventRecursion<T>(ITreeTraversable<T>) Method
The type of objects to traverse.
The tree traversable for which the recursion will be prevented.
Creates a derived traversable that prevents recursion into nodes that have already been traversed.
Syntax
'Declaration
 
<ExtensionAttribute()>
<NotNullAttribute()>
Public Overloads Shared Function PreventRecursion(Of T)( _
   ByVal source As ITreeTraversable(Of T) _
) As ITreeTraversable(Of T)
'Usage
 
Dim source As ITreeTraversable(Of T)
Dim value As ITreeTraversable(Of T)
 
value = ITreeTraversableExtension.PreventRecursion(Of T)(source)
[Extension()]
[NotNull()]
public static ITreeTraversable<T> PreventRecursion<T>( 
   ITreeTraversable<T> source
)
[Extension()]
[NotNull()]
public:
static ITreeTraversable<T^>^ PreventRecursiongeneric<typename T>
( 
   ITreeTraversable<T^>^ source
) 

Parameters

source
The tree traversable for which the recursion will be prevented.

Type Parameters

T
The type of objects to traverse.

Return Value

Returns a tree traversable where nodes that have already been traversed are returned without their children being traversed again.
Remarks

If a node is to be returned that has already been traversed, it is still returned; only its children are not traversed again. The result thus allows reconstruction of the original tree, if so required.

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also