¡@

Home 

c# Programming Glossary: enumerable

.Net Data structures: ArrayList, List, HashTable, Dictionary, SortedList, SortedDictionary — Speed, memory, and when to use each?

http://stackoverflow.com/questions/128636/net-data-structures-arraylist-list-hashtable-dictionary-sortedlist-sorted

Dictionary SortedList and SortedDictionary Which ones are enumerable IList can do 'foreach' loops Which ones use key value pairs..

Distinct() with lambda?

http://stackoverflow.com/questions/1300088/distinct-with-lambda

with lambda Right so I have an enumerable and wish to get distinct values from it. Using System.Linq there's.. myStringList.Distinct Well and good but if I have an enumerable of objects for which I need to specify equality the only available..

Cast LINQ result to ObservableCollection

http://stackoverflow.com/questions/1465285/cast-linq-result-to-observablecollection

ObservableCollection Foo x new ObservableCollection Foo enumerable That will do the required copying. There's no way of observing..

Is it better to return null or empty collection?

http://stackoverflow.com/questions/1969993/is-it-better-to-return-null-or-empty-collection

to NEVER return null when returning a collection or enumerable. ALWAYS return an empty enumerable collection. It prevents the.. a collection or enumerable. ALWAYS return an empty enumerable collection. It prevents the aforementioned nonsense and prevents.. Foos new List Foo When talking about methods that return enumerables you can easily return an empty array instead of null ... public..

How to get index using LINQ?

http://stackoverflow.com/questions/2471588/how-to-get-index-using-linq

the index of the first item matching an expression in an enumerable. summary param name items The enumerable to search. param param.. expression in an enumerable. summary param name items The enumerable to search. param param name predicate The expression to test.. Finds the index of the first occurence of an item in an enumerable. summary param name items The enumerable to search. param param..

How to write Asynchronous LINQ query?

http://stackoverflow.com/questions/252355/how-to-write-asynchronous-linq-query

ex Console.WriteLine error just a sample lazy loading enumerable public static IEnumerable int TestSlowLoadingEnumerable Thread.Sleep..

Random array using LINQ and C#

http://stackoverflow.com/questions/254844/random-array-using-linq-and-c-sharp

1 100 . _ OrderBy Function rnd.Next c# vb.net linq enumerable share improve this question The Developer Fusion VB.Net..

How to modify or delete items from an enumerable collection while iterating through it in C#

http://stackoverflow.com/questions/308466/how-to-modify-or-delete-items-from-an-enumerable-collection-while-iterating-thro

to modify or delete items from an enumerable collection while iterating through it in C# I have to delete..

What's your favorite LINQ to Objects operator which is not built-in?

http://stackoverflow.com/questions/3645644/whats-your-favorite-linq-to-objects-operator-which-is-not-built-in

methods are preferred. c# linq extension methods ienumerable linq to objects share improve this question Append Prepend.. end of an IEnumerable. summary typeparam name T Type of enumerable to return. typeparam returns IEnumerable containing all the.. start of an IEnumerable. summary typeparam name T Type of enumerable to return. typeparam returns IEnumerable containing the specified..

IEnumerable<T> as return type

http://stackoverflow.com/questions/381208/ienumerablet-as-return-type

irresponsible. As soon as the collection is modified the enumerable is invalidated and will cause an execption to occur. Instead..

C# (.NET) Design Flaws [closed]

http://stackoverflow.com/questions/411906/c-sharp-net-design-flaws

at any time ie. var e new Foo e Bar baz fix quadratic enumerable behaviour all collections should have immutable snapshots for..

When to use struct in C#?

http://stackoverflow.com/questions/521298/when-to-use-struct-in-c

class. Enumerator is public because Dictionary is enumerable and must have equal accessibility to the IEnumerator interface..

Pair-wise iteration in C# or sliding window enumerator

http://stackoverflow.com/questions/577590/pair-wise-iteration-in-c-sharp-or-sliding-window-enumerator

