hi
please help me on below topic
in c# there are already built in data type like int,float,char,string
then why there is need of value type and reference type
please tell me
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Manas MohapatraPosted Aug 9, 2016, 6:19 AM
Vinay SinghPosted Aug 9, 2016, 7:17 AM
As we know
int,boolandfloatare specific types, interfaces and delegates are kinds of type - just likestructandenumare kinds of value types.Pleaseexplanation of reference types and value types in this article. I'd be happy to expand on any bits which you find confusing.
The "TL;DR" version is to think of what the value of a variable/expression of a particular type is. For a value type, the value is the information itself. For a reference type, the value is a reference which may be null or may be a way of navigating to an object containing the information.
For example, think of a variable as like a piece of paper. It could have the value "5" or "false" written on it, but it couldn't have my house... it would have to have directions to my house. Those directions are the equivalent of a reference. In particular, two people could have different pieces of paper containing the same directions to my house - and if one person followed those directions and painted my house red, then the second person would see that change too. If they both just had separatepictures of my house on the paper, then one person colouring their paper wouldn't change the other person's paper at all.
for more detail have a look of the linkNitin SontakkePosted Aug 9, 2016, 7:13 AM