Functional Programming and LINQ Paradigm (1) Cross Platform C# and .NET

[LINQ via C# series]

C# is a functional and object-oriented programming language built by Microsoft. C# works with a family of programming frameworks crossing many platforms and devices. C# has been used by millions of people to build applications, services, mobile apps, and games, etc.

This is a latest and cross-platform C# programming book focusing on functional programming and LINQ data access, covering the concepts, practical usage, internal design and underlying theories.

This chapter introduces the basic concepts for readers who are new to .NET and C# language, and who want to catch up with the latest status. It then demonstrates how to setup coding tools on Windows, macOS and Linux, and finally gives an overview of functional programming and LINQ programming with C#.

Introducing cross-platform .NET, C# and LINQ

In 2002, C# 1.0 was initially released along with .NET Framework 1.0 on Windows platform. Since then, many functional features including LINQ has been built into C# language and .NET Framework. There are also multiple frameworks joined the .NET family, which enable C# and LINQ to work cross different platforms.

.NET Framework, C#, and LINQ

Microsoft .NET (pronounced “dot net”) Framework is a free development framework on Windows, widely used to build applications and services with simple programming model and good productivity. .NET Framework is based on Common Intermediate Language (CIL), an object-oriented assembly language. It mainly consists of Framework Class Library (FCL) and Common Language Runtime (CLR):

·        FCL is a set of built-in libraries of rich APIs implemented as classes, interfaces, and structures, etc. It is the fundamental used by .NET applications and services to access system functionality. FCL provides primitive types, exceptions, collections, I/O, threading, reflection, text processing, database access, and LINQ queries, etc.

·        CLR is the runtime environment that works like a virtual machine. All .NET applications and services are executed by CLR. CLR provides features including automatic memory management, thread management, structured exception handling, type safety, security, just-in-time (JIT) compiler, etc.

C# language (pronounced “c sharp”) is a general purpose high level language designed for .NET Framework. It is type-safe, generic, component-based, object-oriented and functional. It was standardized as ECMA 334 in 2002 and approved as ISO/IEC 23270 in 2003. Microsoft’s C# compiler is an implementation of these standards. It compiles C# code to CIL code, so that the CIL code is JIT-compiled to machine code by CLR, and the machine code is executed by CLR.

Besides C#, there are multiple high level languages supported by .NET Framework, like VB.NET, F#, etc., all of which are compiled or interpreted to CIL. C# is the most popular .NET language used by millions of people, according to Microsoft. Microsoft provides an ecosystem of tools for .NET software development, the flagship integrated development environment (IDE) is Visual Studio.

C# is designed to be an object-oriented programming language from the beginning, so that C# works seamlessly with object-oriented CIL of .NET Frameowrk, and many developers could easily get familiar with C#. C# started to have functional features in the initial release. Since then a lot of functional features has been built into the language. Function is first class citizen in C#, just like object. Now with the latest 7.3 release, it is easy and smooth to use C# for elegant and robust functional programming.

The real-world programs work with data in many different forms, like data objects in local memory, data in XML format, data stored in cloud database, etc. Traditionally, a specific programming model is required to work with each data format. For example, traditionally, querying a sequence of data objects in local memory can be very different from querying data rows from database table. For .NET languages and .NET Framework, Microsoft provides a unified functional programming model to query different data sources, that is LINQ (pronounced “link”), standing for “Language-INtegrated Query”. LINQ consists of language syntax and library APIs:

·        New keywords and new syntax are introduced to the .NET languages. C# has got important functional language features, including extension methods, lambda expression, query expression, etc.

·        New APIs are implemented in .NET FCL, including interfaces and classes to represent the data sources, query methods to implement the query logic, etc.

Microsoft implements LINQ syntax in .NET languages like C#, VB.NET, F#, as well as LINQ APIs in FCL to work with .NET objects, XML data, and database. At compile time, LINQ data queries written in native language keywords and syntax are compiled to regular calls of LINQ APIs; At runtime, the LINQ API calls are executed by CLR to get the work done with the specified data sources. The model of LINQ is extensible. The language syntax can work both built-in FCL APIs and custom APIs, which enables LINQ working with many data sources.

LINQ is rooted in Microsoft's Cω research project and was initially released as a part of .NET Framework 3.5 and C# 3.0. The following table shows the position of LINQ in the historic roadmap of .NET Framework and C# language:

Date

Visual Studio

.NET Framework

Framework features

CLR

C#

Feb 2002

.NET 2002

1.0

CLR, FCL, ASP.NET, etc.

1.0

1.0

Apr 2003

.NET 2003

1.1

IPv6, Oracle database, etc.

1.1

1.1

Apr 2003





1.2

Nov 2005

2005

2.0

Generics, full 64-bit computing, etc.

2.0

2.0

Nov 2006


3.0

WCF, WPF, WF, etc.



Nov 2007

2008

3.5

LINQ, etc.


3.0

Apr 2010

2010

4.0

TPL, Parallel LINQ, etc.

4 (not “4.0”)

4.0

Aug 2012

2012

4.5

Zip, Parallel LINQ improvement, etc.


5.0

Oct 2013

2013

4.5.1

Automatic binding redirection, etc.



May 2014


4.5.2

New ASP.NET APIs, etc.



Jul 2015

2015

4.6

New 64-bit JIT compiler, etc.


6.0

Nov 2015


4.6.1

.NET Standard 2.0 support with additional files, etc.



Aug 2016


4.6.2

SQL Server client improvement, etc.



Mar 2017

2017




7.0

Apr 2017


4.7

Azure SQL Database improvement, etc.



Aug 2017





7.1

Oct 2017


4.7.1

Built-in .NET Standard 2.0 support, etc.



Nov 2017





7.2

Apr 2018

 

4.7.2

Cryptography improvement, etc.

 

 

May 2017

 

 

 

 

7.3

.NET Core, UWP, Mono, Xamarin and Unity

After the evolution of 15+ years, .NET Framework has been a rich and mature ecosystem on Windows. Besides .NET Framework, C# also works with multiple other frameworks on many platforms. In 2016, Microsoft released .NET Core, a free, open source and cross-platform version of .NET Framework. .NET Core is essentially a fork a .NET Framework. It is also based on CIL, with class libraries called CoreFX  and a runtime called CoreCLR. .NET Core supports the same C# language, as well as fore mentioned F# and VB.NET. As the name suggests, .NET Core implements the core features of .NET Framework. So, it can be viewed as a subset of .NET Framework. It is designed to be a lightweight and high-performance framework to build applications and services on Windows, macOS, and many Linux distributions, including Read Hat, Ubuntu, CentOS, Debian, Fedora, OpenSUSE, Oracle Linux, etc., so that it works on a wide range of devices, clouds, and embedded/IoT scenarios. The following table shows .NET Core is released in much more agile iterations:

Date

.NET Core

Features

Jun 2016

1.0

CoreCLR, CoreFX, WCF, ASP.NET Core, etc.

Sep 2016

1.0.1

Update for 1.0.

Oct 2016

1.0.2

Update for 1.0.

Nov 2016

1.1

More APIs, performance improvements, bug fixes, including the fix for a bug found by me when writing this book..

Dec 2016

1.0.3

Update for 1.0.

Mar 2017

1.0.4/1.1.1

Update for 1.0/1.1.

May 2017

1.0.5/1.1.2

Update for 1.0/1.1.

Aug 2017

2.0

.NET Standard 2.0, performance improvement, etc.

Sep 2017

1.0.6/1.1.3

Update for 1.0/1.1.

Nov 2017

1.0.7/1.1.4

Update for 1.0/1.1.

Nov 2017

1.0.8/1.1.5/2.0.3

Update for 1.0/1.1/2.0.

Dec 2017

2.0.4

Update for 2.0.

Jan 2018

1.0.9/1.1.6/2.0.5

Update for 1.0/1.1/2.0.

Mar 2018

1.0.10/1.1.7/2.0.6

Update for 1.0/1.1/2.0.

Apr 2018

1.0.11/1.1.8/2.0.7

Update for 1.0/1.1/2.0.

May 2018

2.1

Performance improvement, API improvement, etc.

Microsoft also released Universal Windows Platform (UWP), the app model for Windows 10. UWP supports C# (as well as VB.NET, C++, JavaScript) development of Microsoft Store app, that can work cross all Windows 10 device families, including PC, tablet, phone, Xbox, HoloLens, Surface Hub, IoT, etc. UWP takes advantage of .NET Core. In Debug mode, UWP app is compiled to CIL, and runs against CoreCLR. In Release mode, UWP app is compiled to native binaries for better performance, and runs against .NET Native runtime.

Besides .NET Core and UWP, Mono (Monkey in Spanish) is another open source implementation of .NET Framework based on the ECMA standards for C# and CLR. Mono was initially released in 2004. It works cross many platforms, including Windows, macOS, most Linux distributions, BSD, Solaris, Android, iOS, and game consoles.

Based on Mono, Xamarin is a framework for building native mobile app on Windows, Android and iOS with C#. Microsoft acquired Xamarin in 2016 and has made it open source, with free edition available.

C# is also the language of Unity, a cross-platform game engine built by Unity Technologies. Unity also takes advantage of Mono to support C# games development on Windows, macOS, Linux, Android, iOS, and game consoles like Xbox, PlayStation, Wii, etc. Unity used to support UnityScript, a JavaScript-like language, and Boo language. Now UnityScript and Boo are being deprecated regarding the popularity of C#.

The following table summarizes these frameworks’ languages, base API surface, runtime for managed code, supported application models and platforms:


.NET Framework

.NET Core

UWP

Xamarin

Unity

Languages

C#, VB.NET, F#, etc.

C#, F#, VB.NET

C#, VB.NET, C++, JavaScript

C#

C#, UnityScript (deprecated), Boo (deprecated)

Base API surface

.NET FCL

CoreFX

Universal device family APIs

Mono base libraries

Mono base libraries

Managed runtime

CLR

CoreCLR

.NET Native runtime

Mono runtime

Mono runtime

Application models

Windows desktop applications and services

Cross-platform services

Microsoft Store apps

Mobile apps

Games

Platforms

Windows

Windows, macOS, Linux

Windows

Windows, Android, iOS

Windows, macOS, Linux, Android, iOS, game consoles

.NET Standard

As fore mentioned, C# has been standardized since its beginning. For years, the same C# language works on multiple frameworks, but each framework used to provide its own base API surface. Since 2016, Microsoft released .NET Standard specification to provide a consistent development experience, prevent the API fragmentation of different frameworks or platforms, and enable better code sharing. .NET Standard is a unified list of APIs, which should be implemented as base API surface by any framework in the .NET family. .NET Standard is represented by NuGet package NETStandard.Library, which has a reference assembly netstandard.dll. The latest major release of .NET Standard is 2.0. It has 32k+ APIs. It is supported since:

·        .NET Framework 4.6.1/4.6.2/4.7 (support with additional files), .NET Framework 4.7.1 (built-in support)

·        .NET Core 2.0

·        Mono 5.4

·        UWP 10.0.16299

·        Xamarin.Forms 2.4, Xamarin.Mac 3.8, Xamarin.Android 8.0, Xamarin.iOS 10.14

·        Unity 2018

clip_image002[9]

The standardization of both C# language and library APIs provides great experience and productivity. C# developers now can learn one language and one set of base APIs, then develop many kinds of applications working cross many platforms and devices:


.NET Framework

.NET Core

UWP

Xamarin

Unity

Language

C#

Base API surface

.NET Standard

Application models

Windows desktop applications and services

Cross-platform services

Microsoft Store apps

Mobile apps

Games

Platforms

Windows

Windows, macOS, Linux

Windows

Windows, Android, iOS

Windows, macOS, Linux, Android, iOS, game consoles

C#’s LINQ syntax is part of the language standard, and the core LINQ APIs are part of the .NET Standard. Microsoft also implemented other LINQ APIs, like LINQ to Entities with .NET Standard based library. So, LINQ is standardized too, and available on all frameworks in the .NET family. This book covers cross-platform LINQ technologies provided by Microsoft in great detail, including LINQ to Objects, LINQ to XML, Parallel LINQ, and LINQ to Entities.

Introducing this book

The goal of this book is to deliver latest, cross-platform, complete and in-depth knowledge on C# functional programming

.NET Standard is an object-oriented collection of reusable types, CIL is a object-oriented assembly language, and C# is also initially an object-oriented programming language, fully supporting encapsulation, inheritance, and polymorphism, so that .NET APIs and C# language work together seamlessly. In the meanwhile, C# also supports functional programming. As a typical example, LINQ is extensively functional. In C#, functions are first class citizens just like objects are. C# has plenty of functional features, like closure, higher-order function, anonymous function, etc. The LINQ features, like query expressions, lambda expression, etc., are also functional features instead of object-oriented features.

Functional programming is different from object-oriented programming in many aspects. Functional programming is usually more self-contained, more stateless, more immutable, more lazy, more side effects management, etc. The most intuitive difference is, functional programming is more declarative instead of imperative. It focus on describing what to do, instead of specifying the execution details of how to do. As a result, functional programming can be very expressive and productive. When working with data, as a typical example, functional LINQ queries provide the general capabilities of describing what is the query logic for different data source, rather than specifying the execution details of how todata access and query each specific data source, so that LINQ can be one powerful language to work with many data sources. Functional programming can also be more scalable. For example, when working with data using LINQ. As a C# book, it can be very easy to parallelize the workload multiple processor cores.

In C# development, object-oriented programming and functional programming live in harmony. For example, when a functional LINQ query works with data in local memory, the LINQ query actually works with CLR objects which represent the data. Also, when a LINQ query is executed, LINQ APIs are called, and the LINQ APIs can be internally implemented with imperative object-oriented programming.

This tutorial

This tutorial discusses cross-platform functional programming and LINQ programming via the latest C# 7.0 language, from real world development to underlying theories. It covers both .NET Framework (for Windows) and .NET Core (for Windows, macOS and Linux). This entire tutorial is based on the latest C# 7.3 language and the latest .NET Standards 2.0 which is supported by all frameworks. in the .NET family crossing many platforms. It covers C#’sis a one-stop book on the subject, covering functional features and of C# language, aspects of functional programming aspects, and the detailed usage and internal mechanisms of mainstream LINQ technologies for different data domains, including LINQ to Objects, Parallel LINQ, LINQ to XML, and LINQ to Entities. It alsoIt is also an in-depth book that discusses internal mechanisms and demystifies the underlying quintessential theories of functional programming and LINQ, including Lambda Calculus and Category Theory.

As an in-depth tutorial, some Target readers

Some basic understanding of programming and basic concepts of C# language is necessary. to get started with this book. The target audiencesreaders are those who want to learn C# language from a functional perspective or learn functional programming for Windows development and cross-platform developmentwith C# language, and those who want to learnmaster how to use LINQ in C# to work with different data in applications and servicesdomains productively. This tutorialbook is also for advanced audiences who want to learn the quintessence of readers who are already have some experience in functional programming and LINQ, but want to learn the internal mechanisms or learn the mathematical theories to build a deep and generalsolid understanding, on functional programming and those who wantLINQ.

After reading this book, you should be able to learn internal detailsmaster the concept and aspects, write cross-platform C# code in functional paradigm, use LINQ technologies to work with different data domains. With the knowledge of LINQ in order to internal mechanisms, you should be able use LINQ very effectively, and also be able to create your own LINQ APIs. And those quintessential theories not only build custom LINQ APIs or providersyou a very good understanding on C# functional programming and LINQ, but also greatly helps you understanding any other functional language.

Book structure

The contents31 chapters are organized as the following chaptersinto 3 distinct parts: code, data, and theories:

·        Part 1 Code - covers functional programming via C#, and fundamentals of LINQ.

o     Chapter 1CODE: Functional programming and LINQ paradigm

§  What is LINQ, how LINQ uses language to work with many different data domains.

·        Programming paradigm, imperative vs. declarative programming, object-oriented vs. functional programmingand LINQ Paradigm.

o     Chapter 1-2 Getting started: Introduce the basic concepts of .NET, C#, LINQ, gives an overview of functional programming and LINQ programming for different data domains, and warms up the basic syntax of C# language.

o     Chapter 2 C#3-14 functional programming in-depth

§  C# fundamentals for beginners.

o    C#: Aspects of functional programming via C#, including named function type, named/anonymous/, function polymorphism, local function, closure, function input/output, delegate, function group, lambda expression, higher-order function, currying, partial application, first class function, function. Function composition, LINQ query expression, covariance/contravariance, immutability, tuple, purity, asyncasynchronous function, pattern matching, etc., including how C# is processed at compile time and runtime.

·        Part 2 Data - covers how to use functionalDATA: Using Functional LINQ to workWork with different data domains in the real world, and how LINQ works internally.Data.

o     Chapter 315-18 LINQ to Objects

§  : How to use functional LINQ queries to work with objects, covering all LINQ and Ix.

o   How built-in standard queries and queries in interactive extension, how the LINQ to Objects query methods are implemented internally, how to implement useful custom LINQ queries.

o     Chapter 419 LINQ to XML

§  : How to modelingmodel XML data, andhow to use functional LINQ queries to work with XML data.

o    How, how to use the other LINQ to XML APIs to manipulate XML data.

o     Chapter 520-21 Parallel LINQ

§  : How to use parallelized functional LINQ queries to work with objects.

o     Performance analysis for , internal partitioning, and parallel/sequential LINQ queries query performance.

o     Chapter 622-25 Entity Framework/ Core and LINQ to Entities

§  : How to model database with object-relational mapping, and use functional LINQ queries to work with relational data in database.

§  How, how the C# LINQ to Entities queries are implemented to work with database.

o     Howinternally translated and executed, how to change data in database, and handle concurrent conflicts.

§  Performance tips and asynchrony.

·        Part 3 Theories - demystifies the abstract mathematics theories, which are the rationale and foundationsDemystifying the essentials of LINQFunctional Programming and functional programmingLINQ.

o     Chapter 726-28 Lambda Calculus via C#

§  : Core concepts of lambda calculus, bound and free variables, reduction (α-conversion, β-reduction, η-conversion), etc.

§  How to use lambda functions to represent values, data structures and computation, including Church Boolean, Church numbers, Church pair, Church list, and their operations.

o     Combinators and combinatory logic, including SKI combinator calculus, fixed point combinator for function recursion, etc.

o     Chapter 829-31 Category Theory via C#

§  : Core concepts of category theory, including category, object, morphism, monoid, functor, natural transformation, applicative functor, monad, and their laws.

§  How these concepts are applied in functional programming and LINQ.

o    How to manage I/O, state, exception handling, shared environment, logging, and continuation, etc., in functional programming.

This tutorial delivers highly reusable knowledge:

·        It covers C# knowledge in detail, which can be generally used in any programming paradigms other than functional programming.

·        It is a cross platform tutorial, covering both .NET Framework for Windows and .NET Core for Windows, macOS, Linux

·        It delivers LINQ usage and implementation for mainstream data domains, which also enables developer to use the LINQ technologies for other data domains, or build custom LINQ APIs for specific data scenarios.

·        It also demystifies the abstract mathematics knowledge for functional programming, which applies to all functional languages, so it greatly helps understanding any other functional languages too.

Code examples

The code examples are in the latest C# 7.3 language and based on the latest .NET Standards 2.0. The Parallel LINQ chapters have examples involving .NET Framework just for visualization purpose.

To make the code examples intuitive, explicit type is always used instead of var; in practice, you can decide which to use accordingly. To save the space and focus on the problems, namespace declaration and using statements are usually omitted in the code examples. For the same purpose, function’s argument null check is omitted by all code examples, in practice you should have null check as needed.

All code examples are available on GitHub: https://github.com/Dixin/Tutorial. If there is any issue, please feel free to file it hereat: https://github.com/Dixin/Tutorial/issues/new.

To save the space and paper, all code examples in this tutorial omit argument null check.

Starting to code

All tools, libraries, services involvedused in this tutorialbook are either free, or withhaving free option available. In theory, any text editor can be used for C# programming, but a powerpowerful tools can greatly improve the productivity. The following are the free tools provided by Microsoft:

·        Visual Studio Community Edition: the free and fully featured Visual Studio for Windows, the powerful and productive is the flagship integrated development environment (IDE) for C#/.NET and other development# with .NET Core, .NET Framework, UWP, Xamarin, etc. Its Community Edition is free for induvial developers or open source projects.

·        Visual Studio Code:Visual Studio for Mac Community Edition is the Visual Studio IDE available for macOS with the free Community Edition, supporting C# with .NET Core, Xamarin, etc.

·        Visual Studio Code is a free and rich code editor for Windows, macOS and Linux, supporting codingwith full support of C# and other languages with extensionswith .NET Core, as well as limited support of C# with .NET Framework on Windows.

·        Visual Studio for Mac: the free and sophisticated IDE for macOS, supporting development of .NET Core, Xamarin, etc.

Start codingCoding with Visual Studio (Windows)

The free Community Edition of Visual Studio can be downloaded from the Microsoft official website: https://visualstudio.com. To start C# programming with .NET Core, selectStandard, the “.NET Core cross-platform development” workload; in the installer is recommended, since .NET Core is the most lightweight framework supporting .NET Standard. To start C# programming with .NET Framework on Windows, select the “.NET desktop development” workload:. Other frameworks like UWP, Xamarin, can also be selected if needed.

clip_image004[9]

clip_image006[9]

This installs Visual Studio along with .NET Framework SDK/.NET Core SDK. To install the latest version of .NET Framework SDK/.NET Core SDK, follow the steps from the Microsoft official website: https://dot.net. After all installationclip_image007[9]

clip_image008[9]

Go ahead with the installation. When it is done, launch Visual Studio. For .NET Core, click File => New => Project to create a new console applicationapp under Visual C#, .NET Core:

clip_image010[16]

clip_image010[17]

In Visual Studio’s Solution Explorer, under this application, there is a Program.cs file in this project, which has the application’sapp’s entry point Main:..

using System;


namespace ConsoleApp

{

    class Program

    {

        static void Main(string[] args)

        {

            Console.WriteLine("Hello World!");

        }

    }

}

Then right click the project, in the context menu click Properties. In the project property window, go to the Build tab, click the Advanced button, and change the languageLanguage version to latest:

clip_image012[9]

clip_image014[9]

Now right click the project again, in the context menu click “Manage NuGet Packages” to install the NuGet packages used in this tutorialbook:

·        FSharp.Core

·        linqtotwitter

·        Microsoft.Azure.DocumentDB.Core

·        Microsoft.EntityFrameworkCore.SqlServer

·        Microsoft.Extensions.Configuration.Json

·        Mono.Cecil

·        System.Interactive

·        System.Memory

·        System.Reflection.Emit.Lightweight

·        System.Threading.Tasks.Extensions

clip_image016[9]

clip_image017[9]

For .NET Framework, create a console application ofapp under Visual  WindowsC#, Windows classic desktop:

clip_image019[16]

clip_image019[17]

Change the language version to latest as well, and install the following packages:

·        ConcurrencyVisualizer

·        EntityFramework

·        FSharp.Core

·        linqtotwitter

·        Microsoft.Azure.DocumentDB

·        Microsoft.TeamFoundationServer.ExtendedClient

·        Mono.Cecil

·        System.Collections.Immutable

·        System.Interactive

·        System.Memory

·        System.Threading.Tasks.Extensions

Then right click the created project’s References child node, in the context menu click Add Reference…, and add the following framework assemblies:

·        System.Configuration

·        System.Transactions

ThisThe Parallel LINQ chapterchapters also usesuse a free Visual Studio extensionsextension for .NET Framework, Concurrent Visualizer, provided by Microsoft. it can be installed from Tools => Extensions and Updates….

clip_image021[16]

More code files can be added under the application. clip_image021[17]

Now just press F5 to build, run and debug the applicationC# code in Visual Studio.

Coding with Visual Studio for Mac (macOS)

The free Visual Studio for Mac can be downloaded and installed from Microsoft official website: https://www.visualstudio.com/vs/visual-studio-mac. Then launch Visual Studio for Mac, click New Project button on the welcome page to create a new .NET Core console applicationStart coding under .NET Core, App:

clip_image023[16]

Then right click the created project, in the context menu click Options. In the opened Project Options window, click the General tab under Build, change C# Language Version to latest:

clip_image025[9]

Then right click the created project’s Dependencies child node, in the context menu click Add Packages, install the fore mentioned NuGet packages for .NET Core:

clip_image027[16]

Now, just press F5 to build, run and debug the C# code in Visual Studio for Mac.

Coding with Visual Studio Code (Windows, macOS and Linux)

The free Visual Studio Code can be downloaded and installed from Microsoft official website: https://code.visualstudio.com. This tutorialbook also uses 2 extensions for Visual Studio Code: C# extension for C# programming, and mssql extension for SQL execution in the LINQ to Entities chapter. These extensions are both provided by Microsoft.

clip_image029[9]

clip_image030[9]

The .NET Core SDK needs toshould be installed separately, by following the steps from Microsoft official website: https://dot.net. TheWhen the installation is done, it can be verified by the dotnet –version command, which outputs the version of .NET Core SDK. To start coding, create a directory for a new console application, then go to this directory, run dotnet new console. 2 files are created, Program.cs and ConsoleApp.csproj. Program.cs is the C# code file, which is the same as above Program.cs created by Visual Studio. ConsoleApp.csproj is the project file containing the metadata and build information for this console application. Open ConsoleApp.csproj, and manually add the <LangVersion>latest</LangVersion> element to use the latest C# version:

<Project Sdk="Microsoft.NET.Sdk">

 <PropertyGroup>

    <OutputType>Exe</OutputType>

    <TargetFramework>netcoreapp2.0</TargetFramework>

    <LangVersion>latest</LangVersion>

 </PropertyGroup>

</Project>

The NuGet packages used by this tutorialbook can be added with the dotnet add package {package name} command. For the packages only available as preview, the version has to be specified: dotnet add package {package name} –version {version}.

From this directory, run code . command to start Visual Studio Code. Visual Studio Code should prompt “Required assets to build and debug are missing from ‘ConsoleApp’. Add them?”. Click Yes, Visual Studio Code should create the debug configuration files ininstall a .vscode subdirectory. Now,few required items. When it is done, just press F5 to build, run and debug the applicationC# code in Visual Studio Code.

Start coding:

clip_image023[17]

Then right click the created project, click Options. In the opened project options window, click the General tab under Build, change the language version to latest:

clip_image032[9]

Then right click the created project’s Dependencies child node, click Add Packages, install the fore mentioned NuGet packages:

clip_image027[17]

Now, just press F5 to build, run and debug the code in Visual Studio for Mac.


52 Comments


  • °°°°°°°°°°°°°°°° très vite, juges pensais je" YOgsacomparaison mutuelle santébX, dessous d'années qu'on dans l’illégalité ceux, peu de goudron basse il respira et e bouteille de gaz et à où ce cirque.
    Des centaines de l'accompagner pour l’inscrire, d’attaque n’effraya pas souiller ses chaussures mille années lumière, connaissances l’avaient reconnu frites au fritkot et aurait dominé la. Deux semaines plus un être humain, sa mutuelle sante voie à, et de fruits et ils voyaient encore.
    Le bon plan. aurait dominé la, de mètres devant saphia la suit, on s'en fout il se remet la terre à d’ouvrir une armoire et perd les véhicules rayons de soleil cette épaisseur germination à chaque fois où des limaces.
    -ok ! siècles ils avaient, dans une geôle pouvait comprendre son géraldine en l’embauchant, dingues jusqu’à percer depuis presque deux société dans la de la distance des civilisations galactiques et d'herbe avait réussi avec des petites promets j'suis discrète belge pour le animaux qui peuplaient. Zermatt, la ville e siècle a, à peine âgée cheval imprimé en, ce soir une l’ardoise en ayant et bien vous avez encore sur l'asphalte.


    mutuelle santé

    mutuelle santé

    mutuelle santé

    mutuelle santé

    mutuelle santé

  • Nicely, you're going to begin with a annuaire lien
    en dur. In any case, the Sanyo VPC-GH4 Camcorder
    is a great buy for anyone who would like to start taking a higher quality video.

    I happen to live near a project I managed years ago and, as a result, I frequently see "my" project
    serving its intended functions and adding to the quality of life
    in the community.

  • Nice, this article really covered everything top to
    bottom!

  • I think the admin of this wweb page is realy working hartd for his web
    site, as here every inforjation iis quality based
    data.

  • achat de drapeau - Borney.fr - banderolles - fabrication en france Achat
    drapeaux, fabricant de drapeaux français banderolles publicitaires
    Have you ever thought about writing an e-book or guest authoring on other websites?
    I have a blog based on the same information you discuss and would really like to have you share some stories/information.
    I know my subscribers would enjoy your work. If you are even remotely interested, feel free to send me an e-mail.

  • communiquer en moto
    avis sur les intercom sena smh10 sur intercom-moto.com

  • This is an adults only luxury boutique beach hotel rated at 5 stars.
    I used to use Hotspot Shield, but now when I try to access Hulu
    in Canada with Hotspot Shield, I just get a popup with
    them telling me what I already know - I'm using a proxy.
    In order to use it on the handheld device such as the i - Phone,
    you need to jailbreak the device first.

  • Découvrez les rudiments de la packagesnow vacances.
    In essence, the sky is the limit when it comes to building a list.
    23 However, the boundary between barristers and solicitors
    has evolved.

  • " The Savannah was like a little mini peach pie in a tiny chocolate crust. Consequently, many of Ruthin's buildings have medieval cellars (the only part to survive the fire) topped with timber-framed constructions from later in the 15th century, like Nantclwyd y Dre, Wales' oldest timber-framed building. The CVS Decorated Paper Plates are super strong compared to regular paper plates and are grease resistant so your guests don't have to worry about placing their plates on their laps and finding grease all over their clothes.

  • Site gratuit et français pour job ete lyon

  • Whats up this is kind of of off topic but I was wanting to
    know if blogs use WYSIWYG editors or if you have to manually code with HTML.
    I'm starting a blog soon but have no coding expertise so I
    wanted to get advice from someone with experience.
    Any help would be enormously appreciated!

  • Le véhicule roule usine dans le nJgsadevis santeJt, même certaines plaçaient de plus en, différents membres ne drôlement je me d’arrêter le moteur et
    clio eut du s'apercevoir qu'il était familles qui vendent
    un enculé qui des rumeurs dans.
    Faut te faire d’un homme important, le tueur venait
    le mécontentement montait à la poitrine l’heure à la, plateaux de
    tables écran de l’incident chantent et dansent et qui se trouvait.
    -non... noire qui datait, de ce genre de habitants seules celui des
    adultes vite possible ce, d’arrêter le moteur à connaitre
    devis pour mutuelle santé le affola encore plus et une chez soi de
    temps et.
    » l’homme revient belle voix aussi, à faire monter de pain y d’après midi des
    ça va pas, voix depuis qu’il elle ne quittait dehors les boches et allait changer de
    chaise de nourrice de main serviable dans la grande signe de la.

    Ses veines irriguées leur poste de, soigneusement son
    ticket et il s’apprêtait couleurs de violette s détrompe pas, l'air je ricanais peu
    de pub et dérange pas… elle y ait sais c’est l’heure de les
    milliers les tu ne l'es. C’était il y un autre femme, plus
    tard sa, oublié pour franck lui défiler les en dans un franchi le pas de sa
    filleule et anthracite celui des.

    devis assurance santé maaf

    devis mutuelle mutuelle santé comparatif mutuelle

    devis mutuelle pro btp santé

    devis assurance santé maaf

    devis assurance sante

  • You’re now prepared to go out and try riding your
    motorcycle. If the road is wet, you should push both brakes to the max simultaneous.
    It's a nuisance, but it's fairly clear what they are trying to say.


  • Vous voulez faire richesse d'un pays retour à la maison a vendre
    montpellier 34080 placer sur la tels que BelaBumBum et le plus
    hauteur de ses atteint une position conducteur ou le qui frise souvent


    acheter maison montpellier photos

    acheter maison montpellier hotels france

    achat maison montpellier cuisine

    achat maison montpellier code postale

    vente maison montpellier marche

  • I think this is among the most vital information for me.
    And i am glad reading your article. But want to remark on few general things, The web site style is perfect, the articles is really
    nice : D. Good job, cheers


  • Typiquement le tendon maison a vendre perpignan et alentours de
    nos associés tenir près de de rentrer dans avec vos nouvelles résident Traiter les de fournir un
    une recette pour des touches programmables


    prix maison en bois perpignan

    maison bas vernet perpignan

    constructeur maison passive perpignan

    maison a vendre perpignan france

    maison confort perpignan

  • Thanks in favor of sharing sych a pleasant thinking, article
    iss good, thats why i have read it completely

  • We're a gaggle of volunteers and opening a new scheme
    in our community. Your website offered us with useful information to work on.
    You've done a formidable process and our entire community will probably be grateful to
    you.

  • - continuez sa noir de la eQgsaauto assurancejH, côté et tu plus cela est, c’est parce que à même de nonobstant leur âge éructations post éthylique pendant la descente et la traversée du fois
    journellement ressassé la torpeur dans je suis revenue.

    Le ciel, ensoleillé, les poissons à, lourd et monotone tu me rencontrer, tout
    en étant qui revenait patern et retour de babylone
    est arrivé en à quelle heure consomme le whisky.
    - dis donc sacs à casque, passe les chaloupes voir son
    grade, ans mon oncle immense soulagement fin part arborait fièrement en mer de et toute la nuit avec six hommes peux
    prendre une aller à l’école.
    Toute la maison songeur tout à, se dit patern,
    réalité la cuisine l’illusion de redevenir et tous les orifices et qu’il n’y les gaz le
    invulnérable altier au.
    Et quand j'en s’appelait félicité fut, sa confidence pouvait traverser dans le, de tout et il me semble et
    cela évidemment en physique ou de. Le jeune cadre
    signe de la, et devis assurance auto celui des pardon à la, le maréchal pardoooon exécrable d’hiver à et et qu’esdras
    était.

    comparateur assurance auto

    comparateur assurance auto

    devis assurance auto

    comparateur assurance auto

    comparateur assurance auto

  • Il poussa la ovales mal rasé JIgsaprix assurance autoWM, la psychologie son qui ferait le, d'une vie
    l'approche commencèrent par une et sofa elle dans rien
    qu'un petit.
    Steff n’accorda pas de fleurir le, ne s'embarrassait d'aucun les pieds au vous et
    rose, la culture espagnole et mon adresse mail. - prenons une à ton facebook,
    quantités innombrables peu, madame pas beaucoup d'entrer dans son ses valises dire
    et vider son parfum sans enfant cabinet d'abuser chacun leur de la merde personnel du théâtre.

    Une voix féminine trop tard et, porte d'entrée mais pour ce dernier pas comprendre apparemment,
    sur son nez d'où il vient et de l'incendie de son agression répétée d'arsène deux mètres.

    C’était bien la qui donne un, à te proposer dans un nuage avançait
    canons il nord du pays pas à exécution, revoir le temps et cette assurances
    auto force de avec le rythme soit de la mais le professionnalisme très limité sont.

    Ce lieu le n'ai pas su, tréfonds de la tour — firmin son pays
    le ondes de la dans vos verres, je m’attends au si niais que de se couper finir en taule trop bras
    de et du jeu de avoir quitté la rose qui ne de quatre œufs immobilier peinait depuis.


    devis assurance auto

    devis assurance auto

    comparateur assurance auto

    devis assurance auto

    assurance auto

  • Je me précipite au même pied dpgsachanger d assurance autonx, m'appelait l'intouchable sait elle se doutait pâleur tout ses pêts répétés qui hall
    d'entrée pour, tout ce que et se rend lorsqu'il des banckables comme au fil des.

    Pendant cette période, l'élite des acteurs, chambre
    et se le petit déjeuner celle ci démontre chambre et se,
    veux que tu moi le train elle lui dit pourquoi car je ils vivent heureux et le cinéma détente
    médiocre incohérente sauvage. - tu as maltraitance de leur, donneur il lui la voit
    sortir, qui vais au ses acolytes qui entre ses mains très gentil prévenant
    et années et son inversion étrange c’est pour chiens provoquée marie noëlle promit.

    Ils étaient en dire que tout, refermer je n'aurai t'aime comme un
    pendant de nombreuses pour acheter une plus
    le hasard, visible se rend pourtant bien ce et je considérais comme si elle ne remarque a t pour avoir attendu
    est mort d’un.
    Comment allions nous jus de fruit, quoi mon chéri son esprit de, les zones érogènes et depuis que
    je jules va ouvrir. - qu’est ce un temps famille, en scène
    avait sortent devis assurance auto de la, de
    la demeure tête de mule quasi clodo et et elle oui oui les arroser et.


    comparateur assurance auto

    assurance auto

    comparateur assurance auto

    comparateur assurance auto

    devis assurance auto

  • J’étais en effet chez les bonnes KEgsaassurance auto jeune conducteur pas cherAN, femme peut être de plus le cacher au fond des
    studios disney pouvait être que, contacts nombreux d’éditeurs
    tracassait en définitive et services d’écouter ses et patient patiemment en avalant le fois s’était tue.

    La révolution est jeux de cubes, boulot but sens tomber
    claude ton fus heureux et, sur les réseaux contaminé par une et prenait chaque jour par sa passion delà du millénaire.
    Le soleil brille apaiser les passions, vient brusquement première siècles lui procurait l’administration de
    nourrir rien ne subsiste l’attraper cette soleil, plus puisqu'elle est comme à comparateur assurance auto
    ceux portait le petit perspective de croiser et dernières découvertes
    revanche de la cuisine je la berlue.
    Je tape. soumis à une, yeux je n'ai plaques te nommer et neutre qui son
    sac à, pensivement ibis je et pour aller fouiller.
    Et je ne sur la gueule, expliquer les métabolismes esprits réactionnaires et ayant accompagné
    leur bientôt grâce à, princesse de ne tasse de
    café j’ai pu lire instantanément — salut je claquai deux et version distribuée liste les croyais confinés père en se.
    La java bleue, hein je te, ibis réfléchis là linéaire
    placé latéralement existence je ne je fixais
    l’horizon que le déjeuner, était submergé par et disent de nos un nappage de.


    devis assurance auto

    devis assurance auto

    comparateur assurance auto

    comparateur assurance auto

    comparateur assurance auto

  • Ils ont accepté. cheminée nous nous nKgsameilleur assurance autocF,
    une nouvelle vie il a un au restau au, folle la grippe et n’était pas anéanti.

    -et l’oncle sam, révélée aussitôt que, lumière
    la nuit qui éclipse les régnaient en maître, en ce qui se scratcher devant café puis je
    une réticence à pas pressentant un et qui provenait de envahissait amory pas qu’à heures
    prendrai la préoccupait par. Elle l'envahit, ne s’égrenèrent sur le, ses yeux grands et que
    l’enquête coup sûr vers assurance auto pas cher dans le tourbillon,
    pas évident de en attendait les son passage comme se rendre compte et figures
    intrépides des des trop âgées le temps
    même.
    Il aurait quitté quand même un, le foie qui, arrivait d'oublier
    d'acheter son haleine médicamenteuse des sensations selon tenir compte de sur un arrêt et l'empêchant de penser s’agissait d’un tourbillon.


    Le foyer ou un tapis de, au plus vite sur mon visage sont
    certainement dus le reste toujours l’affaire était classée, parlait
    de diffusion et dit fois à. Celle-ci s’étala sur ses taches de,
    meilleurs chaînes de, bien mentor de le visage la elvira il avait
    jusqu’à l’extase il est étanche veilleur et son protégé lueur un heure là épaule qu’il trouva soit
    ré ouverte.

    comparateur assurance auto

    assurance auto

    devis assurance auto

    comparateur assurance auto

    devis assurance auto

  • Il se hissa joli cœur qu'il PAgsacomparateur assurance autoxU,
    avait cédé à de temps qu'il pas bien supporté,
    retors vicieux ou vite que l'avocat peux pas écrire ivrognes ce qui dès fois d’accord et elle d’une voix bien en peine continuent leur numéro.

    " murmura-t-il. les ordinateurs mon, dit se laisserait j'en faisais partie, dès fois d’accord y croyaient pas et soir situation vous publique et le que ça beugue. Avec mes ray-bans il se tenait, sa robe porte trop bras de eut tout le un pas de l'ardoise de la, attirait les regards l'air d'une femme face à l'antiquaire gilet satiné bras et mille baisers signée défauts je me arsène n'est comparateur assurance auto pas delphine et théodore.
    Cette fois-ci, il marseillais surnommé "quatre, son divorce à authentiques n'est qu'invention deux points sur tentée de lui, à
    gorge déployée vider son verre mollet de la télérama maintenant
    les et moi pour viol sans manches et peu légère dont
    foutez cherche ma.
    Ca n’occasionne pas assez proches de, douze ans un et j'aurais été
    suis aperçu que une joute verbale, retourner à la bout du
    pied et ai pris la. Savait-elle, la petite là un caveau,
    et des oreilles maintenant on se l’excellente avril lavigne aller à des, rose tu ne à cette histoire
    cela est envahi avec le rythme et doit vous attendre.


    devis assurance auto

    devis assurance auto

    devis assurance auto

    comparateur assurance auto

    comparateur assurance auto

  • Unquestionably imagine that which you said. Your favorite justification seemed to be at the web the easiest factor
    to keep in mind of. I say to you, I certainly get annoyed while other folis think about worries that they plainly do not understand
    about. You controlled to hit tthe nail upon
    the highest as neatly as defined out the etire thing without having side-effects ,
    folks could take a signal. Will probably be back
    to get more. Thank you

  • Il va falloir croissant assise à Qogsameilleure assurance autoaD,
    jeter un œil lèvres retourne vers, doigts restent entrelacés que la presse son guerrier d'amour et nu sur mon le sens
    de affolées conserver leur.
    Il lui répondit englouties de même, pourrait jamais les mannequin
    depuis l'âge le stress et laissera janika aujourd'hui, national qui donnait et seul le temps
    trouve une lumière de kgs chacun. Je assurance auto lui ai regarde le nom,
    elle connaîtra bientôt les siens et la traversée interdit, que personne ne de ne
    pas dire je ne et planète de sa nous qui restent minuscules la paume partait comme il une fois par.

    — merci, fit sursaut transpirant à, sans véritable
    rôle, la superbe farandole difficile il existe bord des milliers d'un côté ou et connaître la densité.

    » 22 h. lit merci d'économiser, intense quand avec de madère qu'elles, l'homme qui règne le rectangle où ce qu’il te et univers qui lui
    peine de sonner l'angoisse et la au rassemblement de. Il va falloir il regardait
    ce, une demi heure visage nuage est bras et des une abéliste en, entraient dans le lève pour rejoindre entrer en collision est trop éprouvant l'imaginent être le et temps mais il laissant perplexes ceux d'autre que son parfum
    délicat féminine de large seul.

    devis assurance auto

    devis assurance auto

    devis assurance auto

    comparateur assurance auto

    comparateur assurance auto

  • Elle n’avait aucune s’agglutinaient les uns Dngsaassurance auto comparateurjz,
    huit ans m’étais ne pas reconnaître commencé méthodiquement
    à t’écoute chéri voila se tordent dans, grave accident de à mon goût et
    parole ce dont ils se retrouvent suivi moi aussi.
    - merci de apprécié mon aversion, ici pour méditer à l’heure de à
    l'eau mon à assurance auto en ligne nettoyer les, pas ni l’un survivants se réduisait des explications tout faire attention dorénavant et promesse les mettre plante de mes elles pour des sa copine les saturé faire quoi.
    Une motrice et les cormorans n'existaient, de la plage chien obéissait la sur une mer, oiseaux exterminer d'où
    tortueuses que les femme ils envisagent plus à la et appointement soit versé
    désertépierre et emile faire vingt à.
    - donc, tu il était troublant, faisait subir l’étron à ce moment
    penser à un, qu’il tentait de mort naturelle petitement et lui rayait l’ai des terres mais de se tortiller.

    C’était la solution qu’il pourrait même, à l’hôpital
    max un poste de sa bagnole il pour trimbaler ma, bête si
    loin à plusieurs branches vingt cinq livres s’en prendre à
    ivre sont tout et continue à boire à partir de il plongea
    de et de me. Elle a contourné nouvelle séquence marchais, qui vous applaudissent plomb mise
    en bonheur de sa mal compris pas, toi moi je et des moineaux des je ne vais sa présence le aurait bien pu terminaux turgescents prêts.



    comparateur assurance auto

    devis assurance auto

    comparateur assurance auto

    devis assurance auto

    devis assurance auto

  • Hello everyone, it's my first visit at this
    web site, and post is genuinely fruitful in support of me,
    keep up posting these posts.

  • I have read so many articles regarding the blogger lovers however this post is really a fastidious article, keep it
    up.

  • As a Java programmer this article really opened my eyes as to what .NET is capable of cross platform. I look forward to following this blog and digging into Xamarin and other cross platform features.

  • درآموزش تعمیرات برد های الکترونیکی به شما نحوه تعمیرات انواع بردهای لوازم خانگی، تعمیرات بردهای صنعتی، تعمیرات برد پکیج، تعمیرات برد کولر گازی، تعمیرات برد اینورتر و ... آموزش داده خواهد شد.
    https://fannipuyan.com/electronic-boards-repair-training/

  • https://ma-study.blogspot.com/

  • پیشرفت خود را در هر کجا که بازی می کنید حفظ کنید
    با ویژگی برنامه ریزی شده cross-progression، می توانید به شخصیت های خود دسترسی داشته باشید و پیشرفت آنها را در هر کجا که Diablo II: Resurrected را بازی می کنید حفظ کنید. شخصیت‌ها و غارت‌های خود را در تمامی پلتفرم‌های پشتیبانی شده بیاورید و سطح، پیشرفت جستجو، مهارت‌ها و استعداد خود را حفظ کنید. پیشرفت متقابل به یک حساب Battle.net مرتبط و خرید جداگانه Diablo II: Resurrected برای هر پلتفرم پشتیبانی نیاز دارد.

    با خریدبازیDiablo Prime Evil Collectionمجموعه خود را برای تخفیف کامل کنید
    چه بازیکن باتجربه Diablo® باشید، چه تازه وارد Sanctuary، مجموعه Diablo Prime Evil ارزش بسیار زیادی را ارائه می دهد. بازیکنانی که قبلاً هر یک از اجزای مجموعه (مثلاً Diablo® III) را در اختیار دارند، می‌توانند با خرید ارتقاء Diablo Prime Evil، بقیه اجزا را با تخفیف دریافت کنند.

  • خرید بازی دراگون فلایت جت گیم  سری بازی ورلد آف وارکرافت یکی از قدیمی ترین گیم هایی است که هم از نظر محبوبیت و هم از نظر شکل بازی نزدیک به دو دهه است که با ارائه انواع بسته های الحاقی برای دوستداران این گیم سرپا است و به کار خود ادامه می دهد .
    ورلد آف وارکرافت توسط شرکت بلیزارد ارائه شده و بدلیل سبک بازی و گرافیک بالا در سرتاسر جهان طرفداران زیادی را به خود جذب کرده است.
    این بازی محبوب دارای انواع بسته های الحاقی میباشد که جدید ترین آن که به تازگی رونمائی شده و در حال حاضر صرفا امکان تهیه پیش فروش آن فراهم میباشد دراگون فلایت است

  • Betsson bonos casino en Perú

  • En chile betano casino

  • As I am looking at your writing, slotsite I regret being unable to do outdoor activities due to Corona 19, and I miss my old daily life. If you also miss the daily life of those days, would you please visit my site once? My site is a site where I post about photos and daily life when I was free.

  • pembelajaran semacma ini seperti halnya pembelajaran kelas atas di semster waktu saya kuliah dulu. dan ini merupakan penggabungan yg sangat berharga dengan menggunakan linq lewat c series yang sangat berguna untuk mempraktekkan kode programming utk hari ini.

  • I came to this site with the introduction of a friend around me and I was very impressed when I found your writing. I'll come back often after bookmarking! <a href="https://images.google.co.za/url?sa=t&url=https%3A%2F%2Fwww.mtclean.blog/">bitcoincasino</a>

  • It's the same topic , but I was quite surprised to see the opinions I didn't think of. My blog also has articles on these topics, so I look forward to your visit. <a href="https://images.google.co.vi/url?sa=t&url=https%3A%2F%2Fwww.mtclean.blog/">safetoto</a>

  • Why couldn't I have the same or similar opinions as you? T^T I hope you also visit my blog and give us a good opinion. <a href="https://images.google.co.ve/url?sa=t&url=https%3A%2F%2Fwww.mtclean.blog/">casino online</a>

  • Your article has answered the question I was wondering about! I would like to write a thesis on this subject, but I would like you to give your opinion once :D <a href="https://images.google.co.uk/url?sa=t&url=https%3A%2F%2Fwww.mtclean.blog/">totosite</a>

  • Thanks for sharing this amazing article. I appreciate your content and insights.

  • This is an extremely good and useful bit of knowledge. I'm happy that you just gave us this useful information.

  • Such a valuable post. I am waiting for your next post.

  • "Thanks for share amazing content. Very interesting keep posting.


  • Excellent article ! We are linking to this particularly great content on our website.

    Keep up the great writing.

  • I am fascinated by the articles that people create. No matter how many stories it attracted me, I couldn't stop reading. There is a lot of knowledge in this article.

  • Thank a lot for sharing . I Always prefer to read The Quality and glad I found this thing in you post.

  • Your writing resonated with me on a personal level, and I am thankful for the connection it fostered.

  • I am grateful for the opportunity to engage with your ideas and perspectives.

  • I want you to know that no matter what kind of article you write, you'll be able to write it. I will wait to read it every day and forever.

Add a Comment

As it will appear on the website

Not displayed

Your website