Hello friends,
I am new to this forum. I have written following code in C#, but I am confuse in two methods. I don't know which is better List<T>.ForEach or custom IEnumerable<T>? I have written following code for you.
Code:
public class MyClassEg
{
}
After this I have use webservice method that returns an Enumerable<MyClass>
The consumer of the webservice defines following method:
Code:
public void DoSomething(MyClass myClass)
{
}
Now the DoSomething is called by consumer.
Code:
var result
foreach(var myClass in result)
{
DoSomething(myClass);
}
or:
Code:
var result =
result.ToList().ForEach(DoSomething);
Please help me. Thank you.
Bookmarks