I would like to emulate the Microsoft SQL Server function GetSqlBinary() in MySQL version 5.6 I would like to emulate the Microsoft SQL Server function GetSqlBinary() in MySQL version 5.6.
  The C# namespace System.Data.SqlClient implements GetSqlBinary(), which is like fetching a blob.But the C# namespace MySql.Data.MySqlClient does not  implement GetSqlBinary().
  So is seems that the difference is that GetSqlBinary gives you a lump of data as a byte array, while GetSqlBytes is similar but stores the data in a buffer which allows you to interact with the underlying data as a stream.
  Here is the definition of GetSqlBinary():

GetSqlBinary returns an SqlBinary structure:
Represents a variable-length stream of binary data to be stored in or retrieved from a database.

GetSqlBytes returns an SqlBytes class:
Represents a mutable reference type that wraps either a Buffer or a Stream.

Please suggest a way to do the function GetSqlBinary() in MySQL. Thank you.
Frank
I don't quite understand the problem you are having - let me explain why. The SqlBinary class is just a wrapper around a byte[] which adds some nice programmer-friendly methods and properties to it. But underneath the hood it is just a byte array. You can find this out by viewing the source code here:

http://referencesource.microsoft.com/#System.Data/System/Data/SQLTypes/SQLBinary.cs,2cc17fbd58a1a375

Also, you can view the source code to the SqlDataReader class here:

http://referencesource.microsoft.com/#System.Data/System/Data/SqlClient/SqlDataReader.cs,e46454446a9e2777

In short, it just takes the value of the field, casts it to a byte[] and constructs a new SqlBinary value from it. There is nothing stopping you from doing the same or implementing it yourself. Heck, if you implemented a MySqlBinary class you could even submit it as an enhancement to the library if you wanted to, I'm sure you are not the only person who would like it.

In short, doing this:

var binary = (byte[])reader.GetValue(i);


Is pretty much all you really need here.