Understanding Common Type System in .NET
page 3 of 6
by Suresh Kumar Goudampally
Feedback
Average Rating: 
Views (Total / Last 10 Days): 9132/ 162

Value Types and Reference Types

Value Type

A variable of this type represents a piece of data itself. Memory is allocated on the stack.

Listing 1

// Structure , Enumerations and primitive datatypes.
int i = 8;
int i1 = i;
i = 9;

Here, changing one will not have impact on another; the memory here is created twice.

Reference Type

A variable of this category points to the location of data rather than data itself. Memory is created on the heap. Arrays, Classes, Delegates and Interface are examples.

This type is similar to pointers.

Listing 2

Class1 objClass1 = new Class2();
objClass1.Name = "S";
Class1 objClass1Intance = objClass1;
objClass1Intance = "SU";      

Here, both instances refer to the same object, changes to one applies to both.


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 6 and 1 and type the answer here:

User Comments

Title: Hi   
Name: Sunny
Date: 5/31/2008 3:44:39 AM
Comment:
Superb, great work.........
Title: Good Notes   
Name: Babitha
Date: 3/7/2008 11:53:18 AM
Comment:
Very Nice.
Title: Hi   
Name: Suresh Kumar
Date: 1/31/2008 7:05:12 AM
Comment:
Hi shivaprasad,
can i know and who r u and

for which company you are working for?


Regards
Suresh Kumar Goudampally
Title: Good notes   
Name: s.k.shivaprasad
Date: 1/31/2008 4:32:59 AM
Comment:
Good work! I would like to see more articles from you in the future



thanks,
s.k.shivaprasad
Software Engineer.
Title: Understanding CTS   
Name: Madhavi G
Date: 1/30/2008 12:04:55 AM
Comment:
Good One, though i am from testing, was able to understand, keep posting such articles.
Title: CTS   
Name: Nitin Sharma
Date: 1/11/2008 2:01:57 AM
Comment:
Good One..!! :-)

Nitin Sharma
Software Engineer
Title: Good Article   
Name: Joydip Kanjilal
Date: 1/10/2008 11:50:31 AM
Comment:
Good work! I would like to see more articles from you in the future.

Thanks,

Joydip

Author: ASP.NET Data Presentation Controls Essentials (Packt Publishing)

Product Spotlight
Product Spotlight 
Learn More
.NET Tools
asp.net shopping cart
asp.net chart control






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2008 ASPAlliance.com  |  Page Processed at 12/3/2008 11:27:03 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search