How to get values of type ienumerable?


#1

How to get values of type ienumerable?


#2

Add ToList() at the end and iterate using For each


#3

Hello @sowmya_somu,

In addition to the solution proposed by @vvaidya , you can also use GetEnumerator.


#4

I tried using
GetEnumerator but i couldnt get the value.But the problem got solved as it is taking the value type as string


#5

I might be wrong here, but I don’t think it’s needed - ForEach works on IEnumerable directly.

Using an Enumerator is a little different:
IEnumerator<string> rator = myStringList.GetEnumerator(); while (rator.MoveNext()) { string aString = rator.Current(); Console.WriteLine(aString); }

Interesting thing is, the moment I added a variable of type IEnumerator<T> to the workflow, designer shuts it down with an error:
System.Xaml.XamlParseException: 'Character '+' was unexpected in string 'scg:List+Enumerator(x:String)'. Invalid XAML type name.' Line number '68' and line position '21'.
But after adding it manually in the xaml, I can’t replicate it anymore (restarts etc., still works). Funny hiccup…


#6

True! I mentioned ToList() as its more known concept than IEnumerable.