摘要:
///// <summary> ///// 生成相对路径 是根据ID填充12位字符,拆分四层路径 ///// </summary> ///// <param name="AssociateID">相关ID</param> ///// <param name="fileName">文件名称</param> ///// <returns></returns> protected virtual string ... 阅读全文
随笔分类 - c#
Action Func delegate
2012-02-27 11:46 by 通心菜, 267 阅读, 收藏, 编辑
摘要:
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class Program { delegate void D1(string name); static Action<string> A1; static Func<string,string> F1; static void Main(string[] args) {... 阅读全文
MVC3.0入门学习笔记-页面传值-ViewData
2011-06-14 11:09 by 通心菜, 2626 阅读, 收藏, 编辑
摘要:
MVC 模式一个典型的特征是严格的功能隔离。Model模型、Controller 控制器和 View视图各自定义了用和职责,且相互之间定义好的方式进行沟通。这有助于提升测试性和代码重用。 当 Controller 决定呈现HTML 响应给客户端是,它负责显式传递给View 模板所有需要的数据。View 模从不执行任何数据查询或应用程序逻辑 – 仅仅负责呈现 Model或 Controller 传递过来的数据。1.ViewData[]字典: 简单的传值 首先我们在控制器HomeController.cs中创建一个ViewData[]字典: public ActionResult Index() 阅读全文
线程安全类 跨线程修改窗体UI
2011-01-06 17:05 by 通心菜, 559 阅读, 收藏, 编辑
摘要:
private void ThreadSafeInvoke(Control control, MethodInvoker invoker) { if (control.InvokeRequired) { control.Invoke(invoker); } else { invoker(); } }调用:匿名方法 //设置文本 ThreadSafeInvoke(this,delegate() { int Cnt = int.Parse(this.listView1.Items[RuleDic[regDetail.SiteID].RowIndex].SubItems[2].Text); Cnt+ 阅读全文
c# zip压缩类
2010-08-24 15:28 by 通心菜, 4340 阅读, 收藏, 编辑
摘要:
使用ICSharpCode.SharpZipLib.dll; 下载地址 http://www.icsharpcode.net/OpenSource/SharpZipLib/Download.aspx 阅读全文
DateTime格式
2009-06-16 11:49 by 通心菜, 4578 阅读, 收藏, 编辑
摘要:
DateTime.Now.ToShortTimeString() DateTime dt = DateTime.Now; dt.ToString();//2005-11-5 13:21:25 dt.ToFileTime().ToString();//127756416859912816 dt.ToFileTimeUtc().ToString();//127756704859912816 dt.To... 阅读全文