Compilation errors:
Visual Basic.NET Compilation error: "Type t is not defined"
C# Compilation error: 't' is a variable but is used like a type
Why i can not do this:
VB:
For i = 0 To dt.Columns.Count - 1
Dim t As Type = dt.Columns(i).DataType
Dim field = dt.GetValueSafely(Of t)(dt.Columns(i).ColumnName, 0) ' compilation error'
Next
C#:
for (int i = 0; i <= dt.Columns.Count - 1; i++)
{
Type t = dt.Columns[i].DataType;
var field = dt.GetValueSafely<t>(dt.Columns[i].ColumnName, 0); // compilation error
}
Is there other achieve what i am trying to do or i must declare the type directly?