开发者

C#: Converting from Linq.Binary to Type in String

开发者 https://www.devze.com 2023-02-21 05:24 出处:网络
I have a Linq.Binary object and I would like to conv开发者_JAVA技巧ert it to the type contained within a string.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消