I have a Linq.Binary object and I would like to conv开发者_JAVA技巧ert it to the type contained within a string.
System.Data.Linq.Binary b = System.BitConverter.GetBytes(10.1);
string Type = "System.Double";
double d = Something(b, Type);
How do I convert from Linq.Binary to "System.Double" or "System.String"? Do I just have to have a giant case statement or is their a slicker way?
Load the byte[] into a BinaryReader and then you can extract the data out of it with the various Read methods. http://msdn.microsoft.com/en-us/library/hf6bat53.aspx
精彩评论