C#C
C#3y ago
Pokey

❔ ✅ Parsing path into parts with varying separators?

The traditional way to do this would be

string myPath = "C:\\Users\\Me\\Desktop";
string[] myPathParts = myPath.Split(Path.DirectorySeparatorChar);


But what if the path uses / instead of \ because as far as I am aware Windows will understand this, but that wouldn't be the DirectorySeparatorChar?

Thanks!
Was this page helpful?