Book Image

Learn C# in 7 days

By : Gaurav Aroraa
1 (1)
Book Image

Learn C# in 7 days

1 (1)
By: Gaurav Aroraa

Overview of this book

This book takes a unique approach to teach C# to absolute beginners. You’ll learn the basics of the language in seven days. It takes a practical approach to explain the important concepts that build the foundation of the C# programming language. The book begins by teaching you the basic fundamentals using real-world practical examples and gets you acquainted with C# programming. We cover some important features and nuances of the language in a hands-on way, helping you grasp the concepts in a fluid manner. Later, you’ll explore the concepts of Object-Oriented Programming (OOP) through a real-world example. Then we dive into advanced-level concepts such as generics and collections, and you’ll get acquainted with objects and LINQ. Towards the end, you’ll build an application that covers all the concepts explained in the book. By the end of this book, you will have next-level skills and a good knowledge of the fundamentals of C#.
Table of Contents (15 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

An overview of type conversion


Type conversion means converting one type into another type. Alternatively, we call it as casting or type casting. Type conversion is broadly divided into the following categories.

Implicit conversion

Implicit conversion is the conversion that is performed by the C# compiler internally to match the the type of variable by assignment of values to that variable. This action happens implicitly, and there's no need to write any extra code to obey the type-safe mechanism. In implicit conversions, only smaller to larger types and derived classes to base class is possible.

Explicit conversion

Explicit conversion is the conversion that is performed by the user explicitly with the use of the cast operator; that's why this is also known as type casting. Explicit conversion is also possible using built-in type conversion methods. For more information, refer to https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/explicit-numeric-conversions-table.

Let...