Environment Considerations


It is good practice to avoid hard-coding references to specific file locations in any application, but international applications have an additional consideration: The names of special folders are localized in some language versions of Windows. So, if you make a direct reference to the program files folder using "\Program Files", the folder you actually find (if it exists) may or may not be the program files folder you are expecting to find. In the German version of Windows, for example, the program files folder is "\Programme". You can avoid hard-coding references to specific file locations using the Environment.GetFolderPath method. Replace code like this:

 string programFilesFolder = @"\Program Files"; 


with code like this:

 string programFilesFolder =     Environment.GetFolderPath(     Environment.SpecialFolder.ProgramFiles); 





.NET Internationalization(c) The Developer's Guide to Building Global Windows and Web Applications
.NET Internationalization: The Developers Guide to Building Global Windows and Web Applications
ISBN: 0321341384
EAN: 2147483647
Year: 2006
Pages: 213

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net