C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Retrieving C# primitive datatypes programmatically


Posted Date: 26 May 2005    Resource Type: Articles    Category: .NET Framework

Posted By: Balamurali Balaji       Member Level: Diamond
Rating:     Points: 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  
(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!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

web conferencing services

Contact Us    Privacy Policy    Terms Of Use