Is it possible to get property name from extension method [duplicate]

Solution 1:

No, it's not possible. C# has a few options:

  • nameof

      nameof(Car.Color)
    
  • Expression trees using Expression<...> and lambdas. See this post: Retrieving Property name from lambda expression