Getting ready for Mono, and The Importance of Being (Using) Constant(s)'
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.
About Newsletter
Comments are closed.