Chapter 2: Speaking C# [Flashcarder]
What is the primary focus of learning the C# language?
The primary focus is on understanding the grammar and vocabulary used daily to write the source code for applications.
How are programming languages similar to human languages?
Programming languages, like human languages, have their own grammar and vocabulary. However, unlike most human languages, in programming languages, you can create your own words.
What is the significance of creating your own ‘words’ in programming languages, as illustrated by the book?
Creating your own words in programming languages, as illustrated by Dr. Seuss’s creativity, highlights the flexibility and creative potential within programming to invent new concepts and functionalities.
For whom is the book’s section on C# programming language primarily written?
It is primarily written for beginners and covers fundamental topics every developer needs to know.
Up to which version of the C# language does the book cover features?
The book covers features of the C# language from version 1 up to the latest version, 12.
What kind of assistance does the book offer to those familiar with older versions of C# but interested in newer versions?
The book makes it easier for those familiar with older versions to learn about new features in recent versions by listing language versions and their important new features, along with chapter numbers and topics where they are discussed.
How does the book support learning about C# standards over the years?
It discusses various C# versions that Microsoft submitted to standards bodies, providing details on ECMA and ISO/IEC standards for C# versions 1.0, 2.0, 5.0, and 6.0.
Where can the reader find the latest C# standard document and additional resources on C# language design and compiler implementation?
The latest C# standard document and additional resources on C# language design and compiler implementation can be found on Microsoft’s official documentation site and public GitHub repositories as listed in the book.
What is the significance of the .NET SDK version in relation to the default C# language version used?
The .NET SDK version determines the default C# language version available for use, with each SDK version supporting a specific range of C# versions, from older versions up to the most current at the time of the SDK’s release.
What are the versions of C# that have been submitted to standards bodies, and what are their respective ECMA and ISO/IEC standards?
*Optional question
C# 1.0 (ECMA-334:2003, ISO/IEC 23270:2003),
C# 2.0 (ECMA-334:2006, ISO/IEC 23270:2006),
C# 5.0 (ECMA-334:2017, ISO/IEC 23270:2018),
C# 6.0 (ECMA-334:2022, ISO/IEC 23270:2022).
As of the book’s publication, which C# version’s ECMA standard is still a draft, and what is implied about the standardization of future versions?
The ECMA standard for C# 7.3 is still a draft, implying that C# versions 8 through 12 might not yet have ECMA standards.
When did Microsoft make C# open source, and where can the latest C# standard document be found?
Microsoft made C# open source in 2014.
The latest C# standard document can be found at https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/specifications.
What resources are more practically useful than the ECMA standards for learning and contributing to C# and related technologies?
The public GitHub repositories for C# language design (https://github.com/dotnet/csharplang), compiler implementation (https://github.com/dotnet/roslyn), and the standard to describe the language (https://github.com/dotnet/csharpstandard) are more practically useful than the ECMA standards.
How is the .NET language compiler for C# and Visual Basic distributed?
The .NET language compiler for C# and Visual Basic, also known as Roslyn, along with a separate compiler for F#, is distributed as part of the .NET SDK.
What determines the version of C# you can use?
To use a specific version of C#, you must have at least that version of the .NET SDK installed.
Can projects targeting older versions of .NET use modern compiler versions?
Yes, projects targeting older versions of .NET can still use a modern compiler version if you have a minimum required version of the .NET SDK installed.
For example, with the .NET 7 SDK installed, you can use C# 11 language features in a console app that targets .NET Core 3.0.
What is the relationship between .NET SDK versions and C# compiler versions?
Each .NET SDK version comes with a specific range of Roslyn compiler versions, which in turn supports a default C# language version.
How do .NET Standard versions relate to default C# compiler versions?
Similar to the .NET SDK, .NET Standard versions have associated default C# language versions, indicating the level of language features supported for targeting those standards.
How do you determine which version of the .NET SDK is installed on your machine?
Start Windows Terminal or Command Prompt on Windows, or Terminal on macOS, and enter the command: dotnet --version
What does the .NET SDK version 8.0.100 indicate?
It indicates the initial version of the SDK for .NET 8, without any bug fixes or new features added after its initial release.
What is assumed by developer tools like Visual Studio and the dotnet CLI regarding the C# language compiler version?
They assume you want to use the latest major version of a C# language compiler by default.
How can you enable improvements in a specific C# point release, like 7.1, 7.2, or 7.3?
Add a <LangVersion>
configuration element to the project file with the specific version you want to use, for example, <LangVersion>7.3</LangVersion>
.
If Microsoft releases a C# 12.1 compiler, how do you use its new language features?
Add a <LangVersion>
configuration element to your project file with the value 12.1.
What does setting <LangVersion>
to latestmajor do?
It uses the highest major number version of the compiler available, for example, version 12 in November 2023.