C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » .NET Framework »

Retrieving C# primitive datatypes programmatically


Posted Date: 26 May 2005    Resource Type: Articles    Category: .NET Framework
Author: Balamurali BalajiMember Level: Diamond    
Rating: 1 out of 5Points: 10



Introduction



As Everyone knows, the assembly mscorlib.dll contains the core library classes in .Net framework. It stores all type information and associated meta-data. Here is a sample program to load the assembly mscorlib.dll and get the datatypes we need.

Sample code to retrive primitive types





public static void Main()
{
Assembly SampleAssembly;
string str = "C:\\WINNT\\Microsoft.NET\\Framework\\v1.0.3705\\mscorlib.dll";
SampleAssembly = Assembly.LoadFrom(str);
Type[] t;
t = SampleAssembly.GetTypes();
foreach (Type x in t)
{
if (x.IsValueType == true)
if (x.IsPrimitive == true)
listBox1.Items.Add(x.FullName.ToString());
}
}


Summary




The same program could be modified for retrieving other type information also.




Responses

Author: Anil Rajan    27 May 2005Member Level: Gold   Points : 0
hi
that was little but good information


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Getting Sql Column Metadata using ADO.NET
Previous Resource: Popup windows in ASP.NET using C#
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use