Hi friends,
i am stuck with converting IEnumerable
IEnumerable
Thanks in advance.
Nitingowda ....
Hi friends,
i am stuck with converting IEnumerable
IEnumerable
Thanks in advance.
Nitingowda ....
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Prasad RaveendranPosted May 30, 2023, 1:51 AM
Hope this would help
using System.Collections.Generic;
using System.Collections.ObjectModel;
IEnumerable
// Step 1: Filter integers from the IEnumerable filteredIntegers = enumerable.OfType();
IEnumerable
// Step 2: Create a ReadOnlyCollection from the filtered integers readOnlyCollection = new ReadOnlyCollection(filteredIntegers.ToList());
ReadOnlyCollection
Please note that any objects in the IEnumerable that are not of type int will be excluded from the resulting ReadOnlyCollection.
Amit MohantyPosted May 29, 2023, 5:48 AM
Check this:
Sam HobbsPosted May 28, 2023, 12:24 AM
Are you certain that all items are integers? Where does the IEnumerable come from? If it is possible to get an IEnumerable instead of IEnumerable then that would make it easier therefore if you can tell us where it is coming from then that might help.