public void EvenBetterFoo() { var internalDocuments = HasInternalDocuments(AdditionalDocuments) ? AdditionalDocuments : Enumerable.Empty<Document>(); AdditionalDocumentsGroup = new AdditionalDocumentsGroup(internalDocuments); }
public void Foo() { if (HasInternalDocuments(AdditionalDocuments)) { AdditionalDocumentsGroup = new AdditionalDocumentsGroup(AdditionalDocuments); } else { AdditionalDocumentsGroup = new AdditionalDocumentsGroup(new List<Document>()); } }
public void BetterFoo() { IEnumerable<Document> internalDocuments; if (HasInternalDocuments(AdditionalDocuments)) { internalDocuments = AdditionalDocuments; } else { internalDocuments = new List<Document>(); } AdditionalDocumentsGroup = new AdditionalDocumentsGroup(internalDocuments); }