上一页 1 2 3 4 5 6 7 8 9 ··· 19 下一页
摘要: 靠,原来是byte Array,这个好像很简单的呀 int s = 100;byte[] shi = System.BitConverter.GetBytes(s);int sh = System.BitConverter.ToInt32(shi,0); 阅读全文
posted @ 2012-03-26 21:10 晴天有时下鱼 阅读(392) 评论(0) 推荐(0)
摘要: 在c#中把int转成byte[]一般都会使用BitConverter.GetBytes可以获取得到,但BitConverter有个问题就是每次调用都会产生一个新byte[];如果你比较执着的话以下提供两种方式可以省下这一些。 从BitConverter中把代码偷取出来,加功一下:),先看下BitConverter.GetBytes关于int的方法public unsafe static byte[] GetBytes(int value){ byte[] array = new byte[4]; fixed (byte* ptr = array) { *(int*)ptr ... 阅读全文
posted @ 2012-03-26 20:55 晴天有时下鱼 阅读(329) 评论(0) 推荐(0)
摘要: 在C#中,如何将一个int转换成一个byte array,又如何将一个byte array转换成一个int 至少可以通过三种方法来进行转换。在.NET Framework类库的System名字空间中有个叫做BitConverter的类,它是专门用来进行这种转换的。它有一个GetBytes方法,对于大多数简单的类型来说,该方法都被重载了,它可以返回一个byte array来保存你传递的值。它也有几个ToTypeName方法用来将一个byte array转换成一个基本类型(primitive type):byte[] b = BitConverter.GetBytes( 0xba5eba11 ). 阅读全文
posted @ 2012-03-26 20:45 晴天有时下鱼 阅读(247) 评论(0) 推荐(0)
摘要: usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Data;usingSystem.Reflection;///<summary>///LinqToDataTableType///</summary>publicstaticclassDataSetLinqOperators{publicstaticDataTableCopyToDataTable<T>(thisIEnumerable<T>source){returnne 阅读全文
posted @ 2012-03-26 17:14 晴天有时下鱼 阅读(327) 评论(0) 推荐(0)
摘要: http://www.cnblogs.com/baihmpgy/ 阅读全文
posted @ 2012-03-26 11:57 晴天有时下鱼 阅读(112) 评论(0) 推荐(0)
摘要: http://www.cnblogs.com/doubleliang/tag/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/ 阅读全文
posted @ 2012-03-26 11:49 晴天有时下鱼 阅读(150) 评论(0) 推荐(0)
摘要: http://www.gtalkme.com/ 阅读全文
posted @ 2012-03-22 08:19 晴天有时下鱼 阅读(128) 评论(0) 推荐(0)
摘要: http://blog.csdn.net/byxdaz 阅读全文
posted @ 2012-03-21 11:20 晴天有时下鱼 阅读(141) 评论(0) 推荐(0)
摘要: C#串口通信总结 我们知道对于标准DLL,可以采用DllImport进行调用。例如: [DllImport("KMY350X.dll")]private static extern int OpenPort(int PortNum, int BaudRate); 如果一些厂家比较懒的话,没有提供相应的dll,我们只能对它进行串口通信编程了。以前从没接触过串口编程,最近在一个项目中有几个地方都需要采用串口通信,跟公司一个老手请教后,感觉学到了很多东西,特在此做个总结: 一:首先我们来认识下什么是串口: 右键 我的电脑-管理-设备管理器-端口,选择一个端口,点击属性。 我们可以 阅读全文
posted @ 2012-03-21 11:19 晴天有时下鱼 阅读(416) 评论(0) 推荐(0)
摘要: WinForm中的窗体传值的多种方法WinForm中的窗体传值有多种方法,自己结合相关资料总结了一下,大概有4种方式(或者更多):1、通过 ShowDialog()进行传值;2、通过改造构造函数进行传值(加参数);3、通过公共静态类进行传值;4、通过绑定事件进行传值;代码如下:主窗体代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.For 阅读全文
posted @ 2012-03-21 11:10 晴天有时下鱼 阅读(365) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 19 下一页