[Solved] How to get the name of List [closed]


If what you mean is the name of the variable that was used when the list was passed to the method like this:

static List<string> GatherDataPerProduct(List<Pandora.Data.DomainObject> lstdata)
    {
        if(lstData.value == "subjects")
        {
          //do whatever
         }

List<DomainObject> subjects;
GatherDataPerProduct(subjects);

then what you’re trying to do is not possible. The reason is that upon compilation, the compiler will remove all variable names. That means you cannot get the names of variables. If what you really want is name the object itself, then you should go with Dave’s answer and wrap the list inside another object and define a property on it.

solved How to get the name of List [closed]