I'm trying to understand the following code:
flow = new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer
{
DataStore = new FileDataStore("Tasks.ASP.NET.Sample.Store"),
ClientSecretsStream = stream,
Scopes = new[] { TasksService.Scope.TasksReadonly }
});
From my understanding, the code between the first and last {...} is the body of an anonymous function. The new FileDataStore creates a new instance of FileDataStore. What I don't understand is what the comma at the end of it means. The two lines following it also have commas at the end. What kind of construct is this called in C#? I'm not familiar with it.
No, it isn't the body of an anonymous function. It is an initialization list.. and it serves to set the fields of the new object of type
GoogleAuthorizationCodeFlow.Initializer
all in-line.It is the "in-line" version of this:
The two are equivalent functionally. It is just more compact.