Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the Difference between value and reference type?

Answer Posted / saransony

C# provides a set of different data types. The data types
in C# are divided into two categories – Value Types and
Reference Types. Although there is a third data type –
pointers, Pointers can only be used in unsafe code.
A variable that is a value type, stores the data, while a
variable of a reference type stores a reference to the
data. Both Value Types and Reference Types have one
interesting thing in common – they both derive from System.
Object. This is interesting, because most other object-
oriented languages do not have this behavior.
Value Types
The value of value types is stored on the managed stack,
and can be used directly. This means that the value is
stored, and not a reference to the value. This also means
that each value type has its own copy of the data.
Reference Types on the other hand has a reference to the
data, and several variables can reference the same data.
Reference Types
In contrast to value types, the value of a reference types
is allocated on the heap. Another name for a reference
type, that you might be more familiar with, is an object.
Reference types stores the reference to the data, unlike
value types, that stores the value.
Links- http://www.programmersheaven.com/2/FAQ-CSHARP-
ValueRef-ValueType-Differences

http://msdn.microsoft.com/msdnmag/issues/1200/dotnet/
http://msdn2.microsoft.com/en-
us/library/2hf02550.aspx

http://dotnetsutra.blogspot.com/2007/10/difference-between-
value-type-and.html

Is This Answer Correct ?    22 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is cshtml extension?

873


What is entity framework c#?

811


What is the root element of an xml file?

822


What is an assembly qualified name

975


What is difference between interface and abstraction?

856


write a C# Program add two matrix ?

962


Can you specify an access modifier for an enumeration?

928


What is jit? What are the different types of jit?

947


What is difference between ilist and list in c#?

912


Is c and c# the same?

858


Is datetime immutable c#?

871


Is post back in c#?

901


how to Create a datagridview control with check box column with 8rows in it, the maximum number of check boxes checked should be 3, when user checks the 4th corresponding message should be displayed and check box should be checked. User can uncheck the checked boxes Note: read-only property should not be used

2817


How does c# achieve polymorphism?

890


What is eager loading in c#?

842