I want to call Type.GetFields() and only get back fields declared as \"public const\". I have this so far...
type.GetFields(BindingFlags.Static | BindingFlags.P
type.GetFields(BindingFlags.Static | BindingFlags.Public).Where(f => f.IsLiteral);
Trying checking whether FieldInfo.Attributes includes FieldAttributes.Literal. I haven't checked it, but it sounds right...
(I don't think you can get only constants in a single call to GetFields
, but you can filter the results returned that way.)