Thanks in advance.
Mark
You should be able to get all of the static fields on a type, and then
cycle through them, checking the IsLiteral property on the FieldInfo
instance representing the field. If IsLiteral returns true, then it is a
constant. To get the value, you can just call GetValue on the FieldInfo
instance, passing null for the instance, and it should return the value of
the constant.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"Mark" <ma...@iamnotintospam.com> wrote in message
news:%23puP1R0...@TK2MSFTNGP15.phx.gbl...
Yes.
- Load the assembly (Assembly.Load[From])
- Get all types (Assembly.GetTypes)
- Get all static fields in each type (Type.GetFields)
- Check if it's a const (FieldInfo.Attributes has Literal set)
- If so retrieve the value (FieldInfo.GetValue)
Mattias
--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.