What am I missing here? I expected the following to work just fine:
public class ProposalFileInfo
{
public int FileId { get; set; }
public bool IsSupportDocument { get; set; }
}
// ...
var attachments = new List<ProposalFileInfo>();
attachments.Add(new ProposalFileInfo { 1, false });
attachments.Add(new ProposalFileInfo { 2, false });
attachments.Add(new ProposalFileInfo { 3, false });
Instead I get an error at the {
character on each of the last three lines:
Cannot initialize type 'xxx.yyy.ProposalFileInfo' with a collection initializer because it does not implement 'System.Collections.IEnumerable'
Am I not using an Object initializer? Why does it assume a collection initializer? (I'm using Visual Studio 2012.)