Generics | 西浅草情報システム ヘッポコ社長のblog

西浅草情報システム ヘッポコ社長のblog

日々の出来事を赤裸々に綴ってまいる所存であります。

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Generics();
}

private static void Generics()
{
List<Per> l = new List<Per>(new Per[] { new Per(10, "中村"),

new Per(10, "伊藤"),

new Per(15, "斉 藤") });


l.FindAll(delegate(Per n)
{
return n.age == 15;
}).ForEach(delegate(Per n)
{
Console.WriteLine(n.name);
});
}
}


internal class Per
{
public int age;
public string name;
public Per(int age, string name)
{
this.age = age;
this.name = name;
}
}
}