Is it possible to get a unique identifier of a property from within its accessors?
class Foo
{
int Bar
{
set
{
string nameOfThisProperty = X; // where X == "Bar" or any unique value
}
}
}
If so, how?
Update:
The reason I'm asking is: I want some some consistent unique value identifying the property in which the code is executing to avoid having to declare one myself as I'm doing right now:
Dictionary<string, RelayCommand> _relayCommands
= new Dictionary<string, RelayCommand>();
public ICommand SomeCmd
{
get
{
string commandName = "SomeCmd";
RelayCommand command;
if (_relayCommands.TryGetValue(commandName, out command))
return command;
...