- ASP.NET Core 2 High Performance(Second Edition)
- James Singleton
- 147字
- 2021-07-08 09:38:59
Literals
There are a couple of minor additional capabilities and readability enhancements when specifying literal values in code. You can specify binary literals, which means you don't have to work out how to represent them using a different base anymore. You can also put underscores anywhere within a literal to make it easier to read the number. The underscores are ignored but allow you to separate digits into convention groupings. This is particularly well suited to the new binary literal as it can be very verbose, listing out all those zeros and ones.
Take the following example that uses the new 0b prefix to specify a binary literal that will be rendered as an integer in a string:
Console.WriteLine($"Binary solo! {0b0000001_00000011_000000111_00001111}");
You can do this with other bases too, such as this integer, which is formatted to use a thousands separator:
Console.WriteLine($"Over {9_000:#,0}!"); // Prints "Over 9,000!"
- Learning Microsoft Windows Server 2012 Dynamic Access Control
- Flask Web全棧開發(fā)實(shí)戰(zhàn)
- Node.js Design Patterns
- Kali Linux Web Penetration Testing Cookbook
- Offer來了:Java面試核心知識(shí)點(diǎn)精講(原理篇)
- 軟件測(cè)試工程師面試秘籍
- 網(wǎng)頁設(shè)計(jì)與制作教程(HTML+CSS+JavaScript)(第2版)
- Java軟件開發(fā)基礎(chǔ)
- Python機(jī)器學(xué)習(xí)實(shí)戰(zhàn)
- ADI DSP應(yīng)用技術(shù)集錦
- Mastering Xamarin.Forms(Second Edition)
- Getting Started with Python and Raspberry Pi
- C++ Application Development with Code:Blocks
- 編程改變生活:用Python提升你的能力(進(jìn)階篇·微課視頻版)
- The Applied Data Science Workshop