c#实现人民币大小写转换的代码using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Utility{ /// <summary> ///金钱转换成大写 DBA群: 22598298……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2847浏览 2453个赞
C# 用Log4net记录日志代码演示 1、引入Log4net.dll到项目中2、在global.asax的程序启动服务添加代码:protected void Application_Start(Object sender, EventArgs e) { log4n……继续阅读 » 水墨上仙 5年前 (2021-03-12) 1421浏览 1811个赞
C#验证码识别类,可以用于识别各种验证码的算法演示using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Drawing;using System.Drawing.Imaging;using System.R……继续阅读 » 水墨上仙 5年前 (2021-03-12) 1929浏览 666个赞
C#获取指定月指定周的日期范围 根据当前时间获取本月开始日期和结束日期 /// <summary> /// 获取指定月份指定周数的开始日期 /// </summary> /// <param name="year">年份</par……继续阅读 » 水墨上仙 5年前 (2021-03-12) 3035浏览 234个赞
用EnumWindows 函数将枚举计算机上的所有现有窗口,但我们用System.Diagnostics名字空间的静态函数Process.GetProcesses()可以避免EnumWindows的互操作性问题Using System.Diagnostics; ... foreach ( Process p in Process.GetProc……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2419浏览 767个赞
C#显示出正在运行的所有进程Using System.Diagnostics; ... foreach ( Process p in Process.GetProcesses() ) Console.WriteLine( p ); // string s = p.ToString(); ……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2946浏览 767个赞
C#确保只有一个实例在运行public static Process RunningInstance() { Process current = Process.GetCurrentProcess(); Process[] processes = Process.GetProcessesByName (current.ProcessName); ……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2480浏览 1964个赞
C#获得本机ip地址string s=""; System.Net.IPAddress[] addressList = Dns.GetHostByName(Dns.GetHostName()).AddressList; for (int i = 0; i < addressList.Length; i ++) { s……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2453浏览 1589个赞
C#解压GZip文件代码 public void ungzip(string path, string decomPath, bool overwrite) { //for overwriting purposes if (File.Exists(decomPath)) ……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2436浏览 785个赞
C#判断年月日是否合法static bool ValidateDate(int y, int m, int d){ int[] a = { 31, (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2671浏览 840个赞
C#模拟登陆OSC并获取Cookie/* * 由SharpDevelop创建。 * 用户: dodola * 日期: 2012/10/23 * 时间: 9:43 * * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件 */using System;using System.Collections.Generic;usi……继续阅读 » 水墨上仙 5年前 (2021-03-12) 1457浏览 2330个赞
本文提供了C#中文件下载的4中方法,分别带有演示代码来源:http://topic.csdn.net/u/20120822/10/d8115bb7-2f2a-4c2f-b0c1-aab68bcb1e3e.htmlusing System;using System.Data;using System.Configuration;using Syst……继续阅读 » 水墨上仙 5年前 (2021-03-12) 3330浏览 2347个赞
C# 用 iTextSharp 将 PDF 转成文本using System;using System.IO; using iTextSharp.text;using iTextSharp.text.pdf;using iTextSharp.text.pdf.parser;public class ParsingPDF { sta……继续阅读 » 水墨上仙 5年前 (2021-03-12) 3205浏览 2340个赞
c#自动识别URL网址的代码using System;using System.Collections.Generic;using System.Text;using System.Net;using System.Text.RegularExpressions;namespace ConsoleApplication3{ clas……继续阅读 » 水墨上仙 5年前 (2021-03-12) 3032浏览 712个赞
C#提高随机数不重复概率的种子生成方法static int GetRandomSeed( ){ byte[] bytes = new byte[4]; System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Securit……继续阅读 » 水墨上仙 5年前 (2021-03-12) 1878浏览 160个赞
C#返回多少分钟之前或者之后的时间/** * 获取给定时间的之前某分钟的时间 * 比如现在是:2012-10-10 10:10:10 * 给定的分钟数:50 * 得到的时间为:2012-10-10 9:20:10 * * @return strLateMinutesTime 时间字符 */ public static……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2663浏览 411个赞
这几天刚整理完Kudy.Net项目中关键词过虑的功能。关键词过虑在网站开发中也算是比较常见的需求了,特别是在SNS社区网站。在网上找的相关文章都达不到我的要求,所以就自己根据过虑的特点专门写了个KeywordFilter,可能满足基本的过虑要求,性能也不错。它有如下特点:一、允许你自定义匹配到关键词时返回的结果,例如匹配到“日你”,你可以在原文中显示例如:“……继续阅读 » 水墨上仙 5年前 (2021-03-12) 3129浏览 205个赞
C#敏感关键词过滤代码 还有待优化的地方 各位有更好的方法 还请分享指点一下 说明原理来源:http://www.cnblogs.com/yujiajun/archive/2012/10/15/keword_Filter.htmlSystem.Text.StringBuilder sb = new System.Text.StringBuilde……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2186浏览 2226个赞
C#监控文件夹并自动给图片文件打水印转自:http://www.cnblogs.com/zhuzhenyu/archive/2012/10/15/2724307.htmlusing System;using System.Collections.Generic;using System.ComponentModel;using System.Da……继续阅读 » 水墨上仙 5年前 (2021-03-12) 1653浏览 2388个赞
C# StreamReader读取文件using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;using System.Threading.Tasks;namespace W{ class P……继续阅读 » 水墨上仙 5年前 (2021-03-12) 3096浏览 559个赞
C# StreamWriter写入文件using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;using System.Threading.Tasks;namespace W{ class ……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2313浏览 1149个赞
C#二进制序列化来源:http://blog.csdn.net/mypc2010/article/details/8068963using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Task……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2796浏览 2945个赞
C#修改电脑密码,重置windows密码DirectoryEntry实现转自:http://blog.csdn.net/sufei1013/article/details/8073184 C#修改电脑密码方法如下 /// <summary> /// 更……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2306浏览 1711个赞
C#使用委托实现的快速排序算法class QuickSort { private delegate int CmpOp(object Left, object Right); private void swap(object[] Array, int Left, int Right, CmpOp Cmp) { ……继续阅读 » 水墨上仙 5年前 (2021-03-12) 1523浏览 751个赞
C#快速排序算法代码演示class Quicksort { private void swap(int[] Array, int Left, int Right) { int temp = Array[Right]; Array[Right] = Array[Left]; ……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2980浏览 2403个赞
C# Aggregate and Sum 使用范例using System;using System.Linq;using System.Collections;using System.Collections.Generic;public class MainClass { public static void Main() { ……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2252浏览 1676个赞
C#在数组上使用Aggregateusing System;using System.Collections;using System.Collections.Generic;using System.Text;using System.Linq;public class MainClass { public static void ……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2518浏览 547个赞
C# Aggregate 用法范例using System;using System.Linq;using System.Collections;using System.Collections.Generic;public class MainClass { public static void Main() { in……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2804浏览 752个赞
此程序包含一个简单的 LINQ to XML 示例查询。它演示了编写 LINQ to XML 查询所需的最少代码。using System;using System.Collections.Generic;using System.IO;using System.Xml;using System.Linq;using System.Xml.L……继续阅读 » 水墨上仙 5年前 (2021-03-12) 3399浏览 1678个赞
示例演示如何创建一个列表类来实现 IEnumerable 和 yield 关键字,以对列表的内容启用 foreach 迭代using System;using System.Collections.Generic;using System.Text;namespace Yield{ class Yield { p……继续阅读 » 水墨上仙 5年前 (2021-03-12) 1918浏览 502个赞
本示例演示如何使用 XML 将代码编入文档// XMLsample.cs// 编译时使用:/doc:XMLsample.xmlusing System;/// <summary>/// 此处显示类级别摘要文档。 </summary>/// <remarks>/// 较长的注释可通过 remarks 标记与……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2217浏览 1412个赞
本示例演示了如何在 C# 中使用 override 和 new 关键字进行版本控制。版本控制有助于在基类和派生类的演变过程中维护它们之间的兼容性。// versioning.cs// 需要 CS0114public class MyBase { public virtual string Meth1() { return……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2134浏览 101个赞
C#通过指针读取文件// readfile.cs// 编译时使用:/unsafe// 参数:readfile.txt// 使用该程序读并显示文本文件。using System;using System.Runtime.InteropServices;using System.Text;class FileReader{ const u……继续阅读 » 水墨上仙 5年前 (2021-03-12) 1550浏览 1905个赞
本示例演示如何定义与类或结构之间的转换,以及如何使用此类转换// conversion.csusing System;struct RomanNumeral{ public RomanNumeral(int value) { this.value = value; } // 声明从 int 到 ……继续阅读 » 水墨上仙 5年前 (2021-03-12) 3405浏览 609个赞
本示例演示了如何在 C# 中使用非托管代码(使用指针的代码)。// printversion.cs// 编译时使用:/unsafeusing System;using System.Reflection;using System.Runtime.InteropServices;// 为此程序集指定一个版本号:[assembly:Assemb……继续阅读 » 水墨上仙 5年前 (2021-03-12) 1944浏览 2192个赞
C# 通过指针实现的fastcopy,快速拷贝函数// fastcopy.cs// 编译时使用:/unsafeusing System;class Test{ // unsafe 关键字允许在下列 // 方法中使用指针: static unsafe void Copy(byte[] src, int srcIndex,……继续阅读 » 水墨上仙 5年前 (2021-03-12) 1500浏览 1693个赞
本示例演示了下面的线程处理技术。创建、启动和终止线程使用线程池线程同步和互交 ThreadPool.csusing System;using System.Threading;// Fibonacci 类为使用辅助// 线程执行长时间的 Fibonacci(N) 计算提供了一……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2262浏览 2468个赞
本示例演示结构的语法和用法。它还介绍了类与结构之间的重大差异 // struct1.csusing System;struct SimpleStruct{ private int xval; public int X { ……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2893浏览 197个赞
本示例演示了如何通过权限类和权限属性来修改安全权限 // ImperativeSecurity.csusing System;using System.Security;using System.Security.Permissions;using Syst……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2609浏览 2570个赞
C#类和属性的使用 abstractshape.cs// abstractshape.cs// 编译时使用:/target:library// csc /target:library abstractshape.csusing System;public abstract ……继续阅读 » 水墨上仙 5年前 (2021-03-12) 3410浏览 1433个赞
本示例演示属性为何是 C# 编程语言必不可少的一个组成部分。它演示了如何声明和使用属性// person.csusing System;class Person{ private string myName ="N/A"; private int myAge = 0; // 声明 string 类型的 ……继续阅读 » 水墨上仙 5年前 (2021-03-12) 1911浏览 1171个赞
本示例演示了如何使用允许在两个或更多 C# 文件中定义类或结构的分部类型。这就允许多个程序员并行处理一个类的不同部分,并将复杂类的不同方面保存在不同的文件中。 CharTypesPrivate.csusing System;using System.Collections.Gen……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2069浏览 2639个赞
本示例演示了用户定义的类如何能够重载运算符// complex.csusing System;public struct Complex { public int real; public int imaginary; public Complex(int real, int imaginary) { thi……继续阅读 » 水墨上仙 5年前 (2021-03-12) 3311浏览 1617个赞
本示例演示了如何在 C# 中使用 Microsoft Access 数据库。它演示了如何创建数据集并从数据库向该数据集添加表。// OleDbSample.cs// 若要从命令行生成此示例,请使用命令:// csc oledbsample.csusing System;using System.Data;using System.Data.O……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2547浏览 2788个赞
C#统计字符串中数字的个数// DigitCounter.cs// 编译时使用:/target:libraryusing System; // 声明与 Factorial.cs 中的命名空间相同的命名空间。这样仅允许将 // 类型添加到同一个命名空间中。namespace Functions { public class Digit……继续阅读 » 水墨上仙 5年前 (2021-03-12) 2560浏览 2402个赞