随笔分类 -  C#

摘要:前言 在C#我们可以自定义委托,但是C#为什么还要内置泛型委托呢?因为我们常常要使用委托,如果系统内置了一些你可能会用到的委托,那么就省去了定义委托,然后实例化委托的步骤,这样一来既使代码看起来简洁而干净又能提高程序员的开发速度,何乐不为呢!通过本文可以让你复习扩展方法,同时可以循序渐进的了解系统内 阅读全文
posted @ 2016-03-28 15:53 无恨星晨 阅读(6260) 评论(0) 推荐(0) 编辑
摘要:public sealed class EncryptUtils { #region Base64加密解密 /// <summary> /// Base64加密 /// </summary> /// <param name="input">需要加密的字符串</param> /// <returns> 阅读全文
posted @ 2016-03-09 14:10 无恨星晨 阅读(17768) 评论(0) 推荐(1) 编辑
摘要:今天需要用到一个功能,获取主机名和本机的IP 准备用API实现的,然后稍微查了一下,发现.net类库已经有了 就在System.Net命名空间中的DNS类中 GetHostName 获取本地计算机的主机名。 GetHostByAddress 已重载。 获取 IP 地址的 DNS 主机信息。 今天需要 阅读全文
posted @ 2015-07-28 10:24 无恨星晨 阅读(1670) 评论(0) 推荐(0) 编辑
摘要:转 消息队列 http://www.cnblogs.com/anbylau2130/p/3469512.html 阅读全文
posted @ 2015-06-03 09:39 无恨星晨 阅读(221) 评论(0) 推荐(0) 编辑
摘要:前言 在 Windows Form Application 里对于取得 IP Address 有内网、外网两种 IP Address ,如果只需要取得内网 IP Address ,可以透过使用 IPHostEntry 类别取得,而外网的话就必须要发送一个 Request 到一个可以取得 IP Add 阅读全文
posted @ 2015-05-15 16:31 无恨星晨 阅读(9583) 评论(0) 推荐(1) 编辑
摘要:在做网站的时候,用到了去除html标签的问题,用正则匹配到html标签,然后replace即可。 这个方法可以实现去除html标签的功能。 Length参数可以根据传入值取固定长度的值。用于生成文章摘要比较方便。 阅读全文
posted @ 2015-05-12 11:07 无恨星晨 阅读(3665) 评论(0) 推荐(0) 编辑
摘要:http://www.cnblogs.com/heyuquan/p/net-batch-mail-send-async.html 阅读全文
posted @ 2015-05-07 15:43 无恨星晨 阅读(847) 评论(0) 推荐(0) 编辑
摘要:#region 半角转换为全角 /// <summary> /// 半角转换为全角 ////转全角的函数(SBC case) ///任意字符串 ///全角空格为12288,半角空格为32 ///其他字符半角(33-126)与全角(65281-65374)的对应关系是:均相差65248 /// </s 阅读全文
posted @ 2015-04-23 13:12 无恨星晨 阅读(351) 评论(0) 推荐(0) 编辑
摘要:很早以前写过一篇文章(用C#截取指定长度的中英文混合字符串),但是对性能没有测试,有人说我写的这个方法性能有问题,后来想,可能真会有BT之需求要求传入一个几万K甚至几M体积的字符串进来,那将会影响正则Match的速度,比如文章系统中就极有可能用到,今天有点时间,就改进了一下,代码如下: public 阅读全文
posted @ 2013-11-06 17:03 无恨星晨 阅读(456) 评论(0) 推荐(0) 编辑
摘要://设置自动启动 string path = Application.StartupPath; SettingHel.SetAutoRun(path +@"\MostImpressive.DSCJ.DcbInterface.exe", true); public static class Setti 阅读全文
posted @ 2013-10-23 13:48 无恨星晨 阅读(13889) 评论(1) 推荐(2) 编辑
摘要:一、获取当前文件的路径1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName获取模块的完整路径,包括文件名。2. System.Environment.CurrentDirectory获取和设置当前目录(该进程从中启 阅读全文
posted @ 2013-09-28 16:59 无恨星晨 阅读(544) 评论(0) 推荐(0) 编辑
摘要:#region 读取指定URL的内容 /// <summary> /// 读取指定URL的内容 /// </summary> /// <param name="URL">指定URL</param> /// <param name="Content">该URL包含的内容</param> /// <re 阅读全文
posted @ 2013-08-28 13:10 无恨星晨 阅读(1034) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing; using System.D 阅读全文
posted @ 2013-08-28 13:09 无恨星晨 阅读(2595) 评论(0) 推荐(0) 编辑
摘要:using System; using System.IO; using System.Text; namespace CSharpConvertString2Stream { class Program { static void Main( string[] args ) { string st 阅读全文
posted @ 2013-08-28 13:07 无恨星晨 阅读(14144) 评论(0) 推荐(0) 编辑
摘要:我写了一个打印文本文件的类库,功能包括:打印预览、打印。打印时可以选择打印机,可以指定页码范围。调用方法非常简单:TextFilePrinter p = new TextFilePrinter(tbxFileName.Text);p.View(); // 打印预览p.Print(); // 打印文件 阅读全文
posted @ 2013-08-27 17:34 无恨星晨 阅读(5069) 评论(0) 推荐(0) 编辑
摘要:using System;using System.Collections;using System.Text;using System.Runtime.InteropServices; using System.Security; using System.ComponentModel; usin 阅读全文
posted @ 2013-08-27 14:38 无恨星晨 阅读(1627) 评论(2) 推荐(1) 编辑
摘要:C# 打印小票 POS 最近在写一个餐饮的收银系统,以前从来没有碰过打印机这玩意。感觉有些无从下手,在前面做报表时,总想找第三方的控件来用用,结果始终不行没搞定、没研究透,催得急没办法还是的动手自己写个,哈...查了些相关的资料,感觉也不难,没多久就搞定了。主要用到PrintDocument和Pri 阅读全文
posted @ 2013-08-26 18:02 无恨星晨 阅读(22386) 评论(13) 推荐(2) 编辑
摘要:public static string GetPrinterStatus(string PrinterName) { int intValue = GetPrinterStatusInt(PrinterName); string strRet = string.Empty; switch (int 阅读全文
posted @ 2013-08-26 18:00 无恨星晨 阅读(2083) 评论(0) 推荐(0) 编辑
摘要:List<string> print = Cprinter.GetLocalPrinter(); /// <summary> /// 获取所有打印机 /// </summary> public class Cprinter { private static PrintDocument fPrintD 阅读全文
posted @ 2013-08-26 17:59 无恨星晨 阅读(3318) 评论(0) 推荐(0) 编辑
摘要:C#追加文件 StreamWriter sw = File.AppendText(Server.MapPath(".")+"\\myText.txt"); sw.WriteLine("追逐理想"); sw.WriteLine("kzlll"); sw.WriteLine(".NET笔记"); sw. 阅读全文
posted @ 2013-08-26 14:40 无恨星晨 阅读(7707) 评论(0) 推荐(0) 编辑