日期:2014-05-17 浏览次数:21053 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
static class GlobalData
{
public static event Action DataChanged;
static string _value = string.Empty;
public static string Value
{
get
{
return _value;
}
set
{
if (DataChanged != null) DataChanged();
_value = value;
}
}
}
class Program
{
static void Main(string[] args)
{
GlobalData.DataChanged += () => Console.WriteLine("更改!");
GlobalData.Value = "a";
GlobalData.Value = "b";
}
}
}