How to cast/convert form Object in an byte[] array
- by maddash
I've got a maybe simple problem, but at the moment I am not able to solve it.
I have an Object and I need to convert it into a byte[].
public byte[] GetMapiPropertyBytes(string propIdentifier)
{
return (byte[])this.GetMapiProperty(propIdentifier); //InvalidCastException
}
Exception:
Unable to cast COM object of type 'System.__ComObject' to class type
'System.Byte[]'. Instances of types that represent COM components
cannot be cast to types that do not represent COM components; however
they can be cast to interfaces as long as the underlying COM component
supports QueryInterface calls for the IID of the interface.
So far so good - I've tried to serialize it, but I got another exception - NOT serializable
Could someone help me?
I need a method to convert it...