Do you need to do another conversion, depends on or just wants to test certain classes? In the second case, you can try to specify the correct types for T, for example:
public static List<string> ConvertData(List<string> data)
{
return PrivateConvertData<string>(data);
}
public static List<int> ConvertData(List<int> data)
{
return PrivateConvertData<int>(data);
}
private static List<T> PrivateConvertData<T>(List<T> data)
{
}
This code will check for type T at compile time.
source
share