I'm having an issue with the following code.
byte[] array = data as byte[]; // compile error - unable to use built-in conversion
if (array != null) { ...
I only want to assign the data to array variable if the data is actually a byte array.
I'm having an issue with the following code.
byte[] array = data as byte[]; // compile error - unable to use built-in conversion
if (array != null) { ...
I only want to assign the data to array variable if the data is actually a byte array.
Try
if(data.GetType().Name == "I forget what the exact name is for a byte array")
{
// assign to array
}
As soon as I asked this I realised that the type of data was not object.
Making it of type object (its coming in via a type converter in Silverlight) and it worked.
How about this:
byte[] array = new byte[arrayLength];
if (array is byte[])
{
// Your code
}