Illustrated C#2012 by Daniel Solis

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

C H A P T E R  10

Structs

What Are Structs?

Structs are programmer-defined data types, very similar to classes. They have data members and function members. Although structs are similar to classes, there are a number of important differences. The most important ones are the following:

  • Classes are reference types, and structs are value types.
  • Structs are implicitly sealed, which means they cannot be derived from.

The syntax for declaring a struct is similar to that of declaring a class:

    

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required