Value Types and Reference Types:
- Value types are defined from System.ValueType while the reference types are derived from System.Object.
- The stack holds the value type variables along with return addresses.
- The heap holds the reference type variables value.
Copying Value Types Variables:
- If you copy one value type variable from another, a direct copy of variable value is made.
- If you are curious how is it created on stack, then this is how it is looks on stack:
- So now when we copy the value of a to b by using the following statement:
4. Value of a is directly copied to b.
Copying Reference Type Variables:
- Lets create a variable of type reference. String is a built-in reference type, we will create an object of string and assign some value to it as follows:
Regards
Sameer Shaik
Tags: Microsoft MCTS exam, Learn, Tutorials, Free C#, Free Videos, Microsoft Dot Net Jobs,Microsoft Dot Net Jobs Interview, Free Training and Preparation, Jobs MCTS specialization, visual studio.net, study guide, sample questions, Exam Prep, Exam Practice Test
No comments:
Post a Comment