http://bbs.csdn.net/topics/20447859

byte[] bytes = new byte[256];
//receive some stream from network

int a,b,c,d;
string theStr;

a = (int)bytes[0];
b = (int)bytes[1];
c = (int)bytes[2];
d = (int)bytes[3];

byte[] newBytes = byte[bytes.Length-4];
for( int i=0;i<newBytes.Length;i++ )
  newBytes[i] = bytes[i+4];

theStr = System.Text.Encoding.Default.GetString( newBytes );  //注意你接受的字符串的编码,根据编码这里要使用不同的编码来获得字符串

//如果字符串是已','分割
string[] stringValues = theStr.Split( ',' );

//stringValues这个数组就是分割后的各个字符串

C#中如何把byte[]数组转换成其他类型的更多相关文章

  1. 获取网络图片并显示在picturbox上,byte[]数组转换成Image:

    private void getWebPicture_Click(object sender, EventArgs e) { WebRequest request = WebRequest.Creat ...

  2. Java中如何将字符串数组转换成字符串

    如果将“字符串数组”转换成“字符串”,只能通过循环,没有其他方法: public static String getExecSqlString(String str){ StringBuffer sb ...

  3. js中如何将伪数组转换成数组

    伪数组:不能调用数组的方法, 1.对象是按索引方式存储数据的 2.它具备length属性 {0:'a',1:'b',length:2} //es5伪数组转换成数组 let args = [].slic ...

  4. $.toJSON的用法或把数组转换成json类型

    1. html页面全部代码 <html> <head>     <title></title> <script src="../../S ...

  5. C# byte数组转换成List<String>

    byte[] bys=buffer; string[] AllDataList=  Encoding.Default.GetString(bys).Split(Environment.NewLine. ...

  6. java中如何将字符串数组转换成字符串(转)

    如果是 “字符串数组” 转 “字符串”,只能通过循环,没有其它方法 String[] str = {"abc", "bcd", "def"} ...

  7. Java中为什么long能自动转换成float类型

    刷题时候看到一个float和long相互转换的问题,float向long转换的时候不会报错,一个4个字节一个8个字节,通过baidu找到了答案. 下面转载自http://blog.csdn.net/s ...

  8. JAVA中文件与Byte数组相互转换的方法

    JAVA中文件与Byte数组相互转换的方法,如下: public class FileUtil { //将文件转换成Byte数组 public static byte[] getBytesByFile ...

  9. Java中字符串和byte数组之间的相互转换

    1.将字符转换成byte数组 String str = "罗长"; byte[] sb = str.getBytes(); 2.将byte数组转换成字符 byte[] b={(by ...

随机推荐

  1. 84. Largest Rectangle in Histogram *HARD* -- 柱状图求最大面积 85. Maximal Rectangle *HARD* -- 求01矩阵中的最大矩形

    1. Given n non-negative integers representing the histogram's bar height where the width of each bar ...

  2. MySQL--Workbench表及表种数据导出

    MySQL--Workbench表及表种数据导出 1.-->点击Management,--->出现Navigator. 2.点击Date Export,选择导出的库. 3)选择库中的某个表 ...

  3. IOS7 UI设计的十大准则

    陈子木 iOS7 的用户界面设计比以往更卓越,并为用户提供了更具吸引力的独特体验,带来更大的机遇.在正式写代码之前,认真考虑UI设计是否符合这十条设计准则,可以提高App的可用性与吸引力.如果要更深入 ...

  4. Wifi Troughput Test using iperf

    learning wifi throughput test using iperf [Purpose]        Learning how to do wifi throughput test u ...

  5. 3.strcpy使用注意(3)

    void test3(char * str1) { if(str1==NULL) { return; } char string[10]; if(strlen(str1)<=10) { strc ...

  6. selenium(一)简介,安装,配置,测试。

    简介: Selenium也是一个用于Web应用程序测试的工具.Selenium测试直接运行在浏览器中,就像真正的用户在操作一样.支持的浏览器包括IE.Mozilla Firefox.Mozilla S ...

  7. pyinstall 把你的程序变成windows的可执行程序。py exe UPX

    我们先看一下这个官方文档 http://pythonhosted.org/PyInstaller/ 其实常用的也就是两句 pyinstall ***.py pyinstall -F ***.py 一: ...

  8. mysql server查询客户端连接数

    SELECT substring_index(HOST, ) AS host_name, state, count(*) FROM information_schema. PROCESSLIST GR ...

  9. The "Double-Checked Locking is Broken" Declaration

    双重检查锁定在延迟初始化的单例模式中见得比较多(单例模式实现方式很多,这里为说明双重检查锁定问题,只选取这一种方式),先来看一个版本: public class Singleton { private ...

  10. 使用emma时遇到的一些问题

    今天在用使用emma的过程中遇到了几个问题,记录一下. 1.跑junit过程中没办法产生coverage data文件,导致最后没办法出emma报告,上官网查了一下原因如下: I have instr ...