随笔分类 -  c#

c#基础知识学习
C#检测两个文件内容是否相同
摘要:不知道为什么对Excel 2010 xlsx后缀的文件没有效果,求解!对其他文件有效,如.txt,.csv 1 using System; 2 using System.Security.Cryptography; 3 using System.IO; 4 5 namespace CheckFile 6 { 7 class Program 8 { 9 static void Main(string[] args)10 {11 string filePath1 = @"D:/1.txt";12 st... 阅读全文

posted @ 2013-12-26 17:13 程序猴chengxuhou.com 阅读(1084) 评论(0) 推荐(0)

NUnit.Framework的使用方法演示
摘要:1 using NUnit.Framework; 2 3 namespace CheckExcel 4 { 5 [TestFixture] 6 public class TestExcelHelper 7 { 8 /// 9 /// 文件名10 /// 11 string fileName1 = @"D:\Test\a.xlsx";12 string fileName2 = @"D:\Test\c.xlsx";13 14 /// 15 /// 测试方法1... 阅读全文

posted @ 2013-12-26 13:42 程序猴chengxuhou.com 阅读(901) 评论(0) 推荐(0)

C#(ASP.NET)隐藏或显示Excel中指定列
摘要:今天写的一个方法,实现Excel指定列的隐藏和显示:环境:VS2010,OFFICE 2010代码:#region 隐藏和显示Excel中的一列 /// /// Author:闵向阳 /// 隐藏Excel中的一列 /// /// Excel路径名 /// 隐藏的是第几列数 /// 是否隐藏 public void HiddenColumn(string fileName,int columnIndex,bool flag) { Excel._Application xlapp; Excel.Workbook xlwbk; Excel.Worksheet xlwst; xlapp = ne.. 阅读全文

posted @ 2013-12-23 17:14 程序猴chengxuhou.com 阅读(2570) 评论(0) 推荐(1)

两张Excel表比较,两个for循环比较优化使用Contains
摘要:将一个Excel表中的sheet中的一列导出到List,用一个for循环循环另一张表中的数据,看是否在第一张表中的Contains中 阅读全文

posted @ 2013-12-20 08:56 程序猴chengxuhou.com 阅读(841) 评论(0) 推荐(0)

吾爱破解论坛有漏洞!!所有资源都曝光了...开心吧
摘要:吾爱破解论坛有漏洞!!所有资源都曝光了...开心吧....把整个论坛的资源都下载了....我不是故意的....漏洞就不说了..等着他们自己发现吧..这是真的... 阅读全文

posted @ 2013-11-04 12:58 程序猴chengxuhou.com 阅读(852) 评论(0) 推荐(0)

C#使用Lock访问共享数据的问题
摘要:lock 语句(C# 参考)lock 关键字将语句块标记为临界区,方法是获取给定对象的互斥锁,执行语句,然后释放该锁。此语句的形式如下:复制Object thisLock = new Object();lock (thisLock){ // Critical code section}有关更多信息,请参见 线 程同步(C# 编程指南)。备注lock 确保当一个线程位于代码的临界区时,另一个线程不进入临界区。如果其他线程试图进入锁定的代码,则它将一直等待(即被阻止),直到该对象被释放。线 程处理(C# 编程指南) 这节讨论了线程处理。lock 调用块开始位置的 Enter 和块结束位置的 ... 阅读全文

posted @ 2013-09-14 07:17 程序猴chengxuhou.com 阅读(519) 评论(0) 推荐(0)

SQL实现分页存储过程
摘要:SQL分页存储过程的编写: 1 --获得分页的DATASET资源 2 ALTER PROC sp_GetSource( 3 @PageSize INT, --每页显示条数 4 @PageIndex INT, --页码(从1开始) 5 @RowCount INT OUTPUT, --数据总数 6 @PageCount INT OUTPUT--总页数 7 ) 8 AS 9 BEGIN10 --获取数据总数11 SELECT @RowCount = COUNT(*)12 FROM [tblUser]13 --计算总页数14 SET... 阅读全文

posted @ 2013-09-10 22:19 程序猴chengxuhou.com 阅读(226) 评论(0) 推荐(0)

SQL模糊查找
摘要:编辑器加载中.../*********************实现模糊查找**************************/SELECT [UserId] ,[UserName] ,[UserLoginName] ,[UserLoginPwd] ,[RoleId] FROM [DBDemo].[dbo].[tblUser]--****************[%]转义********************where username like '%[%]'SELECT [UserId] ,[UserName] ,[UserLo... 阅读全文

posted @ 2013-09-10 13:42 程序猴chengxuhou.com 阅读(310) 评论(0) 推荐(0)

C语言指针
摘要:10 指针 指针是C语言中广泛使用的一种数据类型。运用指针编程是C语言最主要的风格之一。利用指针变量可以表示各种数据结构;能很方便地使用数组和字符串;并能象汇编语言一样处理内存地址,从而编出精练而高效的程序。指针极大地丰富了C语言的功能。学习指针是学习C语言中最重要的一环,能否正确理解和使用指针是我们是否掌握C语言的一个标志。同时,指针也是C语言中最为困难的一部分,在学习中除了要正确理解基本概念... 阅读全文

posted @ 2013-08-11 12:13 程序猴chengxuhou.com 阅读(1554) 评论(0) 推荐(0)

C#命令模式实例代码
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 命令模式{ class Program { static void Main(string[] args) { Receiver r = new Receiver(); Command c = new ConcreteCommand(r); Invoker i = new Invoker(); ... 阅读全文

posted @ 2013-05-31 10:52 程序猴chengxuhou.com 阅读(3181) 评论(0) 推荐(0)

C#装饰者模式实例代码
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 装饰者{ class Program { static void Main(string[] args) { ConcreteComponent con = new ConcreteComponent(); ConcreteDecoratorA a = new ConcreteDecoratorA(); a.... 阅读全文

posted @ 2013-05-31 10:33 程序猴chengxuhou.com 阅读(2586) 评论(0) 推荐(1)

C#适配器模式代码
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 适配器{ class Program { static void Main(string[] args) { Dog dog = new DogAdapter(new Robot()); } public abstract class Dog { public abstract void ... 阅读全文

posted @ 2013-05-31 09:41 程序猴chengxuhou.com 阅读(439) 评论(0) 推荐(0)

vs批量删除代码中的所有空行
摘要:使用查找替换:^:b*$\n选择正则表达式替换为空白 阅读全文

posted @ 2013-05-31 09:35 程序猴chengxuhou.com 阅读(394) 评论(0) 推荐(0)

向string,int,类对象等中扩展方法
摘要:1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace ConsoleApplication1 7 { 8 class Program 9 {10 static void Main(string[] args)11 {12 string s = "sss";13 s.Res();14 /**************... 阅读全文

posted @ 2013-05-29 09:28 程序猴chengxuhou.com 阅读(502) 评论(0) 推荐(0)

ASP.Net 中Application的用法
摘要:1.Application的创建 Application["application名称"] = "application的值";2.Application的使用 string str = Application["application名称"];PS:常用的属性和方法 All返回全部的Application对象变量到一个对象数组AllKeys返回全部的Application对象变量到一个字符串数组Count取得Application中对象变量的数量ItemApplication变量名称传回的内容值Add新增一个Application变 阅读全文

posted @ 2013-02-20 15:49 程序猴chengxuhou.com 阅读(593) 评论(0) 推荐(0)

c# xml读写操作实例
摘要:c# xml读写 操作 实例 阅读全文

posted @ 2012-11-26 01:20 程序猴chengxuhou.com 阅读(450) 评论(0) 推荐(0)

导航