博 之 文

以 拼 搏 设 计 梦 想 , 以 恒 心 编 程 明 天
  首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

文章分类 -  C#

摘要:string str = "2007年7月8日";DateTime dt = Convert.ToDateTime( str );System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB");string res = dt.ToString("m"); /** Output. * * d :08/17/2000 * D :Thursday, August 17, 2000 * f :Thursda 阅读全文

posted @ 2014-03-12 10:38 IsNull_Soft 阅读(272) 评论(0) 推荐(0)

摘要:在做Asp.Net MVC项目中,都知道View负责页面展示数据或者提供页面收集数据,而所展示的数据或者收集的数据都是从Controller的Action中获取或提交到Controller的Action。这里的数据,可能是基础类型,或者是Model,或者是Model的部分内容,或者是集合比如List或Dictionary。数据从View传递到Controller的Action时,有几种方式,RouteData(url中的路由数据),QueryString(http get的查询参数如?page=2),Forms(表单post的数据), 或者ajax交互的json数据。而在Controller的 阅读全文

posted @ 2014-02-20 10:44 IsNull_Soft 阅读(287) 评论(0) 推荐(0)

摘要:方法一:/// <summary> 2 /// 中文字符工具类 3 /// </summary> 4 private const int LOCALE_SYSTEM_DEFAULT = 0x0800; 5 private const int LCMAP_SIMPLIFIED_CHINESE = 0x02000000; 6 private const int LCMAP_TRADITIONAL_CHINESE = 0x04000000; 7 8 [DllImport("kernel32", CharSet = CharSet.Auto, SetL... 阅读全文

posted @ 2013-05-28 16:40 IsNull_Soft 阅读(296) 评论(0) 推荐(0)

摘要:简介其实已经有许多用来解析JSON格式数据的库了,为什么我们还想要再创造一个呢?因为.NET 4.0框架引入了一个新的类型:dynamic!背景dynamic实际上是一个静态类型,但是编译器看待它与其它的类型不同。编译器遇到dynamic类型时不会作任何的类型安全检查(绕过了静态类型检查)例如:view sourceprint?01 class Program02 {03 static void Main(string[] args)04 {05 func(1); // 'int' does not contain a d... 阅读全文

posted @ 2013-01-25 11:19 IsNull_Soft 阅读(601) 评论(0) 推荐(0)

摘要://后台C#获取所有的所有控件textbhoxprotected void Button1_Click(object sender, EventArgs e) { Dictionary<String, String> list = new Dictionary<String, String>(); //获取窗口的所有textbox foreach (Control con in this.Form.Controls) { if (con is TextBox) { ... 阅读全文

posted @ 2012-12-05 17:58 IsNull_Soft 阅读(482) 评论(0) 推荐(0)

摘要:private int ColumnToIndex(string column) { if (!Regex.IsMatch(column.ToUpper(), @"[A-Z]+")) { throw new Exception("Invalid parameter"); } int index = 0; char[] chars = column.ToUpper().ToCharArray(); for (int i = 0; i < chars.Length; i++) ... 阅读全文

posted @ 2012-11-28 16:24 IsNull_Soft 阅读(228) 评论(0) 推荐(0)

摘要:using System;public class Example{ public static void Main() { // Create array of 5-tuples with population data for three U.S. cities, 1940-1950. Tuple<string, DateTime, int, DateTime, int>[] cities = { Tuple.Create("Los Angeles", new DateTime(1940, 1, 1), 1504277, ... 阅读全文

posted @ 2012-07-11 15:41 IsNull_Soft 阅读(265) 评论(0) 推荐(0)

摘要:抽象(abstract)方法在逻辑上类似于虚方法,只是不能像虚方法那样被调用,是一个接口的声明而非实现。抽象方法没有方法实现,也不允许这样做。抽象方法同样不能是静态的。含有抽象方法的类一定是抽象类,也一定要加abstract类修饰符。但抽象类并不一定要含有抽象方法。继承含有抽象方法的抽象类的子类必须覆盖并实现(直接使用override)该方法,或者组合使用abstract override使之继续抽象,或者不提供任何覆盖和实现,后两者的行为是一样的 阅读全文

posted @ 2012-07-09 11:06 IsNull_Soft 阅读(617) 评论(0) 推荐(0)