如何从二进制文件中获取数据并将其显示在c#中的DataGridView中 [英] how to get data from a binary file and display it in a DataGridView in c #

查看:468
本文介绍了如何从二进制文件中获取数据并将其显示在c#中的DataGridView中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从二进制文件中获取数据并将其显示在c#中的DataGridView中。感谢帮助。

how to get data from a binary file and display it in a DataGridView in c #. appreciate the help.

推荐答案

static string ConvertBinaryToText(List<list><int>> seq){
    return new String(seq.Select(s => (char)s.Aggregate( (a,b) => a*2+b )).ToArray());
}

static void Main(){
   string s = "stackoverflow";
   var binary = new List<list><int>>();
   for(var counter=0; counter!=s.Length; counter++){
       List<int> a = ConvertTextToBinary(s[counter], 2);
       binary.Add(a);
       foreach(var bit in a){
           Console.Write(bit);
       }
       Console.Write("\n");
   }
   string str = ConvertBinaryToText(binary);
   Console.WriteLine(str);//stackoverflow
}</int></int></list></int></list>


以下链接可以帮助您 http: //stackoverflow.com/questions/1300043/convert-a-byte-array-into-datatable [ ^ ]
The following link may help you http://stackoverflow.com/questions/1300043/convert-a-byte-array-into-datatable[^]


这篇关于如何从二进制文件中获取数据并将其显示在c#中的DataGridView中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