Why not a memberinfo() reflection function for C# [duplicate]
This question already has an answer here: Why is there not a `fieldof` or `methodof` operator in C#? [closed] 4 answers There is sizeof() and typeof() , but why not a memberinfo() returning an instance of System.Reflection.MemberInfo for the part of code selected in order to aid in reflection code. Example: Program() { Type t = typeof(Foo); Foo foo = new Foo(); PropertyInfo pi = memberinfo(Foo.Name) as PropertyInfo; // or shall it be like this // PropertyInfo pi = memberinfo(foo.Name) as PropertyInfo; string name = pi.GetValue(foo, null); } I am trying to understand if there is a fundamental