How to get and display C# data types in ASP.Net
In C# there are 19 types of data types including empty null reference that can be used to declare a variable or property field. If you are also trying to fetch the list of all supported data types in C# then you can use the following code to get and display the data types by binding the list to the ASP.Net Dropdownlist server control. Mostly this kind of data types list is required in rapid application development tools when the automation is provided to the developer for selecting the data types for each property and generates the C# class in a definite pattern or format.
Code to Get all C# Data Types
foreach (string datatype in Enum.GetNames(typeof(System.TypeCode)))
{
DropDownList1.Items.Add(datatype);
}
The System.TypeCode enumeration provides the list of predefined names for the data types available in C# language that can used to declare the variables. In the above code we have used to C# foreach loop to loop over the items of the TypeCode enum and get the name of the data type in each iteration. Inside the loop code block we have used the Items.Add method of the Dropdownlist server control to add the names of the C# data types to display them on the ASP.Net web page.
Continue to next tutorial: Show/Hide Group of Controls in ASP.Net using C# to learn how to change the visibility of set of controls dynamically.

* will not be published
* hint: http://www.example.com