Its a valid initializer. Files and Folders are members of the BackupPlanFilesAndFolders class, thus they are initialized inline.
x.FilesAndFolders = new List<BackupPlanFilesAndFolders>
{
new BackupPlanFilesAndFolders()
{
Files = new List<string>(),
Folders = new List<string>()
}
};
is equivalent to
x.FilesAndFolders = new List<BackupPlanFilesAndFolders>();
x.FilesAndFolders.Add(new BackupPlanFilesAndFolders());
x.FilesAndFolders[0].Files = new List<string>();
x.FilesAndFolders[0].Folders = new List<string>();
The (simplified) class definition:
class BackupPlanFilesAndFolders
{
public List<string> Files;
public List<string> Folders;
}
Maybe the fact that its an inline initializer inside an inline initializer (List<> and the class) but that actually shouldnt make any difference, after all its normal use.