随笔分类 - c#
摘要:yield关键字用于迭代器块中用于枚举数提供值或发出一个迭代结束标识,它只能出现在iterator块中。先看看一个传统迭代器的编写:Node结点类 1 public class Node 2 { 3 public object data; 4 public Node next; 5 6 public override string ToString() 7 { 8 return data.ToString(); 9 }10 }自定义一个集合并可枚举:Node集合类public class NodeCollection : IEnumerable<Node> { private No
阅读全文
摘要:最近在做图片缩放时遇到的一个问题,当我把缩放之后的图片另存为png格式时,出现gdi+ general error,详细的异常描述如下:A generic error occurred in GDI+.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. .
阅读全文
摘要:应 风云(老看成 云风)要求,简单测试了下NLiteMapper的性能,顺道与Emit方式作一下性能比较,不知道是我应用不得当还是有什么其它原因,不知道为什么NLite性性能较之EmitMapper如如此大的差别,看看我的测试代码: static void Main(string[] args) { //consturct data List<SimpleClassFrom> fromCollec...
阅读全文
摘要:csc在处理byte类型时,其实是有一些规则的,平时我们写代码可能没有注意。举个例子://有几行这样的代码byte a = 1;byte b = 2;//byte sum = a+b; //incorrectConsole.WriteLine((a + b).GetType());[代码] 猜测一下GetType()之后输出的结果是什么呢?我相信肯定有些人会理所当然说是byte 了,那么你错了 。...
阅读全文
摘要:今天休假,闲来无事,写了一个转数字为中文的程序,暂时时没有处理小数部分,不过处理方法应该差不多。思路: x<1000此处分别对二种情况时进行了处理。0<x<100范围内的转换直接调用ConvertLessThanHundred方法0<x<10直接从数组(中文数字)里取10<x<100如果为10的倍数,则直接从数组(10的倍数)里找到对应数字的索引,否则分别...
阅读全文
摘要:原来我不小心把 mdm.exe进程给结束了,导致:项目不能调试........运行C:\Program Files\Common Files\Microsoft Shared\VS7Debug下面的mdm.exe /regserver 重新注册该服务就OK了, 然后再到服务里面找到 Machine Debug Manager 服务,启动就OK了。 在网上还看到其它方法:1、请确定你的操作系统是否运...
阅读全文
摘要:在网上找的一些开上技巧,也包括自己的一些,现总结一下: 1.怎样定制VC#DataGrid列标题? DataGridTableStyle dgts = new DataGridTableStyle(); dgts.MappingName = "myTable"; //myTable为要载入数据的DataTable DataGridTextBoxColumn dgcs = new DataGridT...
阅读全文