I’m having trouble converting the following VB6 code into c#4.0? This function takes a BLOb from an oracle database and converts it to bytes. After removing the code un-needed by this example, it looked something like this…
Function tempFunc(Data as Variant) as byte()
tempFunc = StrConv(Data, vbUnicode)
End Function
after converting the function to c#…
byte[] tempFunc(object data)
{
...code...
}
I tried to convert the inner line but got to a problem…
Microsoft.VisualBasic.Strings.StrConv(data, VBStrConv.???);
There isn’t a Unicode equivalent flag in the VBStrConv enum any more…
looked up a few other examples and found this…
byteData = System.Text.Encoding.UTF8.GetBytes(data);
However this takes a string and therefore is unhelpful…
Found another example using a memory stream however to convert it, it would need metadata, which would not exist in the original BLObs from the database.
Anyone have any ideas?
You can use
BinaryFormatter