I'm trying to convert vb6 code to c# code. My vb6 source code contains arrays of the most varied types and after conversion by Vs2005 tools these arrays have become 0-based array, but I need to reconvert to non-0-based array.So for example I try to use Array.CreateInstance with explicit cast to T[] for a generic use:
public void ResizeArrayBaseN<T>(ref T[] original, int firstLower, int firstCount)
{
try
{
int[] myBoundsArray = new int[1] {firstLower };
int[] myLengthsArray = new int[1] {firstCount - firstLower + 1 };
original = (T[])Array.CreateInstance(typeof(T), myLengthsArray, myBoundsArray);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
But I'm catching cast from T[*] to T[] error. Can someone help me,please ? Thanks in advance