I'm converting the following code snippet to Progress. I got it to work but my solution seems a bit inelegant.
ImageConverter _imageConverter = new ImageConverter();
byte[] xByte = (byte[])_imageConverter.ConvertTo(x, typeof(byte[]));
return xByte;
Note that the second parameter of the ConvertTo method has to be a System.Type.
What I ended up doing was defining a Byte[] and then using GetType against it. This works but I had to new a byte array and it seems like there should be a cleaner way. Is there something in Progress that's like the C# Typeof command, the Progress Type-Of statement returns a logical, not a System.Type.
DEF VAR x AS "System.Byte[]".
x = NEW "System.Byte[]"(0).
RETURN CAST(oConverter:ConvertTo(pImage,x:GetType()),"System.Byte[]").
I'm converting the following code snippet to Progress. I got it to work but my solution seems a bit inelegant.
ImageConverter _imageConverter = new ImageConverter();
byte[] xByte = (byte[])_imageConverter.ConvertTo(x, typeof(byte[]));
return xByte;
Note that the second parameter of the ConvertTo method has to be a System.Type.
What I ended up doing was defining a Byte[] and then using GetType against it. This works but I had to new a byte array and it seems like there should be a cleaner way. Is there something in Progress that's like the C# Typeof command, the Progress Type-Of statement returns a logical, not a System.Type.
DEF VAR x AS "System.Byte[]".
x = NEW "System.Byte[]"(0).
RETURN CAST(oConverter:ConvertTo(pImage,x:GetType()),"System.Byte[]").
Flag this post as spam/abuse.
Thanks Mike, that's exactly what I was looking for.