Development Blog : C# Code Samples,.NET Tips and Tricks
Articoli con tag foreach
[C#] : Come scansionare un Array con LINQ
01 year ago un anno fà
Scritto da Luigi Melisi
in Tips and Tricks
using System;
using System.Collections;
using System.Collections.Generic;
namespace ForEachExaple
{
public static class Utility
{
public static void ForEach(this IEnumerable coll, Action function)
{
IEnumerator en = coll.GetEnumerator();
while (en.MoveNext())
function(en.Current);
}
}
class Program
{
static void Main(string[] args)
{
var array = new int[] { 1, 2, 3 };
//Output : 123
array.ForEach(val => Console.Write(val));
}
}
}
![Last Minute last60 225x300 [C#] : Come scansionare un Array con LINQ](http://www.luigimelisi.com/wp-content/uploads/2010/06/last60-225x300.jpg)