What is the Difference between value and reference type?
Answer Posted / amit kumar
Value Type:
When you assign value to value type variable to
another variable then it's value only copy to another
variable. It allocates memory in stack. Here both variables
work independent.
Reference Type:
When you assign value to reference type variable to
another reference type variable then it's value doesn't
copy both variables are dependent to each other and if you
change one value it reflects in other one. It allocates
memory in the heap data structure.
| Is This Answer Correct ? | 25 Yes | 12 No |
Post New Answer View All Answers
what will be the output of the given below coding. using System; public class Exercise { static void OddNumbers(int a) { if (a >= 1) { Console.Write("{0}, ", a); a -= 2; OddNumbers(a); } } public static int Main() { const int Number = 9; Console.WriteLine("Odd Numbers"); OddNumbers(Number); Console.WriteLine(); return 0; } }
How do you convert byte array to hexadecimal string, and vice versa?
Is datetime nullable c#?
what is the difference between .dll and .exe
What is .cshtml file?
What is parsing?
What is meant by enumerable in c#?
In which situation(s), the use of "Delegate" is a good idea?
What all details the assembly manifest will contain?
what is main function of alternate teamplate of datalist?
What is difference between continue and break in c#?
How can I make sure my c# classes will interoperate with other .net languages?
What is wpf c#?
What is difference between static and constant variable?
Can namespace contain the private class?