vendredi 30 août 2019

how do i get a class name variable

Im trying to get the class variable name

static void Main()
{
    TaskAction m_first = new TaskAction();
    m_first.Increment();
    m_first.Increment();

    TaskAction m_Second = new TaskAction();
    m_Second.Increment();

}

public class TaskAction
{
    private int m_Current;

    public TaskAction()
    {
        m_Current = 0;

    }

    public void Increment()
    {
        m_Current++;
        write(" TaskAction " + vairableName + " "  + m_Current);       
    }
}

i want to it to write out:

TaskAction m_first 1

TaskAction m_first 2

TaskAction m_second 1





Aucun commentaire:

Enregistrer un commentaire