Structs

Define and use structs to create lightweight, stack-allocated value types that encapsulate data and behavior.

Along with classes, structs let us create custom types in C#. Many primitive types, including int, double, and bool, are structs.

Let’s define a struct that represents a point in a two-dimensional space: