I suggest you ...

Ability to get PropertyInfo dynamically passing the property itself (a delegate to the getter), rather than the property name.

To get a PropertyInfo instance a property name should be specified. It'll be great to have a way of getting PropertyInfo given a delegate like Func<object>, which will return the property.

Example:

internal class Sample
{
public int PropA { get;set;}

public void SomeMethod()
{
PropertyInfo info = GetPropertyInfo(()=>this.PropA);
// Some other code, using the "info" variable
}

public static PropertyInfo GetPropertyInfo(Func<object> property)
{
// This is the method I'm asking about.
}
}

3 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Artak Mkrtchyan shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    Thank you for your suggestion! While we aim to respond to every suggestion, we are closing older ones that don’t have enough votes so newer ones from you can move to the top. If this suggestion is still important to you, feel free to open it again.

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base