Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn C# in 7 days

You're reading from   Learn C# in 7 days Get up and running with C# 7 with async main, tuples, pattern matching, LINQ, regex, indexers, and more

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781787287044
Length 306 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Gaurav Aroraa Gaurav Aroraa
Author Profile Icon Gaurav Aroraa
Gaurav Aroraa
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Day 01 - Overview of the .NET Framework FREE CHAPTER 2. Day 02 - Getting Started with C# 3. Day 03 - What's New in C# 4. Day 04 - Discussing C# Class Members 5. Day 05 - Overview of Reflection and Collections 6. Day 06 - Deep Dive with Advanced Concepts 7. Day 07 - Understanding Object-Oriented Programming with C# 8. Day 08 - Test Your Skills – Build a Real-World Application

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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime