摘要: using System;using System.Collections.Generic;using System.Text;namespace CustomGenericCollection{ #region 汽车的定义 public class Car { public string PetName; public int Speed; public Car(string name, int currentSpeed) { PetName = name; Speed = ... 阅读全文
posted @ 2014-04-09 17:36 liyx0618 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 生成表的实体类工具,有助于减少代码量,加快开发速度.先看效果图第一副图根据输入的连接服务器地址 用户名 登录数据库名 密码连接到数据库.如果错误则提示连接失败.第二幅图先取的当前数据库所有的用户创建的表然后根据选中的表名取得数据库中关于此表信息的的系统表.然后将字段类型转换为C#数据类型.并输出的TextBox这里主要用到几个表select * from sys.extended_properties 表注释 和列注释,列的排列顺序(不带列名)select * from sys.columns 数据库表所有列的详细信息 字段类型,表的字段,名称等select * from sysobjects 阅读全文
posted @ 2013-12-09 16:02 liyx0618 阅读(5190) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Text.RegularExpressions;public class RegexClass { private RegexClass() { } private static RegexClass instance = null; /// /// 静态实例化单体模式 /// 保证应用程序操作某一全局对象,让其保持一致而产生的对象 /// /// public static RegexClass GetInstance() ... 阅读全文
posted @ 2013-12-06 16:25 liyx0618 阅读(336) 评论(0) 推荐(0) 编辑
摘要: Protocol Buffer 阅读全文
posted @ 2013-12-06 10:38 liyx0618 阅读(7744) 评论(0) 推荐(1) 编辑
摘要: Thread目录:目录:1 线程基础的简单介绍2 线程同步与线程异步的简单介绍3 前台线程与后台线程的简单介绍4 细说下Thread 最为关键的构造函数5 细说下Thread 的 Sleep方法6细说下Thread 的 join 方法7细说下Thread 的 Abort和 Interrupt方法8细说下Thread 的 Suspend,Resume方法9简单了解下Thread 的 一些重要属性10简单示例多线程从一个图片中截取部分图片11 本章总结1 线程基础的简单介绍首先让我们翻开书本来了解下线程的一些基础知识:1 线程有时被称为轻量级进程,是程序执行流的最小单元2 线程时由线程ID,当前指 阅读全文
posted @ 2013-10-11 11:31 liyx0618 阅读(368) 评论(0) 推荐(0) 编辑
摘要: C#操作XML方法详解using System.Xml;//初始化一个xml实例XmlDocument xml=new XmlDocument();//导入指定xml文件xml.Load(path);xml.Load(HttpContext.Current.Server.MapPath("~/file/bookstore.xml"));//指定一个节点XmlNode root=xml.SelectSingleNode("/root");//获取节点下所有直接子节点XmlNodeList childlist=root.ChildNodes;//判断该节点下 阅读全文
posted @ 2013-10-09 13:19 liyx0618 阅读(172) 评论(0) 推荐(0) 编辑
摘要: /// /// 执行参数查询/// /// 数据库执行命令/// 数据库链接命令/// 事务/// 查询语句/// 查询参数/// private static void PrepareCommand(SqlCommand cmd, SqlConnection conn, SqlTransaction trans, string cmdText, SqlParameter[] cmdParms) { if (conn.State != ConnectionState.Open) conn.Open(); cmd.Connection = conn; cmd.CommandText = cmdT 阅读全文
posted @ 2013-06-26 09:37 liyx0618 阅读(3769) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;using System.Net;namespace ClaLibrary{ public class FtpInfo { #region 定义 /// <summary> /// FTP连接地址 /// </summary> string ftpServerIP; /// <summary> /// 指定FTP连接成功后的当前目录, 如果不指定即默认为根目录 // 阅读全文
posted @ 2013-04-28 09:01 liyx0618 阅读(218) 评论(0) 推荐(0) 编辑
摘要: Winform获取应用程序的当前路径的方法集合,具体如下,值得收藏//获取当前进程的完整路径,包含文件名(进程名)。stringstr=this.GetType().Assembly.Location;result:X:\xxx\xxx\xxx.exe(.exe文件所在的目录+.exe文件名)//获取新的Process组件并将其与当前活动的进程关联的主模块的完整路径,包含文件名(进程名)。stringstr=System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;result:X:\xxx\xxx\xxx.exe(. 阅读全文
posted @ 2013-02-02 09:55 liyx0618 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 如何选择和运用设计模式 既然能够从众多设计模式中选择,那么如何识别那种设计模式适合自己要解决的问题呢?要弄清楚使用那种设计模式以及如何将解决方案模版应用于具体问题中,重要的是理解一下指导方针。 1、在不了解模式的情况下不能运用它们。首要的是扩大自己的知识面并采用从抽象到具体的方法来学习模式和原则。实现某种模式的方法有很多。看到的模式的不同实现越多,就越能理解模式的目的以及单个模式能够有不同实现。 2、是否有必要引入设计模式的复杂性?通常,开发者在学习设计模式时尝试使用一种模式来解决所有问题。总是需要衡量实现某种模式所需的时... 阅读全文
posted @ 2013-01-22 14:31 liyx0618 阅读(1846) 评论(0) 推荐(0) 编辑