IEnumerableExtensionsToTreeStringT Method
Transforms an array of string into a string with tree formatting.
Namespace: DevCase.Extensions.IEnumerableExtensionsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[EditorBrowsableAttribute(EditorBrowsableState.Always)]
public static string ToTreeString<T>(
this IEnumerable<T> collection,
Func<T, string> selector,
bool decorate = false
)
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Function ToTreeString(Of T) (
collection As IEnumerable(Of T),
selector As Func(Of T, String),
Optional decorate As Boolean = false
) As String
Dim collection As IEnumerable(Of T)
Dim selector As Func(Of T, String)
Dim decorate As Boolean
Dim returnValue As String
returnValue = collection.ToTreeString(selector,
decorate)
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
generic<typename T>
static String^ ToTreeString(
IEnumerable<T>^ collection,
Func<T, String^>^ selector,
bool decorate = false
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member ToTreeString :
collection : IEnumerable<'T> *
selector : Func<'T, string> *
?decorate : bool
(* Defaults:
let _decorate = defaultArg decorate false
*)
-> string
No code example is currently available or this language may not be supported.
- collection IEnumerableT
-
The source collection.
- selector FuncT, String
-
A transform function to apply to each source element.
- decorate Boolean (Optional)
-
A value that indicates whether or not to replace tabulation characters with ASCII tree decoration characters.
An example of the transformation applied when decorate is :
" Node" -> "└───Node"
Default value is .
- T
-
The type of collection.
String
The resulting string with tree formatting.
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableT. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
This is a code example.
No code example is currently available or this language may not be supported.
Dim collection As Guid() = {Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()}
Dim treeString As String = ToTreeString(Of Guid)(collection, Function(guid As Guid) guid.ToString().ToUpper(), decorate:=True)
Debug.WriteLine(treeString)
' Resulting output string (with decoration):
'
' 6C0A2C2E-B968-466E-B4A4-D401E790CBE3
' └───F8EE007E-E814-4EA9-B090-DBBFD0C56DA6
' └───BD3A3DF8-F9AA-4FC2-8AD6-C24C960B3654
' └───EE32FA3B-AF5B-46E4-9059-E3C821B6E80B
' └───CB3983B8-E831-4DD8-9697-2554F44256A5
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.