该属性如下所示:
private static PropertyInfo<bool> FooProperty=
RegisterProperty<bool>(c => c.Foo, "Foo Friendly Name");
public bool Foo
{
get { return GetProperty(FooProperty); }
private set { SetProperty(FooProperty, value); }
}
我想从课外收到“食物友好名称”。
答案 0 :(得分:3)
取消静态FooProperty
上的访问权限:
//access FooProperty from inside the assembly where it is defined
internal static PropertyInfo<bool> FooProperty=
RegisterProperty<bool>(c => c.Foo, "Foo Friendly Name");
或
//access FooProperty from anywhere
public static PropertyInfo<bool> FooProperty=
RegisterProperty<bool>(c => c.Foo, "Foo Friendly Name");
然后从其外部访问它:
string fooName = FooClass.FooProperty.Name;