
C#基础
文章平均质量分 52
HCW881007
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C#递归遍历
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;using System.Threading;using System.Text.RegularExpressions;using System.Collections;原创 2013-03-09 01:12:07 · 890 阅读 · 0 评论 -
使用NPOIl操作Excel
//写入excel public void Inser() { using (FileStream file = new FileStream("3.xls", FileMode.Open, FileAccess.ReadWrite)) { HSSFWorkbook hssfw原创 2013-09-10 21:33:49 · 617 阅读 · 0 评论 -
搜索具有指定名称的公共属性
using System;using System.Reflection;namespace 反射{ class Myclass { private int myProperty; public int MyProperty { get; set;原创 2013-09-12 23:23:46 · 469 阅读 · 0 评论 -
百度爬关键词的排名
1,程序使用了HtmlAgilityPack组件,在百度上爬前3页的莫一网站的关键词的排名,using System;using System.Net;using System.Text;using System.Text.RegularExpressions;using System.Threading;using System.Web;using HtmlAgili原创 2013-11-21 15:13:42 · 883 阅读 · 0 评论 -
常用类库-01图片:生成缩略图
/// /// 生成缩略图 /// /// 源图路径(物理路径) /// 缩略图路径(物理路径) /// 缩略图的宽度 /// 缩略图的高度 /// 生成缩略图的方式 public static void MakeThumbnail(string or原创 2013-11-27 23:58:14 · 573 阅读 · 0 评论 -
跨服务器上传图片
1,背景:程序在A服务器上,图片在B图片服务器上2,客户端上传文件到A服务器上,A服务器,在通过流的方式,将图片发送给B服务器上服务器A代码 public class UploadImage : IHttpHandler { public void ProcessRequest(HttpContext context)原创 2014-01-14 11:16:35 · 1306 阅读 · 0 评论 -
通过递归实现下拉框的层次结构
/// /// 递归添加数据 /// /// /// /// void add(DataTable table, int ParentID, int deep) { DataRow[] rowlist = table.Select("ParentID=" + ParentID); foreach (原创 2014-03-11 10:49:07 · 2242 阅读 · 0 评论 -
截屏操作
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Drawing;namespace _06_截屏{ class Program { static void Main(string[] args)原创 2014-05-17 22:19:30 · 523 阅读 · 0 评论 -
Attribute在.net编程中的应用
Atrribute 的基本概念经常有朋友问,Attribute是什么?它有什么用?好像没有这个东东程序也能运行。实际上在.Net中,Attribute是一个非常重要的组成部分,为了帮助大家理解和掌握Attribute,以及它的使用方法,特地收集了几个Attribute使用的例子,提供给大家参考。在具体的演示之前,我想先大致介绍一下Attribute。我们知道在类的成员中有property成转载 2013-09-12 22:01:50 · 935 阅读 · 0 评论 -
NPOI操作Exce
操作Exce public class ExcelHelper { /// /// 将excel转化为DataTable /// /// /// public DataTable ExcelToDataTable(FileStream stream) {原创 2014-07-31 09:59:25 · 703 阅读 · 0 评论 -
VS编写 windowsService 服务的注意事项
添加完windowsService服务后,运行是会出现点击service的试图处,选择,添加安装程序 会生成ProjectInstaller.cs然后注册服务C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe E:\vs2010测试\ePlatform08\Service\bin\D原创 2013-08-30 17:10:28 · 528 阅读 · 0 评论 -
winform程序访问一个web方法,传递参数,返回数据
/// /// 获取web中接口,返回一个xml,把xml转化为Dataset /// /// public DataSet GetHttpWebRequest() { string time = this.datetime.Value.ToString();//获取时间转载 2013-08-14 09:22:52 · 1122 阅读 · 0 评论 -
将TataTable转换为json字符
DataTable table = new DataTable(); table.Columns.Add("ID", typeof(string)); table.Columns.Add("Name", typeof(string)); for (int i = 0; i {原创 2013-07-26 00:25:24 · 489 阅读 · 0 评论 -
foreach内部原理
实现了IEnumerator接口和GetEnumerator()方法的类都可以进行foreach排序。1,建一个Myclass类,实现IEnumerable接口,在该接口中有个GetEnumerator()方法,返回值类型为IEnumerato,在建一个辅佐类实现了IEnumerato接口using System;using System.Collections.G原创 2013-03-24 23:47:21 · 699 阅读 · 0 评论 -
读取大文件Filestream
using (FileStream fs = new FileStream(@"内容.txt", FileMode.Open, FileAccess.ReadWrite)) { byte[] buffer = new byte[1024]; int count = -1;原创 2013-03-26 00:11:17 · 500 阅读 · 0 评论 -
序列化与反序列化
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;using System.Runtime.Serialization.Formatters.Binary;namespace _19_序列化{ class P原创 2013-05-21 23:21:49 · 363 阅读 · 0 评论 -
XML的创建
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Xml;namespace _21_XML{ class Program { static void Main(string[] args)原创 2013-05-22 14:49:44 · 403 阅读 · 0 评论 -
压缩
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ETS.Uitility { using System; using System.Collections.Generic; using System.IO;原创 2013-06-16 18:29:31 · 475 阅读 · 0 评论 -
处理json数据
JObject下面用个实例来搞定它的读写1.Json是这样的{title:123,body:456,list:{title:'这是一个标题',body:'what'}}2.我要将其中几项都搞出来,代码:static void Main(string[] args) { string str = "{title:12原创 2013-06-28 15:05:56 · 423 阅读 · 0 评论 -
多线程
public partial class Form1 : Form { public Form1() { InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; //夸线程操作原创 2013-07-23 22:26:58 · 464 阅读 · 0 评论 -
带参数线程
public partial class Form1 : Form { public Form1() { InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; } privat原创 2013-07-23 22:37:51 · 428 阅读 · 0 评论 -
反射的使用
定义一个接口namespace 反射的使用{ public interface Itable { string output(string name, int age); }}//定义一个实现接口的类namespace 反射的使用.B2B{ class Test : Itable {原创 2013-11-18 15:45:14 · 744 阅读 · 0 评论