The Globalization class
According to MSDN, Globalization is the process of designing and developing a software product that functions in multiple cultures/locales.
- Identifying the culture/locale that must be supported.
- Designing features that support those cultures/locales.
- Writing code that functions equally well in any of the supported cultures/locales.
I hope you understand some basics about the Globalization class.
- Open Visual Studio from Start -> All programs -> Microsoft Visual Studio.
- Then go to to "File" -> "New" -> "WebSite..." then select Visual C# -> Web application.
- Then specify the name, CountryList, or any name as you wish and the location of the project and click on the OK button. The new web site is created.
Now call the preceding method on page load with the dropdonlist to bind the country list as:
In the code above I first ensured that my page is not posted back using the IsPostBack property so the dropdownlist is not be refreshed every page post-back and then I just assigned the country list method to the dropdownlist Data Source property and finally calling the Data Bind method to bind the dropdownlist. You can also bind the preceding list method to any control that supports the Data Source property.
Now run the application and select a Country from the DropDownList that looks as in the following image:
From the preceding example, it's clear that if we understand the .Net Framework deeply then you can reduce our application code more than, or at least, 50 percent and that results in better application performance.