Phung

Phung

  • NA
  • 5
  • 9.2k

Unable to cast object of type 'System.Single[*]' to type 'System.Single[]'

Apr 9 2011 9:44 AM
Hi,

Would you please help?  I have been struggling for two weeks without any success.  I try to convert System._COMObject Type to Array type.  It worked in VS2008 however when I change to VS2010 it doesn't.

int[] myLengthsArray = new int[1] { nMem };
int[] myBoundsArray = new int[1] { 1 };

myDs = Array.CreateInstance(typeof(double), myLengthsArray, myBoundsArray);//Depth D
Array myDs;

private void PopulateArrays(Multiframe.SectionList mySectionList)
{
        myDs = (Array)mySectionList.D;
}

I also try Array.ConvertAll but that didn't work either

myDs = Array.ConvertAll<object, double>(testdata, new Converter<object, double>(ConvertIntToString));
private double ConvertIntToString(object iData)
{
        double cData = Convert.ToDouble(iData);
        return cData;
}

Thanks

Rob

Answers (10)