I have a question about this "shortcut" found in the ASP.NET 5 template:
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
{
var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath)
.AddJsonFile("config.json")
.AddJsonFile($"config.{env.EnvironmentName}.json", optional: true);
The last two lines are only method calls, obviously of a builder. I think this is 100% the same:
var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath);
builder.AddJsonFile("config.json");
builder.AddJsonFile($"config.{env.EnvironmentName}.json", optional: true);
What do you call this syntax where the object name is omitted? Is it only possible when calling NEW/ctor? Can someone point me to that part of C# language definition?
I've googled this, but cannot find the answer.
Edit: this question obviously is very similar to other method-chaining questions, if you already know the term, but my question wasn't meant to implement that, only to use it correctly and get the correct documentation of it. may be this question is nice for being googled, as I used well known source code from VS templates.