Czy C# oferuje dobrą metodę rzutowania pojedynczej jednostki typu T
na IEnumerable<T>
?Jak utworzyć singleton IEnumerable?
Jedynym sposobem mogę myśleć o coś takiego jak:
T entity = new T();
IEnumerable<T> = new List { entity }.AsEnumerable();
I chyba nie powinno być lepszy sposób.
możliwe duplikat: http://stackoverflow.com/questions/4779442/return-single-instance-object-as-ienumerable – Justin
możliwe duplikat [Przechodząc jedną pozycję jak IEnumerable] (http://stackoverflow.com/questions/1577822/passing-a-single-item-as-ienumerablet) –
nawfal