如何读取DisplayAttribute.Name属性?

时间:2016-08-18 17:47:24

标签: c#

这似乎是一项相当简单的任务,但是我无法在我的代码中找到如何阅读DisplayAttribute.Name属性。

我有一个属性的类:

[Display(Name="A Nice Field")]
public string SomeField{get;set;}

在我的代码中,我遇到了障碍。

        object[] attrs = prop.GetCustomAttributes(true);

        foreach (Attribute attr in attrs)
        {
            if (attr is DisplayAttribute)
            {
                // How do I read the attr Name property?
            }
        }

1 个答案:

答案 0 :(得分:0)

Uncategorized: Target 'Pods' of project 'Pods' was rejected as an implicit dependency for 'Pods.framework' because its architectures 'arm64' didn't contain all required architectures 'armv7 arm64'