Use existing or create new C# with Example



Use existing or create new C# with Example

A common usage scenario that this feature really helps with is when you are looking for an object in a collection 
and need to create a new one if it does not already exist. 
IEnumerable myList = GetMyList(); 
var item = myList.SingleOrDefault(x => x.Id == 2) ?? new MyClass { Id = 2 }; 

0 Comment's

Comment Form

Submit Comment