C# char "//" path separator

Is there possible to use char "//" another there I did it? I looked for in Path, but I can't find it.

  string separator = "//";

I mean '/'.

I used:

static string sep = System.IO.Path.PathSeparator.ToString();

but it returns: ';'. Why?

Answers


Is System.IO.Path.PathSeparator what you're loking for? There's also .DirectorySeparatorChar and others. See the System.IO.Path class under "Fields".


Path.DirectorySeparatorChar gives you the character used to separate directories in a path, i.e. you use it in paths.

Path.PathSeparator gives you the character used to separate paths in environment variables, i.e. you use it between paths.

For example your system's PATH environment variable will typically list multiple paths where the the OS will look for applications to run.

On Windows Path.PathSeparator is ;, and Path.DirectorySeparatorChar is \, two paths would be stored in an environment variable like this:

set PATH="C:\first\path;C:\second\path"

It's read only, you can't change it. A Path represents a path that the operating system running the framework and your application understands. If you use any other value, the OS won't understand it. There's no OS in the world which understands "a//b//c" paths. But you can have arbitrary strings which contain paths like that, except they won't be OS-understandable file paths, and you can call them something else.


It's equal to Path.PathSeparator, it's better to use this,


Need Your Help

Is there a way to figure out what is using a Linux kernel module?

linux kernel kernel-module

If I load a kernel module and list the loaded modules with lsmod, I can get the "use count" of the module (number of other modules with a reference to the module). Is there a way to figure out what...

Converting a column within pandas dataframe from int to string

python string pandas dataframe int

I have a dataframe in pandas with mixed int and str data columns. I want to concatenate first the columns within the dataframe. To do that I have to convert an int column to str.