2013年6月21日

C#UDP编程总结

摘要: // 如果只使用一个EndPoint,维持一个引用。private static UdpClient udpClient;static void Main(string[] args){ if (udpClient != null) { // 这段很重要 udpClient.Close(); } udpClient = new UdpClient(10250); udpClient.Client.SendBufferSize = 120400; udpClient.Client.SendTimeout = 1000; udp... 阅读全文

posted @ 2013-06-21 21:08 yao2yao4 阅读(900) 评论(0) 推荐(0) 编辑

2013年6月16日

C# TcpListener的编程要点

摘要: using System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Net.Sockets;using System.Threading;using System.Windows.Forms;namespace Server{ public partial class Form1 : Form { public Form1() { InitializeComponent(); listener... 阅读全文

posted @ 2013-06-16 21:05 yao2yao4 阅读(5354) 评论(0) 推荐(0) 编辑

2013年6月15日

分享一个开源小工具,关于单词的

摘要: 1、前言之前我在以前的博客分享过,之后一段时间内,我一直在用,也一直在根据自己的需要进行修改。后面会有源码,手写的代码一共210行,修改起来很方便。先会有使用介绍,希望可以引起读者的兴趣。这是一种应对英文单词的策略,会以人为中心,小工具会智能化的辅助记忆。小工具会用google翻译获得释义,相对可靠一些。虽然工具会收集历史单词,但是历史单词丢失了也是无所谓的,这是以人的记忆为中心的。基本原理是,出现频率越高的单词总是越重要的,而已经知道的单词你不会想去查,所以会处理不知道的高频的词。这种策略不会要求人有压力,不要求额外的时间记忆单词,因为即使漏掉了一个词,如果它是低频的,漏掉没什么损失,如果它 阅读全文

posted @ 2013-06-15 07:22 yao2yao4 阅读(2574) 评论(5) 推荐(5) 编辑

2013年6月12日

使用C#尽可能以最少的代码完成多层次的软件配置(基于PropertyGrid控件)

摘要: 1、前言现在搜索PropertyGuid,发现的一些文档,特别是在百度文库中,都是互相抄,我发现最初的文档在这儿http://msdn.microsoft.com/en-us/library/aa302326.aspx。这里面也有一些错误,看的时候注意辨别一下。2、目标:以最少的代码,实现在GUI中配置下列结构的对象。namespace WindowsFormsApplication1{ public partial class Form1 : Form { public Form1() { InitializeComponent(... 阅读全文

posted @ 2013-06-12 20:58 yao2yao4 阅读(3815) 评论(6) 推荐(1) 编辑

2013年6月9日

C# Winform Chart的配置

摘要: using System.Collections.Generic;using System.Drawing;using System.Windows.Forms;using System.Windows.Forms.DataVisualization.Charting;namespace WindowsFormsApplication1{ public partial class Form1 : Form { public Form1() { InitializeComponent(); // 数据源至界面 ... 阅读全文

posted @ 2013-06-09 06:24 yao2yao4 阅读(17864) 评论(0) 推荐(0) 编辑

2013年6月8日

C#平台调用的步骤

摘要: 1、准备CLRInsideOut2008_01.exe程序2、将所有的C的函数、结构、常量的声明合并到一个文件中3、去掉所有的预编译指令、头文件导入声明4、去掉定义为函数的宏5、用上述的程序转换它,仔细查看第一个错误,修正它6、复制到C#类库中,整理一下7、明确函数导入的dll名称8、为函数添加调用约定9、为委托添加调用约定形式:[UnmagedFunctionPointer(CallingConvention.Cdecl)]10、以“Error”为关键字查找,解决一下11、平台调用以函数为中心,对无用的结构、委托、常量、枚举,可以删掉12、仔细过一遍,查找不合理的地方13、char*变为St 阅读全文

posted @ 2013-06-08 20:57 yao2yao4 阅读(538) 评论(0) 推荐(0) 编辑

2013年6月7日

C#的log4net、log2console、rollingfile综合配置

摘要: <?xml version="1.0" encoding="utf-8" ?><configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> </configSections> <log4net> <root> <appender-ref re 阅读全文

posted @ 2013-06-07 20:17 yao2yao4 阅读(485) 评论(0) 推荐(0) 编辑

C#,字符串加密

摘要: var g = BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(Encoding.UTF8.GetBytes("abc"))).Replace("-", ""); 阅读全文

posted @ 2013-06-07 19:28 yao2yao4 阅读(141) 评论(0) 推荐(0) 编辑

C# Winform 单例的Form窗体

摘要: using System.Windows.Forms;namespace WindowsFormsApplication1{ public partial class Form1 : Form { public static void ShowUI() { if (singleton == null || singleton.IsDisposed) { singleton = new Form1(); } else ... 阅读全文

posted @ 2013-06-07 19:09 yao2yao4 阅读(468) 评论(0) 推荐(0) 编辑

C#进程间的同步,实现只能运行一个程序的效果

摘要: using System;using System.Threading;using System.Windows.Forms;namespace WindowsFormsApplication1{ static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { bool createdNew; using (new Mut... 阅读全文

posted @ 2013-06-07 19:04 yao2yao4 阅读(206) 评论(0) 推荐(0) 编辑

导航