Will the PropertyInfo of the expression equal PropertyInfo of GetProperties ()

I know that typeof(T) == typeof(T)it will always be true, because objects Typeare mostly static, and only one instance Typeexists for each type of class (if it is wrong, please correct me ... I have several programs that operate on this assumption).

I find it hard to find in the documentation whether the objects PropertyInfohave the same properties.

My application is this:

I have a class Reflector<T>that takes a result typeof(T).GetProperties(...)and stores the resulting objects PropertyInfoas keys in a dictionary.

Separately, I have an expression parser that tries to parse an expression that describes access to a specific property of a type Func<T, TResult>(for example, t => t.SomePropertywith T, being t.GetType()and TResultbeing a type SomeProperty). After some calculations, I end up with an object PropertyInfocoming from MemberExpression.Memberthe passed Expression.

The resulting one is PropertyInfothen used as a key in the call Dictionary.TryGetValueto obtain additional data about this property stored in the dictionary Reflector<T>.

Question

, PropertyInfo, MemberExpression.Member, (==) PropertyInfo , Type.GetProperties, PropertyInfo , ?

, , .

+4
2

, . PropertyInfo .

+1

, virtual , PropertyInfo , , .

MemberExpression.Member () => someInstance.SomeProperty PropertyInfo . , , PropertyInfo, .

0

All Articles