Skip to content

Commit

Permalink
updated readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cvietor committed Jun 29, 2017
1 parent dc45df7 commit 70863fa
Showing 1 changed file with 43 additions and 2 deletions.
45 changes: 43 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,43 @@
# PathToTreeConverter
A simple class that converts a list of string paths to a tree model
# What is this?
A simple C# class that converts a list of string paths into a tree model.

# How does that look?
Given an input like:

```
"//subFolder1",
"//subFolder1//subsubfolder1a",
"//subFolder1//subsubfolder1a//sub-sub-sub",
"//subFolder2",
"//subFolder2//subsubfolder1b"
```

turns into:

```
+ subFolder1
+ subsubfolder1a
+ sub-sub-sub
+ subFolder2
+ subsubfolder1b
```

# How does that work?
Easy...
```
var paths = new[]
{
"//subFolder1",
"//subFolder1//subsubfolder1a",
"//subFolder1//subsubfolder1a//sub-sub-sub",
"//subFolder2",
"//subFolder2//subsubfolder1b"
};
var converter = new PathsToTreeConverter();
converter.SetDelimiterSymbol("//"); // "/" is default, otherwise use the SetDelimiterSymbol method
var result = converter.Convert(paths);
// now do something funky with your list of tree nodes
```

0 comments on commit 70863fa

Please sign in to comment.