gpt4 book ai didi

c# - 如何从类外部检索 CSLA 属性的友好名称?

转载 作者:行者123 更新时间:2023-11-30 22:45:16 25 4
gpt4 key购买 nike

属性如下所示:

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); }
}

我想从课外收到“Foo Friendly Name”。

最佳答案

放松对静态 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;

关于c# - 如何从类外部检索 CSLA 属性的友好名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3135891/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com