随笔分类 -  C#

摘要:废话不多说,直接上代码 复制可 1 internal class NewExpressionVisitor : ExpressionVisitor 2 { 3 public ParameterExpression _NewParameter { get; private set; } 4 publi 阅读全文
posted @ 2019-01-19 15:56 JasonGu0 阅读(1790) 评论(0) 推荐(0)
摘要:首先需要引用程序集 Microsoft Script Control 1.0然后新建一个js文件,并写入相应的js方法//执行JS文件 private void btnjs_Click(object sender, EventArgs e) { //... 阅读全文
posted @ 2015-01-24 11:11 JasonGu0 阅读(10954) 评论(0) 推荐(1)
摘要:public static int Asc(string character) { if (character.Length == 1) { System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding... 阅读全文
posted @ 2015-01-16 12:44 JasonGu0 阅读(1096) 评论(1) 推荐(0)
摘要:#region 分钟数转换成倒计时,格式 _天_时_分 + string MinutesToCountdown(int Minutes) /// /// 将分钟数转换成倒计时 格式:_天_时_分 /// /// 分钟数 //... 阅读全文
posted @ 2015-01-05 09:54 JasonGu0 阅读(423) 评论(0) 推荐(0)
摘要://定义类 public class MyClass { public int Property1 { get; set; } public string Property2 { get; set; } } MyClass tmp_Clas... 阅读全文
posted @ 2014-12-25 16:39 JasonGu0 阅读(393) 评论(0) 推荐(0)
摘要:public static class ChineseToPinYin { private static readonly Dictionary CodeCollections = new Dictionary {{ -20319, "a" }, { -20317, "... 阅读全文
posted @ 2014-12-23 13:15 JasonGu0 阅读(430) 评论(0) 推荐(0)
摘要:using System.Collections.Generic;using System.Collections.ObjectModel;using System.Linq;using System.Text;using Microsoft.International.Converters.Pin... 阅读全文
posted @ 2014-12-03 14:05 JasonGu0 阅读(299) 评论(0) 推荐(0)
摘要:usingSystem; usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingMicrosoft.CSharp;usingSystem.CodeDom.Compiler;usingSystem.Reflecti... 阅读全文
posted @ 2014-11-03 23:45 JasonGu0 阅读(2131) 评论(0) 推荐(0)
摘要:usingSystem;usingSystem.Reflection;usingSystem.Globalization;usingMicrosoft.CSharp;usingSystem.CodeDom;usingSystem.CodeDom.Compiler;usingSystem.Text;n... 阅读全文
posted @ 2014-11-03 22:27 JasonGu0 阅读(286) 评论(0) 推荐(0)
摘要:C#利用反射,遍历获得一个类的所有属性名,方法名,成员名 mogo41572013-05-1812:49Typet=typeof(System.Drawing.Color);//获取所有方法System.Reflection.MethodInfo[]methods=t.GetMethods();//... 阅读全文
posted @ 2014-11-03 21:30 JasonGu0 阅读(555) 评论(0) 推荐(0)
摘要:格式说明符 说明 示例 输出 C 货币 2.5.ToString("C") ¥2.50 D 十进制数 25.ToString("D5") 00025 E 科学型 25000.ToString("E") 2.500000E+005 F 固定点 25.ToString("F2") 25.00 G 常规 ... 阅读全文
posted @ 2014-05-12 11:13 JasonGu0 阅读(282) 评论(0) 推荐(0)
摘要:定义一个枚举: private enum myType { a = 1, b = 2, c = 3, lao = 4 }//字符串转枚举 bool TryParse = Enum.IsDefined(typeof(myType), "a"); if (TryParse) { object m = Enum.Parse(typeof(myType), "c"); myType t = (myType)m; }//枚举转字符串myType.a.... 阅读全文
posted @ 2014-03-28 16:13 JasonGu0 阅读(1107) 评论(0) 推荐(0)
摘要:public static DataSet ToDataSetByStream(string Stream) { DataSet ds = new DataSet(); StringReader str = new StringReader(Stream); XmlTextReader xm = new XmlTextReader(str); ds.ReadXml(xm); return ds; } 阅读全文
posted @ 2014-02-12 17:28 JasonGu0 阅读(507) 评论(0) 推荐(0)
摘要:/// /// 将List集合 转换成 DataTable /// /// sellerSearchDealList是我自己定义的一个类 public static DataTable ListToTable(List entitys) { DataTable dtresult = new DataTable(); if (entitys == null || entitys.Count < 1) { throw new ... 阅读全文
posted @ 2014-02-12 17:27 JasonGu0 阅读(646) 评论(0) 推荐(0)
摘要:http://www.cnblogs.com/jljxxf/archive/2012/08/19/2646937.html调用资源//定义一个类using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Drawing;using System.IO;using System.Reflection;namespace MyImg{ public static class ImageObject { /// /// 得到要绘置... 阅读全文
posted @ 2014-02-08 08:57 JasonGu0 阅读(801) 评论(0) 推荐(0)
摘要:/// /// 将List集合 转换成 DataTable /// /// sellerSearchDealList是我自己定义的一个类 public static DataTable ListToTable(List entitys) { DataTable dtresult = new DataTable(); if (entitys == null || entitys.Count < 1) { throw n... 阅读全文
posted @ 2014-02-05 16:08 JasonGu0 阅读(235) 评论(0) 推荐(0)
摘要:StringReader str = new StringReader(字节流); XmlTextReader xm = new XmlTextReader(str); DataSet ds = new DataSet(); ds.ReadXml(xm); 阅读全文
posted @ 2014-01-26 14:25 JasonGu0 阅读(339) 评论(0) 推荐(0)
摘要:var stringlist = new List();//string List var objlist = new List(); //object List objlist.Add("abc"); objlist.Add(321); objlist.Add("啊不才"); objlist.Add('x'); //转换为List stringlist=objlist.ConvertAll(c => { return... 阅读全文
posted @ 2014-01-19 14:44 JasonGu0 阅读(4157) 评论(0) 推荐(0)
摘要:去掉该字符串中最后一个分隔符strComma是分隔符 if (str.Substring(str.Length - strComma.Length, strComma.Length) == strComma) { return str.Substring(0, str.Length - strComma.Length); }如果能保证该字符串的结尾一定是这个分隔符,那么也可以这样写 int index = str.LastIndexOf(strComma); return str.Substring... 阅读全文
posted @ 2014-01-11 16:38 JasonGu0 阅读(1034) 评论(0) 推荐(0)
摘要:/// /// 返回按AddDays拆分的时间段(包含多个逗号隔开) /// public static string StrTimes(DateTime starttime, DateTime endtime, int AddDays) { DateTime nowtime = starttime; string strtimes = starttime.ToString("yyyy-MM-dd HH:mm:ss") + ","; do { ... 阅读全文
posted @ 2014-01-04 17:17 JasonGu0 阅读(1546) 评论(0) 推荐(0)