Online Library TheLib.net » The C# Type System : Build Robust, Performant, and Efficient Programs
cover of the book The C# Type System : Build Robust, Performant, and Efficient Programs

Ebook: The C# Type System : Build Robust, Performant, and Efficient Programs

Author: Steve Love

00
02.03.2024
0
0
Harness the power of the C# type system to write programs that are clearer, simpler, and more efficient.

The type system is the foundation upon which all C# programs are built. The C# Type System will show you how todefine and implement value types effectively, and write more performant and robust code. Real-world code examplesand test cases throughout will elevate your programming with C# and show you how best to implement the principlesyou’re learning.

According to the C# Language Specification, “C# is intended to be a simple, modern, general-purpose, object-oriented programming language.” C# may look simple on the surface, but it has hidden depths even in its most fundamental features. The type system is a central element of C# and is the foundation upon which all C# programs are built. This has been true from the earliest versions of C#, and will continue to be relevant as the language evolves. The C# Type System isn’t a gallery of the latest language features, and we won’t delve into every detail of the latest edition, because C# is constantly advancing; instead we’ll focus on the language’s rich support for creating your own types and examine how best to employ the type system to improve your designs and write clearer, simpler, more efficient programs.

Many languages allow users to define their own types, but C# is different in that it makes a clear distinction between classes, which are reference types, and value types. Classes are the default choice for implementing a design in C# and the general-purpose mechanism for custom types, as they support all the object-oriented features that C# has to offer. In contrast, value types are much more specialized, which is why they’re often misunderstood and dismissed as an advanced feature that’s irrelevant for most applications. It’s true that value types aren’t suitable for many custom types in an application, and they may not be necessary in every design, but they have several advantages that are frequently underappreciated.

Among the core aspects of working with the type system, you’ll learn

• How user-defined value types, and even simple types, can enhance your code’s readability
• How reference and value types differ within C#
• How method parameters and arguments relate to reference and value types
• How differences in copy semantics between value and reference types affect a program’s behavior
• How the different methods of value comparisons for equality work behind the scenes
• The unique characteristics and roles of various types in an application, especially how value types go beyond meredata storage
• Why inheritance isn’t optimal for value types
• How to measure and evaluate the performance of an app’s use of different data types

Whether you’re a novice or seasoned programmer, you’ll find The C# Type System indispensable in your efforts to turngood code into great.
Download the book The C# Type System : Build Robust, Performant, and Efficient Programs for free or read online
Read Download

Continue reading on any device:
QR code
Last viewed books
Related books
Comments (0)
reload, if the code cannot be seen