On Thu, 19 Jun 2008 03:39:21 -0700, deerchao <de******@gmail.comwrote:
I am wondering why wouldn't the microsoft guys add an IsStatic
property for MemberInfo class :(
Well, wouldn't that be redundant? I mean, "HasThis" means that the call
uses a "this" reference, which is exactly what an instance member
requires. Likewise, "Standard" means it doesn't, which is exactly what a
static member requires. The need to get at the method (i.e. for dealing
with properties) adds a little inconvenience, but it's not like the
information isn't there.
You also have the alternative of specifically searching for instance and
static members separately (use the Type.GetMember(BindingFlags)
overload). Then whatever's returned, you know it will be the specific
category of member that you asked for, instance or static.
I guess I'm saying that while adding an IsStatic property might have made
it even _more_ convenient, once you head down that path there's all sorts
of attributes they could expose as properties rather than just having you
look at the specific meta-data. Given that the information is in fact
available, I think the reason "the microsoft guys" wouldn't add an
IsStatic property is that there's really no need to.
Pete