Creating and Using Types in C#

Types are the building blocks of a C# program. Even while writing a basic C# program, we must use the right types while creating our program. In Chapter 2Understanding Classes, Structures, and Interfaces, we learned the basics of types in a C# program. We learned about the value and reference type variables that are present in a C# program.

 

In addition to awareness of the different types, we should also understand that it's quite important for us to use each type in the best possible circumstance or situation. We also should be aware of the best practices regarding the creation and usage of these types. We will be going through this in this chapter. 

We will walk through the following topics in this chapter:

  • Creating types
  • Consuming types
  • How to use properties to enforce encapsulation
  • Using of optional and named parameters
  • Creating indexed properties
  • Different operations related to string manipulation in C#

We will have an overview of reflection and try to understand how it can help us find, execute, and create types at runtime. In Chapter 10, Find, Execute, and Create Types at Runtime Using Reflection, we will do a deep dive into reflection.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.37.10