What is the definition of a value class
and reference class
in C#?
How does this differ from a value type
and reference type
?
I ask this question because I read this in the MCTS Self-Paced Training Kit (Exam 70-536). Chapter 1, Lesson 1, Lesson review 4 :
You need to create a simple class or structure that contains only value types. You must create the class or structure so that it runs as efficiently as possible. You must be able to pass the class or structure to a procedure without concern that the procedure will modify it. Which of the following should you create?
A reference class
B reference structure
C value class
D value structure
Correct Answer: D
A Incorrect: You could create a reference class; however, it could be modified when passed to a procedure.
B Incorrect: You cannot create a reference structure.
C Incorrect: You could create a value class; however, structures tend to be more efficient.
D Correct: Value structures are typically the most efficient.