Home > Net >  Unable to type into "System. The String [*]" the object of cast to type "System. The
Unable to type into "System. The String [*]" the object of cast to type "System. The

Time:11-17

System. InvalidCastException: unable to type into "System. The String [*]" the object of the cast to type "System. The String []"

Baidu is not the solution,

CodePudding user response:

Look at your code, type do not match, or overly invoking method signature error,

CodePudding user response:

The wrong that you quoted lines of code, made by,

CodePudding user response:

I need to get some information from the DCM file,

 DicomImage image=images. ReadFile (strNewFullFilePath); 

If (image. The Attributes [0 x20, 0 x32] Exists==true)
{
Try
{

The object a=image. The Attributes [0 x20, 0 x32] Value [1].
ImagePosY=image. The Attributes [0 x20, 0 x32] Value [2];
ImagePosZ=image. The Attributes [0 x20, 0 x32] Value [3].
}
The catch (Exception e)
{

MessageBox. Show (e. oString ());
throw e;
}

}


refer to the second floor is nu month god reply:
mistake your offer a firm one of the lines of code, issued to,

CodePudding user response:

ImagePosY what type,
Image. The Attributes [0 x20, 0 x32] Value [2] what type

CodePudding user response:

The object a=image. The Attributes [0 x20, 0 x32] Value [1]. This line error System. String [*] "the object of casts to type" System. The String []
Image. The Attributes [0 x20, 0 x32] Value, is an array, use other languages can take to the Value, the difficulties in c #,

System. The String [*] what is that

CodePudding user response:

reference 5 floor he036002 reply:
object a=image. The Attributes [0 x20, 0 x32] Value [1]. This line error System. String [*] "the object of casts to type" System. The String []
Image. The Attributes [0 x20, 0 x32] Value, is an array, use other languages can take to the Value, the difficulties in c #,

System. The String [*] what is

Looks like a nested array, not met,
Other languages can take to the value, which is language?

CodePudding user response:

VB
 Dim 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. The Attributes (& amp; H20, & amp; H32). The Exists=True Then

106 strXYZ=objDicomImage. The Attributes (& amp; H20, & amp; H32). The Value

End the If

108 If UBound (strXYZ)=3 Then

110 GetDCMXYZByDCMFilePath=strXYZ (1) & amp; ", "& amp; StrXYZ (2) & amp; ", "& amp; StrXYZ (3)
End the If
  •  Tags:  
  • C#
  • Related