public static IEnumerable Pair T T Pairs IEnumerable T enumerable IEnumerator T e enumerable.GetEnumerator e.MoveNext T current.. Pair T T Pairs IEnumerable T enumerable IEnumerator T e enumerable.GetEnumerator e.MoveNext T current e.Current while e.MoveNext.. will also appreciate C# 3.0 solutions. c# .net iterator ienumerable share improve this question In .NET 4 this becomes even..

C# - What is the best way to modify a list in a 'foreach' loop?

http://stackoverflow.com/questions/759966/c-sharp-what-is-the-best-way-to-modify-a-list-in-a-foreach-loop

A new feature in C# .NET 4.0 is that you can change your enumerable in a foreach without getting the exception. See Paul Jackson's.. foreach but is there better way c# .net list enumeration enumerable share improve this question The collection used in foreach..

What does the [Flags] Enum Attribute mean in C#?

http://stackoverflow.com/questions/8447/what-does-the-flags-enum-attribute-mean-in-c

question The flags attribute should be used whenever the enumerable represents a collection of flags rather than a single value...

Why is there not a ForEach extension method on the IEnumerable interface?

http://stackoverflow.com/questions/101265/why-is-there-not-a-foreach-extension-method-on-the-ienumerable-interface

is there not a ForEach extension method on the IEnumerable interface Inspired by another question asking about the missing.. function Why is there no ForEach extension method in the Enumerable class Or anywhere The only class that gets a ForEach method..

C# Performance of nested yield in a tree

http://stackoverflow.com/questions/1043050/c-sharp-performance-of-nested-yield-in-a-tree

Each element in this structure should be able to return a Enumerable of all elements it is root to. Let's call this method IEnumerable.. of all elements it is root to. Let's call this method IEnumerable Foo GetAll . So if we have A topmost root B C D E F G a call.. current implementation of GetAll looks like this public IEnumerable Foo GetAll yield return this foreach Foo foo in MyChildren foreach..

What is the point of Lookup<TKey, TElement>?

http://stackoverflow.com/questions/1403493/what-is-the-point-of-lookuptkey-telement

Type sampleTypes new typeof List typeof string typeof Enumerable typeof XmlReader All the types in those assemblies IEnumerable.. typeof XmlReader All the types in those assemblies IEnumerable Type allTypes sampleTypes.Select t t.Assembly .SelectMany..

How do I invoke an extension method using reflection?

http://stackoverflow.com/questions/1452261/how-do-i-invoke-an-extension-method-using-reflection

MyObject Name Jon Simpson The Where method lives on the Enumerable type in System.Linq var whereMethods typeof System.Linq.Enumerable.. type in System.Linq var whereMethods typeof System.Linq.Enumerable .GetMethods BindingFlags.Static BindingFlags.Public .Where.. myObjects new object myObjects NameEquals as IEnumerable MyObject foreach var item in ret Console.WriteLine item.Name..

C# Lambda expression, why should I use this?

http://stackoverflow.com/questions/167343/c-sharp-lambda-expression-why-should-i-use-this

easier on the eye they are anonymous delegate var evens Enumerable .Range 1 100 .Where delegate int x return x 2 0 .ToList lambda.. int x return x 2 0 .ToList lambda expression var evens Enumerable .Range 1 100 .Where x x 2 0 .ToList Lambda expressions and..

Random array using LINQ and C#

http://stackoverflow.com/questions/254844/random-array-using-linq-and-c-sharp

I was reading an article on MSDN Magazine about using the Enumerable class in LINQ to generate a random array. The article uses VB.NET.. is in C# Dim rnd As New System.Random Dim numbers Enumerable.Range 1 100 . _ OrderBy Function rnd.Next c# vb.net linq enumerable.. equivalent C# code is System.Random rnd new System.Random IEnumerable int numbers Enumerable.Range 1 100 .OrderBy r rnd.Next For future..

How do I create an expression tree calling IEnumerable<TSource>.Any(…)?

