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 from the constructor. 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 when an object name is omitted? Is this only possible when calling NEW / ctor? Can someone point me to this part of the C # language definition?
I searched for this but cannot find the answer.
Edit: This question is obviously very similar to other method chain questions , if you already know this term, but my question is not intended to be implemented, only to use it correctly and get the right documentation for it. maybe this question is good for googled since I used well-known source code from VS templates.