c# - Can Expression.PropertyOrField be used to access a static property or field? -
the documentation of expression parameter of expression.propertyorfield states can null static members:
an expression
typecontains property or field namedpropertyorfieldname. this cannullstatic members.
(emphasis mine)
however, whenever pass null argumentnullexception.
the documentation of method contradictory:
- the documentation of expressionparameter states cannullstatic members
- the documentation of argumentnullexceptionstates thrown ifexpressionnull
fact is:
 method can't used access static members, documentation of expression parameter incorrect.
 when expression correct type supplied, method doesn't work expected, because ever looks instance members.
to access static field or property, use expression.makememberaccess instead.
Comments
Post a Comment