23k words 21 mins.

# Chapter 15 Enumerated Types and Bit Flags # Enumerated Types An enumerated type is a type that defines a set of symbolic name and value pairs. For example, the Color type shown here defines a set of symbols, with each symbol identifying a single color. internal enum Color { White, //...
38k words 34 mins.

# Chapter 13 Interfaces # Class and Interface Inheritance In the Microsoft .NET Framework, there is a class called System.Object that defines four public instance methods: ToString , Equals , GetHashCode , and GetType . This class is the root or ultimate base class of all other classes—all classes...
60k words 54 mins.

# Chapter 12 Generics Developers who are familiar with object-oriented programming know the benefits it offers. One of the big benefits that make developers extremely productive is code reuse, which is the ability to derive a class that inherits all of the capabilities of a base class. The derived...
29k words 26 mins.

# Chapter 11 Events In this chapter, I’ll talk about the last kind of member a type can define: events. A type that defines an event member allows the type (or instances of the type) to notify other objects that something special has happened. For example, the Button class offers an event called...
45k words 41 mins.

# Chapter 10 Properties # Parameterless Properties Many types define state information that can be retrieved or altered. Frequently, this state information is implemented as field members of the type. For example, here’s a type definition that contains two fields. public sealed class Employee...
33k words 30 mins.

# Chapter 9 Parameters # Optional and Named Parameters When designing a method’s parameters, you can assign default values to some of or all the parameters. Then, code that calls these methods can optionally not specify some of the arguments, thereby accepting the default values. In addition, when...
54k words 49 mins.

# Chapter 8 Methods # Instance Constructors and Classes (Reference Types) Constructors are special methods that allow an instance of a type to be initialized to a good state. Constructor methods are always called .ctor (for constructor) in a method definition metadata table. When creating an...
8.3k words 8 mins.

# Chapter 7 Constants and Fields # Constants A constant is a symbol that has a never-changing value. When defining a constant symbol, its value must be determinable at compile time. The compiler then saves the constant’s value in the assembly’s metadata. This means that you can define a constant...