Identity Interface I should know better


7
Aug/08
0

Creating File Paths in C#

Path.Combine is an easy and reliable way to combine path and file information.

Before

DataFile = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\" + "samplefile.xml"

After

DataFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop),"samplefile.xml");

When using Special Folders you need to call Environment.GetFolderPath to return the actual path.

Filed under: code
Comments (0) Trackbacks (0)

No comments yet.

Leave a comment


No trackbacks yet.