随笔分类 -  .net

摘要:1 /// <summary> 2 /// 3 /// </summary> 4 public class AjaxOnlyAttribute : ActionFilterAttribute 5 { 6 /// <summary> 7 /// Called by the ASP.NET MVC fr 阅读全文
posted @ 2015-06-13 15:49 自然去留 阅读(310) 评论(0) 推荐(0)
摘要:1、在上添加样式:尽量不用内联样式和内部样式使用外部样式表并将它们放在标签下2、把javascript放到body标签的底部在", link); sb.AppendLine(script); } // match the st... 阅读全文
posted @ 2015-06-09 10:48 自然去留 阅读(253) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Reflection;using System.Reflection.Emit;namespace EmitD... 阅读全文
posted @ 2015-05-10 14:08 自然去留 阅读(125) 评论(0) 推荐(0)
摘要:1、新建项目DemoService,并添加windows服务,命名DemoService2、添加代码 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.D... 阅读全文
posted @ 2015-04-11 13:53 自然去留 阅读(1464) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;u... 阅读全文
posted @ 2015-04-08 20:55 自然去留 阅读(867) 评论(0) 推荐(0)
摘要:1、创建项目,添加新项,名称处填写Messages.tt,如下图:添加后,Messages.tt文件内容如下:1 2 2、创建一个实体对象MessageEntry,用以传递模版信息,具体代码如下: 1 public class MessageEntry 2 { 3 p... 阅读全文
posted @ 2014-09-09 14:09 自然去留 阅读(212) 评论(0) 推荐(0)
摘要:1、链接配置 1 2 3 4 NHibernate.Connection.DriverConnectionProvider 5 NHibernate.Driver.SqlClientDriver 6 Server=.;initial ca... 阅读全文
posted @ 2014-09-08 11:21 自然去留 阅读(221) 评论(0) 推荐(0)
摘要:1 using System.Text; 2 using System.Runtime.InteropServices; 3 using System; 4 5 namespace Benson.INI读写 6 { 7 #region INI结构介绍 8 /**... 阅读全文
posted @ 2014-08-11 18:04 自然去留 阅读(244) 评论(0) 推荐(0)
摘要:#region 查找与指定文件关联在一起的程序的文件名 /// /// 查找与指定文件关联在一起的程序的文件名 /// /// 窗口句柄 /// 指定字串“open”来打开lpFlie文档,或指定“Print”来打... 阅读全文
posted @ 2014-08-11 13:33 自然去留 阅读(473) 评论(0) 推荐(0)
摘要:AOP(面向方面编程,是Aspect Oriented Programming的缩写)OOP(面向对象编程,是Object Oriented Programming的缩写)OOD(面向对象设计,是Object Oriented Design的缩写)OOA(面向对象分析方法,是Object-Orien... 阅读全文
posted @ 2014-07-11 15:18 自然去留 阅读(442) 评论(0) 推荐(0)
摘要:1 class controlIme 2 { 3 //声明一些API函数 4 [DllImport("imm32.dll")] 5 public static extern IntPtr ImmGetContext(IntPtr Hwnd);... 阅读全文
posted @ 2014-04-11 10:21 自然去留 阅读(245) 评论(0) 推荐(0)
摘要:要把软件做得非常灵活又要便于维护是一个很困难的事情。灵活的软件他的结构就复杂,维护起来就困难。有得必有失,关键就在于如何处理这两者,使得大于失。软件的设计开发应遵循以下六大原则: 1. OCP 全称:“Open-Closed Principle” 开放-封闭原则 说明:对扩展开放,对修改关闭。 优点... 阅读全文
posted @ 2014-03-31 17:47 自然去留 阅读(182) 评论(0) 推荐(0)
摘要:1 public class CustomDataContext : System.Data.Linq.DataContext 2 where TEntity : class,new() 3 { 4 public CustomDataContext(... 阅读全文
posted @ 2013-08-15 17:58 自然去留 阅读(181) 评论(0) 推荐(0)
摘要:1 public class ChnToPh 2 { 3 //定义拼音区编码数组 4 private static int[] getValue = new int[] 5 { 6 -20319,-20317,-20304,-20... 阅读全文
posted @ 2013-08-06 10:35 自然去留 阅读(474) 评论(0) 推荐(0)
摘要:/// 〈summary〉 /// 汉字转拼音缩写 /// 〈/summary〉 /// 〈param name="str"〉要转换的汉字字符串〈/param〉 /// 〈returns〉拼音缩写〈/returns〉 public string GetPYString(string str) { ... 阅读全文
posted @ 2013-08-06 10:05 自然去留 阅读(728) 评论(0) 推荐(0)
摘要:1 public static void ExportToExcel(DataSet source, string fileName) 2 { 3 System.IO.StreamWriter excelDoc = new System... 阅读全文
posted @ 2013-07-28 10:15 自然去留 阅读(314) 评论(0) 推荐(0)
摘要:public string getCpuInfo() //读取CPU信息 { ManagementClass mobj = new ManagementClass("Win32_Processor"); ManagementO... 阅读全文
posted @ 2013-06-30 21:28 自然去留 阅读(286) 评论(0) 推荐(0)
摘要:引用命名空间:using System.Net;//网络功能 using System.IO;//流支持using System.Threading;//线程支持定义线程下载主体: 1 public class threadbody 2 { 3 Progra... 阅读全文
posted @ 2013-06-21 12:34 自然去留 阅读(514) 评论(0) 推荐(0)
摘要:先看下效果:以下是窗体代码:public partial class Form1 : Form { public Form1() { InitializeComponent(); } string strg;//数据... 阅读全文
posted @ 2013-06-06 14:12 自然去留 阅读(666) 评论(0) 推荐(0)
摘要:protected System.DirectoryServices.DirectoryEntry dirroot; 1、添加新的虚拟目录 DirectoryEntry newVirDir = dirroot.Children.Add("Webtest","IIsWebVirtualDir"); n... 阅读全文
posted @ 2013-05-18 21:40 自然去留 阅读(120) 评论(0) 推荐(0)