//TechTeam is enum type
//This line returns the enumvalue as out param, for the matching stringvalue.
Enum.TryParse(stringvalue, out TechTeam tt);
It works perfectly. Now if I turn it to generic I am using
private T enumparse<T>(string state)
{
Enum.TryParse<T>(state, out T stateout);
return stateout;
}
it throws error.
I changed the code to :
private T? enumparse<T>(string? state) where T: System.Enum
{
Enum.TryParse<T>(state, out T stateout);
return stateout;
}
It says the Type T must be a non nullable value.