Scott Hanselman

Getting ready for Mono, and The Importance of Being (Using) Constant(s)'

June 10, 2004 Comment on this post [1] Posted in Programming
Sponsored By

I was poking around in the nGallery site and found these gems, as nGallery is (stunningly) Mono Compliant.  I thought that #1 really hit home when it comes to the importance of using such (often thought silly) things like System.Environment.NewLine and System.IO.Path.DirectorySeparatorChar.  If there's a constant in the Framework, it's usually there for a reason.

Rule #1:  Never, ever, ever use the \ to seperate directories when doing any file I/O. Instead, use the System.IO.Path.DirectorySeparatorChar constant. This translates directly over to the *nix world and makes for a smooth transition in Mono.

Rule #2:  Just as most of us have learned case sensitivity in .NET, carry this forward to your file I/O operations, again, and make sure all files and directories are case sensitive.

Rule #3:  Make sure you don't compile your assemblies with the /incremental flag. Mono can't support incremental compilation. For more details on what "incremental compilation". [Jason Alexander

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
June 10, 2004 5:52
Here are some other .net projects ported (with patches) to mono: http://go-mono.com/ports/

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.