摘要: 一、排序 char[] tmp = str.ToArray();Array.Sort(tmp); //按ASCII排序 二、字节数组转换为ASCII字符串 // 字节数组 byte[] ba = new byte[] { 119,104,97,116,50,49,46,99,111,109 }; / 阅读全文
posted @ 2021-09-27 16:46 不溯流光 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 一、用法 1、排序 //字典按键值升序排序dic = dic.OrderBy(p => p.Key).ToDictionary(p => p.Key, o => o.Value); //字典按键值降序排序 dic = dic.OrderByDescending(p => p.Key).ToDicti 阅读全文
posted @ 2021-09-27 16:44 不溯流光 阅读(504) 评论(0) 推荐(0) 编辑
摘要: 一、ArrayList转换为数组 (1)方法1 ArrayList List = new ArrayList(); Int32[] values = (Int32[])List.ToArray(typeof(Int32)); (2)方法2 ArrayList List = new ArrayList 阅读全文
posted @ 2021-09-27 16:36 不溯流光 阅读(56) 评论(0) 推荐(0) 编辑
摘要: 一、将List复制到另一个List 1、值类型的List List<T> newList = oldList.GetRange(index, count); 或者 List<T> newList = new List<T>(oldList); 2、引用类型的List(深度复制) 利用System.X 阅读全文
posted @ 2021-09-27 16:26 不溯流光 阅读(1113) 评论(0) 推荐(0) 编辑