Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想检查 propertyInfo 以确定XmlIgnore属性是否应用于给定属性。我怎样才能做到这一点?
XmlIgnore
bool b = type.GetProperty("MyProp") .GetCustomAttributes(false) .Any(a => a is XmlIgnoreAttribute);
typeof(string).GetProperty("Length").GetCustomAttributes(typeof(some attr))