I was going through a tutorial on ASP.NET Core 2.0 and made a fresh web app by using the following command: dotnet new web -o mywebapp
. It created a directory containing a Startup.cs
file containing the following code:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace mywebapp
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
}
I am having difficulty in understanding the syntax of the following lines:
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
Although I am aware of lambda expressions in C#, but I have never seen this kind of usage of them. Can anybody explain what those lines mean? Thanks!