I wrote a static class, as shown below:
namespace BkhText
{ static class Data { //自定义事件委托
//发送信息
public delegate void PropertyChangedEventHandler(string e);
public static event PropertyChangedEventHandler propertyChangedHandler;
//定义数据类型
private static string data1;
public static string MyProperty_data1
{
get
{
return data1;
}
set
{
data1 = value;
propertyChangedHandler(data1);
}
}
}
}
When I assign a value to it somewhere else, it will prompt
private void Button01_Click(object sender, RoutedEventArgs e)
{
Data.MyProperty_data1 = "test";
}
the object reference is not set to an instance of the object.I hope you could help me. And Thanks