delegate void SetValue(int value);
delegate int GetValue();
class Test
{
static void Main()
{
int x = 0;
SetValue set = delegate(int value)
{
x = value;
};
GetValue get = delegate
{
return x;
};
set(1);
Console.WriteLine(get());
set(2);
Console.WriteLine(get());
}
}
沒有留言:
張貼留言