■
Source Code
The FunWithEnums project is located under the Chapter 4 subdirectory.
Understanding the Structure Type
Now that you understand the role of enumeration types, let’s examine the use of .NET structures (or
simply
structs). Structure types are well suited for modeling mathematical, geometrical, and other
“atomic” entities in your application. A structure (like an enumeration) is a user-defined type; how-
ever, structures are not simply a collection of name/value pairs. Rather, structures are types that can
contain any number of data fields and members that operate on these fields.
Furthermore, structures can define constructors, can implement interfaces, and can contain
any number of properties, methods, events, and overloaded operators. (If some of these terms are
unfamiliar at this point, don’t fret. All of these topics are fully examined in chapters to come.)
Do'stlaringiz bilan baham: |