
数据类型
alisa525
这个作者很懒,什么都没留下…
展开
-
日期格式字符串,string.Format
string s = ""; DateTime dt = DateTime.Now; s = dt.GetDateTimeFormats('s')[0].ToString();// s = string.Format("{0:yyyy-MM-dd HH:mm:ss ffff}", dt); //2012-03-2原创 2012-03-14 12:56:14 · 929 阅读 · 0 评论 -
按位“或”运算符在带符号扩展操作数上使用;请考虑首先强制转换为较小的无符号类型
按位“或”运算符在带符号扩展操作数上使用;请考虑首先强制转换为较小的无符号类型 错误: long r = 0; r |= (buf[i] & 0x00000000000000ff);正确: long r = 0; r |= Convert.ToInt64((buf[i] & 0x00000000000000ff)); 先转换为long型再执行或运算或者 r转载 2012-06-05 15:18:36 · 3976 阅读 · 0 评论 -
C#中.tostring(X2)的用法
C#中.tostring(X2)的用法X 十六进制 ,X是大写,x是小写2 每次都是两位数比如 0x0A 如果没有2,就只会输出0xA 如果两个数10和26,正常情况十六进制显示0xA、0x1A,这样看起来不整齐,为了好看,我们可以指定X2,这样显示出来就是:0x0A、0x1A。转载 2011-12-13 15:16:52 · 2888 阅读 · 0 评论 -
创建DataTable DataSet
#region createTable private DataTable createTable(int colCount,int rowCount) { DataTable table = new DataTable(); table.TableName = "示例表";原创 2012-07-16 10:57:50 · 701 阅读 · 0 评论 -
字典类Dictionary复制
1、实现拷贝一份Dictionary数据的类 遍历原始Dictionay结构和数据进行赋值工作,性能很差,通过序列化和反序列化的方式来完成数据对象的深度拷贝工作,这种方式快速高效 [Serializable] public class DictionaryCloneable : Dictionary,IDictionary, ICloneable {原创 2013-01-17 16:52:39 · 8712 阅读 · 0 评论 -
int 与 byte[] 的相互转换
int 与 byte[] 的相互转换1. 最普通的方法从byte[] 到 uint b = new byte[] {0xfe,0x5a,0x11,0xfa};u = (uint)(b[0] | b[1] 从int 到 byte[]b[0] = (byte)(u);b[1] = (byte)(u >> 8);b[2] = (byte)(u >> 16);b[3转载 2013-04-24 13:24:24 · 675 阅读 · 0 评论