Hi,
I got the following piece of C# code that I am porting over from VS. When compiling in Water I get an “Invalid cast” error:
public static List ToList(this IDataReader dr)
{
var result = new List();
var listType = typeof(List);
while (dr.Read())
{
if (listType == typeof(List))
{
(result as List)?.Add(dr.ToString(0)); // **** Invalid cast here
}
if (listType == typeof(List))
{
(result as List)?.Add(dr.ToInt(0)); // **** Invalid cast here
}
}
Is there a way to code it so it compiles in Water?
// Thom