TypeInfo.DeclaredFields 属性

定义

获取由当前类型定义的字段的集合。Gets a collection of the fields defined by the current type.

public:
 virtual property System::Collections::Generic::IEnumerable<System::Reflection::FieldInfo ^> ^ DeclaredFields { System::Collections::Generic::IEnumerable<System::Reflection::FieldInfo ^> ^ get(); };
public virtual System.Collections.Generic.IEnumerable<System.Reflection.FieldInfo> DeclaredFields { get; }
member this.DeclaredFields : seq<System.Reflection.FieldInfo>
Public Overridable ReadOnly Property DeclaredFields As IEnumerable(Of FieldInfo)

属性值

由当前类型定义的字段的集合。A collection of the fields defined by the current type.

注解

若要筛选DeclaredFields属性的结果,请使用 LINQ 查询。To filter the results of the DeclaredFields property, use LINQ queries. 对于源于运行时的反射对象(例如,作为的结果typeof(Object)),您可以使用RuntimeReflectionExtensions类中的方法遍历继承树。For reflection objects that originate with the runtime (for example, as the result of typeof(Object)), you can traverse the inheritance tree by using the methods in the RuntimeReflectionExtensions class. 自定义反射上下文中的对象的使用者不能使用这些方法,并且必须遍历继承树本身。Consumers of objects from customized reflection contexts cannot use these methods and must traverse the inheritance tree themselves.

适用于