Skip to main content

For-Each-with-Index

[CSharp]

For Each with Index

foreach(var item in filterValue.Select((value, i) =>new {
i,
value
}))

{

var value = item.value;

var index = item.i;

}

[Test]

public void GetApiObjectName()

{

var list = At.ApiService.Object.GetObjectByType(ObjType.ObjectType, 0, 0);

var filtered = list.Data.Where(x =>x.ref_id == abc);

var enumerable = filtered as Obj[] ? ?filtered.ToArray();

// var listdata = enumerable.ToList();
foreach(var name in enumerable.ToList())

{

Console.WriteLine(name.display_name);

Console.WriteLine(name.ref_id);

}

// var singleString = string.Join(",", enumerable.ToArray() );
}