Linked Questions

56 votes
6 answers
104k views

I was wondering if it is possible to cast an IEnumerable to a List. Is there any way to do it other than copying out each item into a list?
RCIX's user avatar
  • 39.6k
9 votes
2 answers
30k views

How I can convert System.Collection.IEnumerable to list in c#? Actually I am executing a store procedure that is giving me ResultSets in System.Collection.IEnumerable and I want to convert that result ...
Ali Nafees's user avatar
-1 votes
1 answer
2k views

I'm attempting to convert a list of numbers to a string and then later back to a list. Converting to a string works fine, but when I convert it back to the list, I get the error "Cannot implicitly ...
Jessica's user avatar
  • 27
0 votes
0 answers
77 views

I have a method similar to this: void Log(object value) { if (value is IEnumerable && !(value is IList)) { // Need to convert value to a list here } // ... Rest of ...
Vaccano's user avatar
  • 83.2k
8 votes
2 answers
12k views

How can I turn the following statement back to List<DocumentData> IEnumerable<IGrouping<string, DocumentData>> documents = documentCollection.Select(d => d)....
Tsukasa's user avatar
  • 6,582
1 vote
2 answers
2k views

I'm working on a C# script within a Unity3D Project where I'm trying to take a list of strings and get a 2D list of the permutations. Using this answer's GetPermutations() in the following fashion: ...
Darrel Holt's user avatar
1 vote
0 answers
2k views

I'm trying to project a list of entities directly from an IQueryable using AutoMapper to a dto, however it always seems to fail with an InvalidOperationException stating that The sequence contains no ...
user avatar
0 votes
3 answers
330 views

I have the following code: static void Main(string[] args) { TaskExecuter.Execute(); } class Task { int _delay; private Task(int delay) { _delay = delay; } public void ...
Alex's user avatar
  • 6,189
0 votes
1 answer
441 views

How I can create Objects of MyClass Dynamically? I have nested lists, I will get the count of nested lists from my DataTable, so I don't know how many objects I need. I am working inside loop. Can I ...
Khaksar's user avatar
  • 343
0 votes
1 answer
373 views

I have a list with a converter like so <ListView ItemsSource="{Binding Availability, Converter={StaticResource AvailabilityConverter}}"> <ListView.ItemTemplate> ...
Ryan Stuart's user avatar
-1 votes
2 answers
84 views

I am in the early stages of learning c# and am currently "fixing" a project (as an exercise). I've come across this code but I can't make sense of it. List<CartLine> cartList = Lines as List&...
dags's user avatar
  • 1