随笔分类 -  c#学习

摘要://要被分数组string[] arr = new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11" }; List<List<string>> data = new List<List<string>>(); int group = 6;//分成 阅读全文
posted @ 2019-08-21 14:07 白羽轻飘 阅读(5779) 评论(1) 推荐(0)
摘要:1 添加引用: NPOI NPOI.OOXML 2 阅读全文
posted @ 2018-05-17 15:48 白羽轻飘 阅读(308) 评论(0) 推荐(0)
摘要:1 例如有同步方法如下: 2 变为异步方法 阅读全文
posted @ 2018-05-17 10:50 白羽轻飘 阅读(1579) 评论(0) 推荐(0)
摘要:public abstract class MirAPIUnitTestCommon { public abstract string GetBaseAddress(); /// /// CRUD /// /// /// /// protected ... 阅读全文
posted @ 2018-04-10 12:48 白羽轻飘 阅读(568) 评论(0) 推荐(0)
摘要:1 npoi版本2.1.3.1 2 需要添加的引用: using NPOI.SS.UserModel;using NPOI.XSSF.UserModel;using System.IO;using NPOI.HSSF.UserModel;using NPOI.POIFS.FileSystem;usi 阅读全文
posted @ 2017-12-08 13:29 白羽轻飘 阅读(10322) 评论(1) 推荐(1)
摘要:object request = null; string requestObjClassName = "命名空间" + 类型.ToString(); Type type = Type.GetType(requestObjClassName); object[] a... 阅读全文
posted @ 2017-11-28 11:41 白羽轻飘 阅读(120) 评论(0) 推荐(0)
摘要:AppDomain.CurrentDomain.BaseDirectory 阅读全文
posted @ 2017-11-17 10:24 白羽轻飘 阅读(1920) 评论(0) 推荐(0)
摘要:using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace WebAPIServer.... 阅读全文
posted @ 2017-11-16 18:16 白羽轻飘 阅读(6198) 评论(0) 推荐(0)
摘要:1利用反射 如何判断传递进来的参数是否实现了某个接口 Type t=object.GetType() if(t.GetInterface("ITest")!=null) { } 2 利用反射获取类型 Type t=Type.GetType("System.String") 3 如何根据类型来动态的创 阅读全文
posted @ 2017-11-15 10:20 白羽轻飘 阅读(170) 评论(0) 推荐(0)
摘要:public static T XmlToObject<T>(string str) where T : class { using (Stream stream = new MemoryStream()) { byte[] data = System.Text.Encoding.UTF8.GetB 阅读全文
posted @ 2017-09-12 11:51 白羽轻飘 阅读(140) 评论(0) 推荐(0)
摘要:public static string ObjectToXml(object obj) { using (MemoryStream memoryStream = new MemoryStream()) using (StreamReader reader = new StreamReader(me 阅读全文
posted @ 2017-09-12 10:07 白羽轻飘 阅读(142) 评论(0) 推荐(0)
摘要:1 c# 代码 using (SqlConnection con = GetEditorConnection()) { con.Open(); using (SqlCommand command = con.CreateCommand()) { SqlTransaction st = con.Beg 阅读全文
posted @ 2017-06-16 10:27 白羽轻飘 阅读(853) 评论(0) 推荐(0)
摘要:1 例如当我在编辑表格数据,一次编辑了多行需要保存到数据库时,就需要判断数据库中是否已经存在,存在则修改,不存在则新增一条或多条数据,即所谓批量增加或者跟新数据。 首先需要构建数据包,把要添加或者跟新的数据构建成一个datatable,例如我数据库中的表结构是这样 CREATE TABLE [dbo 阅读全文
posted @ 2016-09-08 15:41 白羽轻飘 阅读(4761) 评论(0) 推荐(0)
摘要:1 下面是我写的一个序列化的类 public static class ObjSerialize { /// <summary> /// 将对象数组obj序列化,内存中的缓冲区的数据序列化 /// </summary> /// <param name="obj"></param> /// <retu 阅读全文
posted @ 2016-08-25 19:09 白羽轻飘 阅读(4117) 评论(0) 推荐(0)