Creating value types with enumerations and structures

After completing this chapter, you will be able to:

  • Declare an enumeration type.

  • Create and use an enumeration type.

  • Declare a structure type.

  • Create and use a structure type.

  • Explain the differences in behavior between a structure and a class.

Chapter 8, “Understanding values and references,” covers the two fundamental types that exist in Microsoft Visual C#: value types and reference types. Recall that a value type variable holds its value directly on the stack, whereas a reference type variable holds a reference to an object on the heap. Chapter 7, “Creating and managing classes and objects,” demonstrates how to create your own reference types by defining classes. In this chapter, ...

Get Microsoft Visual C# Step by Step, Ninth Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.