O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18. STRUCTS

You will learn about the following in this chapter:

According to Chapter 6, “Types, Part I: The Simple Types,” C#'s types can be divided into reference types (such as string, Elevator, and Car) and value types (such as short, int and the other simple types). Until now, we have designed our own reference types with the class keyword to form classes. In a similar way, we can define our own value types by using the struct keyword to form structs as discussed in this chapter.

Classes are useful to represent most of the objects in a typical C# program. However, structs represent a lightweight alternative ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required