7.8. Summary

Data types form a fundamental building block of a programming language. Whereas Java provides only a handful of data types (classes, interfaces, and primitives), C# has a rich set of value types and reference types. Both should be used in C# programming. You are encouraged not to try to model everything as a class and thereby miss out on some of the optimizations, such as structs, that are built into C# data types. The following key conclusions can be drawn from this chapter:

  • C# data types can be value types, reference types, or pointer types. Value types can be struct or enum. A struct can be user-defined or built-in. Both structs and enums are lightweight constructs that do not have an equivalent in Java.

  • C# built-in value types ...

Get .NET for Java Developers: Migrating to C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.