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

Literal improvements


When it comes to literals, we can think about the declaration of various variables constant, which are sometimes the life of a method as these would be very important for a method or to take any decision. And it leads to wrong decisions with the misreading of a numeric constant. To overcome this confusion, C# 7.0 introduced two new features, binary literals and digit separators.

Binary literals

Binary digits are very important for performing complex operations. A constant of a binary digit can be declared as 0b<binaryvalue>, where 0b tells us that this is a binary literal and binary values is the value of your decimal digit. Here are a few examples:

//Binary literals
public const int Nineteen = 0b00010011; 
public const int Ten = 0b00001010; 
public const int Four = 0b0100; 
public const int Eight = 0b1000; 

Digit separator

With the introduction of digit separators, we can easily read long numeric, binary digits. Digit separators can be used with both numeric and binary...