[Mono-dev] FindMembers() for TypeBuilder excluding overriden ones
Raja R Harinath
rharinath at novell.com
Mon Nov 14 01:05:04 EST 2005
Atsushi Eno <atsushi at ximian.com> writes:
> In mcs(.exe) I want to get a MemberInfo array which has a certain
> name and does not contain overriden base members i.e. something
> like Type.FindMembers() with Type.FilterName (TypeBuilder.GetMethods()
> returns base ones, and it should be fine).
> (For example, suppose I'm building System.Xml.dll, I don't want
> XmlReader.Read() while we have XmlTextReader.Read() for XmlTextReader.)
> Is there any preferable way I can go, or do I have to create such one?
> It would be useful to fix one /doc bug; #76690.
I'm assuming that DeclaredOnly is too strict a filter. It's somewhat
non-trivial. If you use Expression.MemberLookup or
TypeManager.MemberLookup instead of Type.FindMembers, you can use
mi.DeclaringType != t && mi.IsVirtual && !TypeManager.IsOverride (mi)
to filter out base virtual methods. However, to ensure that it actually
is overriden, you have to compare the signatures, and/or use
More information about the Mono-devel-list