随笔分类 - C#
摘要:1.前言 最近在看《游戏开发与设计模式》一书,看到控制反转设计模式,作者说:上层模块不应该依赖于下层模块,上层模块和下层模块都应该依赖于接口,这样能减少耦合。然后附带举了个例子,我觉得特别好,就是一台计算机是属于上层模块,里面硬盘属于下层模块,计算机依赖于硬盘,硬盘是计算机的基本组成部件之一。这里提
阅读全文
摘要:服务器端:[csharp]view plaincopyprint?usingSystem;usingSystem.Windows.Forms;usingSystem.Net.Sockets;usingSystem.Net;//IPAddress,IPEndPoint(ip和端口)类usingSystem.Threading;usingSystem.Collections.Generic;usingSystem.IO;namespaceMyChatRoomServer{publicpartialclassServer:Form{publicServer(){InitializeComponent
阅读全文
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Script.Serialization;using System.Data;/// /// JSON帮助类 /// publicclassJSONHelper{ /// /// 对象转JSON /// /// 对象 /// JSON格式的字符串 publicstaticstringObjectToJSON(object obj) { JavaScriptSeri...
阅读全文
摘要:开发软件时,当用到商业用途时,注册码与激活码就显得很重要了。现在的软件破解技术实在在强了,各种国内外大型软件都有注册机制,但同时也不断地被破解。下面发的只是一个常用版本,发出源码被破就更容易了,但我们学习的是技术。当然也为以后自己的软件不会被轻易破解。第一步。根据卷标,CPU序列号,生成机器码// 取得设备硬盘的卷标号 public static string GetDiskVolumeSerialNumber() { ManagementClass mc = new ManagementClass(“Win32_NetworkAdapterConfiguration”); Managemen
阅读全文
摘要:C Sharp 短信发送平台源代码.rar http://1000eb.com/5c6vASP.NET+AJAX基础示例 视频教程 http://1000eb.com/89jcC# Winform qq弹窗 360弹窗 http://1000eb.com/89jf精华志 C#高级编程(第七版)源码 http://1000eb.com/89k3C#网络应用编程教案及代码.rar http://1000eb.com/89khIPhone远程桌面xp控制+Desktop+Connect教程.rar http://1000eb.com/89kzphotoshop-PPT.rar http://1000
阅读全文
摘要:using System;using System.Collections.Generic;using System.IO;using System.Net;using System.Text.RegularExpressions;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { //需要解析的集合 List<string> list = new List<string>(); //已经解析的集合 List<string> listCount =
阅读全文
摘要:如何实现语音和朗诵的功能:using System;using System.Windows.Forms;using System.IO;using System.Media;using System.Runtime.InteropServices;namespace 播放TTS{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } //根目录 string address = System.AppDomain.CurrentDomain.BaseDirectory; private voi
阅读全文
摘要:如何添加数据库中的信息加载到树形控件中?如何遍历控件中的信息?如何对控件中的信息进行增删查改?数据库设计:主界面:代码:using System;using System.Collections.Generic;using System.Windows.Forms;using TreeSolution.BLL;using TreeSolution.Model;namespace 树型测试{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } //当窗体加载时,加载树形节点 private v
阅读全文
摘要:using System;using System.Windows.Forms;namespace TreeView控件{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { treeView1.Nodes.Clear(); //每一个节点都是一个TreeNode的一个对象 TreeNode nodeChina = new TreeNode(); nodeChina.Text =
阅读全文
摘要:/// <summary> /// 复合查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCheck_Click(object sender, EventArgs e) { //方法一 //StringBuilder sb = new StringBuilder(); //sb.Append("select * from T_Cus
阅读全文
摘要:当我们遇到要处理汉字和拼音之间的转化关系怎么办?如和用程序来实现?我搜索到一个ChineseChar开发包,然后实现了这一难题using System;using Microsoft.International.Converters.PinYinConverter;namespace 拼音基础{ class Program { static void Main(string[] args) { #region 判断是否为同音字 ChineseChar chineseChar = new ChineseChar('微'); Console.WriteLine("Stro
阅读全文
摘要:using System;using System.Windows.Forms;using System.Security.Cryptography;using System.IO;namespace 计算文件的MD5{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //创建与服务器的连接 FtpClient fc = new FtpClient("127.0.0
阅读全文
摘要://FTP开源封装的类using System;using System.Collections.Generic;using System.Net;using System.IO;namespace FTP{ /// <summary> /// FTP客户端操作类 /// </summary> public class FtpClient { #region 构造函数 /// <summary> /// 创建FTP工具 /// <para> /// 默认不使用SSL,使用二进制传输方式,使用被动模式 /// </para> /// &
阅读全文
摘要:C#操作Excel,如果格式是xlsx的就用openXML来操作,如果是xls的就用NPOI来操作应该讲第三方组件,单独存在一个lib文件夹中,然后添加引用,这样组件就能随着项目走xlsx实际上是一个压缩文件using System;using System.Windows.Forms;using System.IO;using NPOI.HSSF.UserModel;namespace NPOI测试{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } /// <summary>
阅读全文

浙公网安备 33010602011771号