Datarow to IEnumerable

Hi guys,

How are you doing? :slight_smile:

Simple .net question: is it possible to convert a datarow to a IEnumerable?

Ty

1 Like

@Elya
Yes buddy we can
if the datatable is stored in a variable named out_dt
out_dt.Rows.GetEnumerator
This gives you the System.Collections.IEnumerable…

Hope this would help you

Cheers…

1 Like

I want to use it in my “For each activity” but it seem to be a IEnumerator instead of IEnumerable.
It seem I dont realy understand something xD

(the purpose is to check if i have empty element in my datarow. So i want to enumerate into it and check for each element of my datarow)

image

May be we can use this buddy

out_dt.Rows.OfType(of IEnumerable)

inside the for each actvity buddy

Cheers…!

@Palaniyappan

I want to pass the specific row value in datatable as variable value like below

Can you please help me to convert it

For Each Row in Datatable (yourDT)

  • For Each in yourDT.Columns (set TypeArgument to datacolumn)
    – if String.IsNullorEmpty(CurrentRow(item.ColumnName).ToString)

row(“ColumnSizes”).ItemArray.AsEnumerable.Cast(Of Integer)

The above query converts the row to an array of items which can be converted to an enumerable type. The cast function is used to convert to a particular type, in your case since you need IEnumerable cast is of integer