CR的代码文本

all for learning about the world
  订阅 订阅  :: 管理

随笔分类 -  C#/WPF

摘要:解决办法:勿以管理员权限运行Visual Studio 阅读全文

posted @ 2015-02-23 22:27 mumuliang 阅读(1836) 评论(0) 推荐(0) 编辑

摘要:原文在此:http://www.codeproject.com/Articles/24656/A-Detailed-Data-Binding-Tutorial完整译文在此:http://www.cnblogs.com/lichence/archive/2012/02/17/2356001.html译... 阅读全文

posted @ 2014-09-10 15:37 mumuliang 阅读(1149) 评论(0) 推荐(0) 编辑

摘要:在方法中扔进这段System.Diagnostics.Debug.WriteLine(new string('*', 78));System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();System.Diagnost... 阅读全文

posted @ 2014-08-27 11:57 mumuliang 阅读(6186) 评论(0) 推荐(0) 编辑

摘要:方法很简单,但找起来很难。使用SoapHttpClientProtocol类的Proxy属性。不能设空值,必须设一个新值。赶脚底层在链接的时候会判断这个属性是不是null,如果null就会用默认ie代理设置了。// 万万不能赋nullsoapHttpClientProtocol.Proxy = ne... 阅读全文

posted @ 2014-08-22 16:50 mumuliang 阅读(1338) 评论(0) 推荐(0) 编辑

摘要:FindIndex和ForEach能接受一个delegate,用来定义查找规则太好用。匿名函数,萌萌哒;Conditional("DEBUG")也是极好的。读《C#本质论》using System;using System.Collections.Generic;using System.Windo... 阅读全文

posted @ 2014-08-15 14:19 mumuliang 阅读(1006) 评论(0) 推荐(0) 编辑

摘要:Capacity 在.NET中List的容量应该只是受到硬件限制。属性Capacity的真正含义,是创建List时给它预分配的容量。一旦项的数量超过了当前的Capacity,Capacity会以Capacity = (Capacity==0)?A_VALUE_YOU_CANNOT_SURE:(C... 阅读全文

posted @ 2014-08-15 11:31 mumuliang 阅读(2169) 评论(0) 推荐(1) 编辑

摘要:装箱用于把一个值类型的数据放到托管堆上。(至于为什么会有这种需求...)装箱以后,等于是原来的值类型有了一个在托管堆上的拷贝。跟从前的值类型变量完全是两样了哟。装箱是个比较费资源的动作,开销是内啥的20倍哦,拆箱大约也有4倍于内啥的开销。有些装箱是比较明显的了,但是,有一种要注意,就是使用哪些非泛型... 阅读全文

posted @ 2014-08-14 15:02 mumuliang 阅读(219) 评论(0) 推荐(0) 编辑

摘要:Microsoft.VisualBasic.FileIO.FileSystem.DeleteDirectory(fileFolder, UIOption.AllDialogs, RecycleOption.SendToRecycleBin, UICancelOption.DoNothing);win... 阅读全文

posted @ 2014-08-11 11:56 mumuliang 阅读(651) 评论(0) 推荐(0) 编辑

摘要:来自《西夏普入门经典》using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Reflection;namespace ConsoleApplication1{ ... 阅读全文

posted @ 2014-08-07 11:29 mumuliang 阅读(396) 评论(0) 推荐(0) 编辑

摘要:好懒,啥都不想写了。C#的属性伤透了我的心。只能相信记忆力和想象力能让我下次翻到这篇日志时能瞬间想到我们在谈瓦特。http://stackoverflow.com/questions/1224270/when-is-my-c-sharp-property-initializedhttp://blog... 阅读全文

posted @ 2014-05-29 13:37 mumuliang 阅读(1076) 评论(0) 推荐(0) 编辑

摘要:注:判断整型的长度的方式,只有在AnyCPU编译模式下才有用。因此更好的办法是获取真的地址总线位宽(使用WMI,windows management instruementation)。.NET 2.0add reference, System.Managementusing System.Management;... public static int GetOSBit() { try { string addressWidth = String.Empty; ... 阅读全文

posted @ 2014-03-10 14:14 mumuliang 阅读(2490) 评论(2) 推荐(0) 编辑

摘要:据说实际场景中node数量达到4k~6k,ListView就崩溃了。(怎么个崩溃法未知)小试了一下,10w个node毫无压力。(win7 vs2010 .net2.0)有意思的地方在于,动态添加如果是在构造中做,大约需要100ms;如果是窗体shown之后,由界面上的空间触发并动态创建,则需要近800ms(已经使用beginUpdate和endUpdate,如果不使用耗时达到1800ms)。马个克。另外关于 ANTS马个克http://www.cnblogs.com/parry/archive/2013/01/04/DotNet_Performance_Tuning_ANTS_Performa 阅读全文

posted @ 2014-02-26 15:39 mumuliang 阅读(295) 评论(0) 推荐(0) 编辑

摘要:// Read byte[] from png fileBinaryReader binReader = new BinaryReader(File.Open(filepath, FileMode.Open));FileInfo fileInfo = new FileInfo(filepath);byte[] bytes = binReader.ReadBytes((int)fileInfo.Length);binReader.Close();// Init bitmapBitmapImage bitmap = new BitmapImage();bitmap.BeginInit();//bi 阅读全文

posted @ 2013-11-25 15:32 mumuliang 阅读(546) 评论(0) 推荐(0) 编辑

摘要:public static T FindVisualChild(DependencyObject obj) where T : DependencyObject { if (obj != null) { for (int i = 0; i (child); if (childItem != null) return childItem; } } return null; } ... 阅读全文

posted @ 2013-11-19 16:26 mumuliang 阅读(1912) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示