should we use Path.DirectorySeperatorChar C#
.net, c#, string
Solution
Yes, use the property. It will be more future-proof. You will be compatible with Mono (Linux) but MS.NET may also move to other platforms (like Compact and Micro Framework).
But the best method is to use `Path.Combine()` and `Path.GetFileName()` et al, and then you won't be needing the separator char at all.
Problem
A question that's lurking in my head for a while now. What's the importance of Path.DirectorySeperatorChar ? I mean can't we just put '\' instead - which i think is faster than calling a property especially if you're constructing a huge number of paths in your application? Is there a reason for it? could there be another Char for folder/file path seperation other than '\' ? maybe in another operating system?