System.InvalidCastException: 無法將型別為“System.String[*]”的物件強制轉換為型別“System.String[]”
百度不可其解。
uj5u.com熱心網友回復:
看你的代碼,型別不匹配,或者 Interop 呼叫的方法簽名定義錯誤。uj5u.com熱心網友回復:
把你報錯的那行代碼,發出來。uj5u.com熱心網友回復:
我需要從DCM檔案中取一些資訊出來。DicomImage image = images.ReadFile(strNewFullFilePath);
if (image.Attributes[0x20, 0x32].Exists == true)
{
try
{
object a = image.Attributes[0x20, 0x32].Value[1];
ImagePosY = image.Attributes[0x20, 0x32].Value[2];
ImagePosZ = image.Attributes[0x20, 0x32].Value[3];
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
throw e;
}
}
uj5u.com熱心網友回復:
ImagePosY 是什么型別。image.Attributes[0x20, 0x32].Value[2]又是什么型別
uj5u.com熱心網友回復:
object a = image.Attributes[0x20, 0x32].Value[1];這一行報錯 System.String[*]”的物件強制轉換為型別“System.String[]image.Attributes[0x20, 0x32].Value,是一個陣列。用其它語言能取到值,用c#遇到了困難。
System.String[*]是什么呢
uj5u.com熱心網友回復:
看起來像嵌套陣列,沒有遇到過。
其他語言能取到值,是哪個語言?
uj5u.com熱心網友回復:
VBDim objDicomImage As DicomImage
100 Set objDicomImage = frmMain.DicomViewer1.Images.ReadFile(strFilePath)
Dim strXYZ() As String
102 ReDim strXYZ(1)
Dim strX As String, strY As String, strZ As String
104 If objDicomImage.Attributes(&H20, &H32).Exists = True Then
106 strXYZ = objDicomImage.Attributes(&H20, &H32).Value
End If
108 If UBound(strXYZ) = 3 Then
110 GetDCMXYZByDCMFilePath = strXYZ(1) & "," & strXYZ(2) & "," & strXYZ(3)
End If
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/29699.html
標籤:C#
上一篇:請教C#計時器和銷毀圖片
