I read a related question and answer about the nameof
operator, but it didn't help me, so I asked it here.
I want to write a wrapper for the C# nameof
operator so not only will it will return the name of a class property, but also concatenate it with the class name.
Let's assume a class with single property:
class Foo
{
public string SomeProperty {get; set;}
}
Now if compiling Console.WriteLine(nameof(Foo.SomeProperty))
with (C# 6 or higher), the result will be:
SomeProperty
So that is it possible to have something like this:
public string PrintFullName(???? object)
{
//????
}
I put ????
for the input Type
, because I don't know what the proper input Type
is.
I want the result of the PrintFullName to be:
Foo.SomeProperty
I don't necessarily look for run-time solutions. Any compile-time workaround will also help.