[Mono-dev] How To know in runtime inside a C# program

Jonathan Gagnon jonathan.gagnon at croesus.com
Fri Jul 27 08:28:59 EDT 2007


You can also use System.IO.Path.DirectorySeparatorChar, that returns '/' or
'\' depending on the platform you're running on.

Jonathan 

-----Message d'origine-----
De : mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] De la part de Andreas Nahr
Envoyé : Thursday, July 26, 2007 4:22 PM
À : 'josepascual'; 'Mono devel list'
Objet : Re: [Mono-dev] How To know in runtime inside a C# program

 
Just use
Path.Combine (FirstPart, SecondPart)
It will create the correct path for the system you are running on.

Andreas

-----Ursprüngliche Nachricht-----
Von: mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] Im Auftrag von josepascual
Gesendet: Donnerstag, 26. Juli 2007 10:30
An: 'Mono devel list'
Betreff: [Mono-dev] How To know in runtime inside a C# program

Hi Everyone,

I'm doing a program in C# using mono. I want to run it in win32 and linux. I
have a problem with '/' and '\' for directory in win32 and linux.

How Can I know in runtime if I'm in linux (unix) or in Windows to choose '\'
for windows and '/' for linux in path for files?

thank you,

Jose Pascual

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list