Chapter 8. Understanding Values and References

After completing this chapter, you will be able to

  • Explain the differences between a value type and a reference type.

  • Modify the way in which arguments are passed as method parameters by using the ref and out keywords.

  • Convert a value into a reference by using boxing.

  • Convert a reference back to a value by using unboxing and casting.

In Chapter 7, you learned how to declare your own classes and how to create objects by using the new keyword. You also saw how to initialize an object by using a constructor. In this chapter, you will learn about how the characteristics of the primitive types—such as int, double, and char—differ from the characteristics of class types.

Copying Value Type Variables and Classes ...

Get Microsoft® Visual C#® 2012 Step by Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.