Is it possible make a generic method where I don't know what type of enum I have and parsing string to this type?
Example:
I want make mapper from some model with list of string to model with list of enums
model 1
public class Model1 {
public List<string> SomeList1 {get; set;}
public List<string> SomeList2 {get; set;}
}
model 2
public class Model2{
public List<MyEnum1> SomeList1 {get; set;}
public List<MyEnum2> SomeList2 {get; set;}
}
Now I would like parsing Model1.SomeList1 to Model2.SomeList1 and Model1.SomeList2 to Model2.SomeList2 in one generic method.
Is it at all possible? If yes, how I can make it?