.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani

Home >> Articles >> .Net Framework >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Identification Of Reference Type and Value Types

Posted By:Hefin Dsouza       Posted Date: August 14, 2009    Points: 25    Category: .Net Framework    URL: http://www.dotnetspark.com  
 

Identification Of Reference Type and Value Types.

The Following Sample may help you do many tasks such as.


1. Classify Reference Types and value Types
2. Get The .Net Framework Version and Install Path Dynamically
3. List The Primitive Data Types in .net Framework
4. Also Understand how to make progressbar progress according to jobs done in a simple way

The Following Code will retrive the framework path and load the assembly mscorlib.dll and get all the types

static string frameWorkPath = RuntimeEnvironment.GetRuntimeDirectory(); // Gets The Framework Path
static Assembly netAssem = Assembly.LoadFile(frameWorkPath + "\\mscorlib.dll");//Loads The mscorlib.dll to Assembly Object
Type[] allTypes = netAssem.GetTypes(); // Get All Types to an Array of Type


The Following Code will get the Framework version dynamically

label3.Text = "Current Version of .net Framework is : " + RuntimeEnvironment.GetSystemVersion(); // Get Current version of .Net Framework


Checking For Primitive Types

if (dT.IsPrimitive == true)
{
......
}

Checking For Value Type and Reference Type

if (dT.IsValueType == true)
{
....
}else
{
}


For Making it Much Easy to understand i have uploaded the Sample Code with all functionality and User Interface
Download Full Source Code
Regards Hefin Dsouza

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend