vendredi 21 août 2020

how to get varriable name over another one c#?

string MyVar1 = "bilah bilah";
dosometing(MyVar1);

    void dosometing(object MyObject)
    {
       string VarName = nameof(MyObject);   // it givess : "MyObject"
    }

But I was expecting "MyVar1" is there a way for that? using dynamic? or ref?





Aucun commentaire:

Enregistrer un commentaire