http://stackoverflow.com/questions/326321/how-do-i-create-an-expression-tree-calling-ienumerabletsource-any

do I create an expression tree calling IEnumerable TSource .Any &hellip I am trying to create an expression tree.. Expression predicateExp MethodInfo method typeof Enumerable .GetMethod Any new typeof Func IEnumerable T Boolean return.. method typeof Enumerable .GetMethod Any new typeof Func IEnumerable T Boolean return Expression.Call propertyExp method predicateExp..

Why doesn't VS 2008 display extension methods in Intellisense for String class

http://stackoverflow.com/questions/345883/why-doesnt-vs-2008-display-extension-methods-in-intellisense-for-string-class

in Intellisense for String class Since String implements IEnumerable char I was expecting to see the Enumerable extension methods.. implements IEnumerable char I was expecting to see the Enumerable extension methods in Intellisense for example when typing the.. problem is that while String most definitely implements IEnumerable T most people don't think of it or more importantly use it in..

GetMethod for generic method [duplicate]

http://stackoverflow.com/questions/4035719/getmethod-for-generic-method

I'm trying to retrieve MethodInfo for Where method of Enumerable type typeof Enumerable .GetMethod Where new Type typeof IEnumerable.. MethodInfo for Where method of Enumerable type typeof Enumerable .GetMethod Where new Type typeof IEnumerable typeof Func but.. type typeof Enumerable .GetMethod Where new Type typeof IEnumerable typeof Func but get null. What am I doing wrong c# .net reflection..

Differences between IQueryable, List, IEnumerator?

http://stackoverflow.com/questions/4844660/differences-between-iqueryable-list-ienumerator

SQL statement to express hopefully an equivalent request. IEnumerable T is more generic than IQueryable T though all instances of.. T though all instances of IQueryable T implement IEnumerable T and only defines a sequence. However there are extension methods.. However there are extension methods available within the Enumerable class that define some query type operators on that interface..

Convert generic List/Enumerable to DataTable?

http://stackoverflow.com/questions/564366/convert-generic-list-enumerable-to-datatable

generic List Enumerable to DataTable I have few methods that returns different Generic.. Here's a nice 2013 update using FastMember from NuGet IEnumerable SomeType data ... DataTable table new DataTable using var reader.. members or enforce the order then you can do that too IEnumerable SomeType data ... DataTable table new DataTable using var reader..

What is the difference between Directory.EnumerateFiles vs Directory.GetFiles?

http://stackoverflow.com/questions/5669617/what-is-the-difference-between-directory-enumeratefiles-vs-directory-getfiles

Obviously one returns an array and the other return Enumerable. Anything else c# .net directory io share improve this question.. be more efficient. So basically EnumerateFiles returns an IEnumerable which can be lazily evaluated somewhat whereas GetFiles returns..

LINQ Expression to return Property value?

http://stackoverflow.com/questions/567963/linq-expression-to-return-property-value

Here is my non working implementation public static IEnumerable T SelectByParameterList T PropertyType Table T items IEnumerable.. T SelectByParameterList T PropertyType Table T items IEnumerable PropertyType parameterList Expression Func T PropertyType property.. parameters per request Parameter .GroupBy x x.GroupID .AsEnumerable var results groups .Select g new Group g Parameters g.Select..

Distinction between iterator and enumerator

http://stackoverflow.com/questions/716238/distinction-between-iterator-and-enumerator

there are two major ways to enumerate something. Implement Enumerable and a class implementing IEnumerator Implement an iterator with..

C# - What is the best way to modify a list in a 'foreach' loop?

http://stackoverflow.com/questions/759966/c-sharp-what-is-the-best-way-to-modify-a-list-in-a-foreach-loop

is the best way to do the following foreach var item in Enumerable foreach var item2 in item.Enumerable item.Add new item2 Usually.. foreach var item in Enumerable foreach var item2 in item.Enumerable item.Add new item2 Usually I use an IList as a cache buffer..