Strongly Typed Resources


The .NET Framework 2.0 and Visual Studio 2005 support a concept of strongly typed resources. So instead of writing this:

 MessageBox.Show(resourceManager.GetString("InsufficientFunds")); 


You can write this:

 MessageBox.Show(Form1Resources.InsufficientFunds); 


You gain several benefits from this. The resource entry name is checked at design time instead of runtime, so typos are eliminated. The property is strongly typed, which gives compile-time type checking. The resource class (Form1Resources, in this example) encapsulates the ResourceManager, so it is not necessary to manage it yourself. Strongly-typed resources are initially covered in Chapter 3 but are also covered again in several other chapters. If you are staying with the .NET Framework 1.1, see the "Strongly-Typed Resources in the .NET Framework 1.1" section in Chapter 3 for an equivalent solution.




.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