
C# .net
sunriseWang
这个作者很懒,什么都没留下…
展开
-
c# 隐藏控制台窗口
#region 隐藏窗口 [DllImport("user32.dll", EntryPoint = "ShowWindow", SetLastError = true)] private static extern bool ShowWindow(IntPtr hWnd, uint nCmdShow); [DllImport("user32.dll转载 2012-04-19 13:28:40 · 6315 阅读 · 1 评论 -
C# .net 中 punycode
System.Globalization.IdnMapping idn = new System.Globalization.IdnMapping();idn.GetUnicode("xn--fiqs8s");idn.GetAscii("中国");不知道为什么网上有那么多人自己实现.....原创 2013-08-15 11:28:11 · 1590 阅读 · 0 评论 -
.net Romting 中的对象生命周期
http://msdn.microsoft.com/zh-cn/library/system.runtime.remoting.lifetime.lifetimeservices(v=vs.100).aspxhttp://msdn.microsoft.com/zh-cn/library/system.marshalbyrefobject.getlifetimeservice(v=VS.10原创 2013-08-26 17:27:30 · 1435 阅读 · 0 评论 -
C# 中的泛型
http://blog.youkuaiyun.com/phoenix_17th/article/details/6089489转载 2013-08-08 15:36:56 · 624 阅读 · 0 评论 -
c# winform 中文输入法的问题.
wihform 默认的 ImeMode 值是NoControl这不适合中文输入.因为例如: 你每到一个控件都要切换一下输入法.我们应该把父窗口 及所有子窗口 的 ImeMode 值 设置为 On可是这样有个问题就是 它总是全角状态.解决办法是:在每个窗休的 Desinger.cs文件里找到this.ImeMode = System.Windows原创 2013-08-21 12:32:55 · 6090 阅读 · 0 评论 -
C# 中的Action Func
昨天在群里请教了一个问题,学到了不少:看这个函数的声明 public static IEnumerable Select(this IEnumerable source, Func selector);感觉有点神奇. 决定研究一下.看了一下c#高级编程第七版, 重新学习了一下 Action 和 Func如何定义一个和数组中 Select原创 2013-08-20 15:10:01 · 2578 阅读 · 0 评论 -
C# 日期格式化的中的 正斜杠的问题
Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd" ));//这行代码, 如果你在系统日期格式默认的情况下输出 2013/08/05 这是正常的.但如果你更改了系统日期格式, 以- 为分隔的 日期格式.它变会输出 2013-08-05 .此时你表示无奈....解决方原创 2013-08-05 16:25:05 · 10376 阅读 · 2 评论 -
C# struct的陷阱:无法修改“...”的返回值,因为它不是变量
struct A { int _x; public int X { get { return _x; } set { _x = value; } } } class B { A _a = new A(); public A A1 { get { return _a原创 2013-05-06 12:18:57 · 2334 阅读 · 0 评论 -
C# RC4 代码实现
using System;using System.Collections.Generic;using System.Text;namespace NewLife.Cryptography{ /// /// 加密类基类 /// public class CryptoBase { public enum EncoderMode转载 2012-09-07 15:26:54 · 7730 阅读 · 1 评论 -
c# 判断字符串中是否有中文(是否为纯Asiic)
static public bool CheckEncode(string srcString) { return System.Text.Encoding.UTF8.GetBytes(srcString).Length > srcString.Length; }原创 2013-08-15 11:44:28 · 2420 阅读 · 0 评论