c# Programming Glossary: enumerable.empty
Favorite way to create an new IEnumerable<T> sequence from a single value? http://stackoverflow.com/questions/1019737/favorite-way-to-create-an-new-ienumerablet-sequence-from-a-single-value an empty sequence of strings you can do var sequence Enumerable.Empty string EDIT OP clarified they were looking to create a single..
Contravariance explained http://stackoverflow.com/questions/1962629/contravariance-explained because defined in Interface IEnumerable Mammal mammalList Enumerable.Empty Mammal IEnumerable Animal animalList mammalList because of this..
From Eric Lippert's blog: “don't close over the loop variable” [duplicate] http://stackoverflow.com/questions/3190578/from-eric-lipperts-blog-dont-close-over-the-loop-variable T sequences base case IEnumerable IEnumerable T result new Enumerable.Empty T foreach var sequence in sequences var s sequence don't close..
GetFiles with multiple extentions [duplicate] http://stackoverflow.com/questions/3527203/getfiles-with-multiple-extentions extensions IEnumerable FileInfo files Enumerable.Empty FileInfo foreach string ext in extensions files files.Concat..
Iterate over values in Flags Enum? http://stackoverflow.com/questions/4171140/iterate-over-values-in-flags-enum mask results.Add values i bits mask if bits 0L return Enumerable.Empty Enum if Convert.ToUInt64 value 0L return results.Reverse Enum.. 0 Convert.ToUInt64 values 0 0L return values.Take 1 return Enumerable.Empty Enum private static IEnumerable Enum GetFlagValues Type enumType..
Generating Permutations using LINQ http://stackoverflow.com/questions/4319049/generating-permutations-using-linq IEnumerable int M int p int t1 int t2 if p 0 yield return Enumerable.Empty int else for int first t1 first t2 first foreach var rest in.. IEnumerable int M int p int t1 int t2 return p 0 Singleton Enumerable.Empty int from first in Enumerable.Range t1 t2 t1 1 from rest in..
Validation: How to inject A Model State wrapper with Ninject? http://stackoverflow.com/questions/4776396/validation-how-to-inject-a-model-state-wrapper-with-ninject override IEnumerable ValidationResult Validate T entity Enumerable.Empty ValidationResult We can configure this NullValidator T as follows..
Loop through Textboxes http://stackoverflow.com/questions/4863051/loop-through-textboxes control.Controls null control.Controls.OfType TControl Enumerable.Empty TControl return children.SelectMany c GetChildControls c .Concat..
Easiest way to create a cascade dropdown in ASP.NET MVC 3 with C# http://stackoverflow.com/questions/5497524/easiest-way-to-create-a-cascade-dropdown-in-asp-net-mvc-3-with-c-sharp Value Text select year @Html.DropDownListFor x x.Month Enumerable.Empty SelectListItem select month script type text javascript '#Year'..
IEnumerable<T> null coalescing Extension http://stackoverflow.com/questions/5640369/ienumerablet-null-coalescing-extension I often come into codes like this var myProjection myList Enumerable.Empty T .Select x x.Foo ... Hence I thought to add this extension.. T AsEmptyIfNull T this IEnumerable T source return source Enumerable.Empty T A little issue comes immediately in my mind looking at this..
Store multi-type OrderBy expression as a property http://stackoverflow.com/questions/7737355/store-multi-type-orderby-expression-as-a-property Customer int c c.FavNumber IQueryable Customer query Enumerable.Empty Customer .AsQueryable query coord.ApplyOrders query string result..
|