2012年1月12日

Wpf TreeView demo

摘要: xaml:<Window x:Class="TreeViewDemo.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="550" Width="825" xmlns:local="clr-nam阅读全文

posted @ 2012-01-12 13:14 cutebear 阅读(10) 评论(0) 编辑

2011年12月28日

Implementing Dynamic Interfaces

摘要: 名词解释DLR: dynamic language runtime.refer to this article:http://msdn.microsoft.com/en-us/vstudio/ff800651.aspx下面是一个简单的实现,会动态的创建需要的属性:class Program { static void Main(string[] args) { dynamic dynamicProperties = new MyDynamicObject(); try { ...阅读全文

posted @ 2011-12-28 15:27 cutebear 阅读(5) 评论(0) 编辑

2011年12月23日

ManualResetEvent

摘要: check out the code.http://files.cnblogs.com/bear831204/BackgroundWorkerDemo.zip阅读全文

posted @ 2011-12-23 16:00 cutebear 阅读(8) 评论(0) 编辑

2011年11月1日

Dispatcher.Invoke and Dispatcher.BeginInvoke

摘要: Dispatcher.Invoke是同步执行,msdn描述:Executes the specified delegate with the specified arguments synchronously on the thread the Dispatcher is associated with.返回值是object, 是被调用的委托的返回值,如果该委托没有返回值,则为null。它有好几个重载方法,下面是其中之一:public Object Invoke( Delegate method, paramsObject[] args)Invoke is a synchronous oper阅读全文

posted @ 2011-11-01 16:44 cutebear 阅读(135) 评论(0) 编辑

2011年9月19日

转载:Finding Memory Leaks in WPF-based applications

摘要: http://blogs.msdn.com/b/jgoldb/archive/2008/02/04/finding-memory-leaks-in-wpf-based-applications.aspx很好的工具: .Net memory profiler.阅读全文

posted @ 2011-09-19 15:00 cutebear 阅读(12) 评论(0) 编辑

2011年9月5日

WPF中的各种Template

摘要: 1. FrameworkTemplate2. ControlTemplate - 控件模板允许您指定控件的可视结构。public class ControlTemplate : FrameworkTemplate {...}3. DataTemplate - 数据模板描述数据对象的可视结构。public class DataTemplate : FrameworkTemplate {...}作用于所有继承自ContentControl的内容控件的ContentTemplate属性和所有继承自ItemsControl的列表控件的ItemTemplate属性,即用于设置控件的数据内容。官方MSDN阅读全文

posted @ 2011-09-05 11:20 cutebear 阅读(93) 评论(0) 编辑

2011年8月31日

ILSpy-替代.Net Reflector的工具

摘要: ILSpy is the open-source .NET assembly browser and decompiler.Development started after Red Gate announced that the free version of .NET Reflector would cease to exist by end of February 2011.下载地址:http://wiki.sharpdevelop.net/ilspy.ashx阅读全文

posted @ 2011-08-31 11:03 cutebear 阅读(54) 评论(0) 编辑

2011年8月29日

try catch finally

摘要: 1. 下面的代码,1和2有什么不同:void Test() { // 1. try { } catch (Exception) { } // 2. try { } catch { } }如果用ildasm查看:View Code .method private hidebysig instance void Test() cil managed{ // Code size 22 (0x16) .maxstack 1 ...阅读全文

posted @ 2011-08-29 11:41 cutebear 阅读(28) 评论(0) 编辑

2011年8月24日

Const 和 readonly

摘要: const 关键字用于修改字段或局部变量的声明。 它指定字段或局部变量的值是常数,不能被修改。 例如: public const double gravitationalConstant = 6.673e-11; 只有 C# 内置类型(System.Object 除外)可以声明为 const。 下表列出了C# 内置类型: boolSystem.BooleanbyteSystem.BytesbyteSystem.SBytecharSystem.ChardecimalSystem.DecimaldoubleSystem.DoublefloatSystem.SingleintSystem.Int32阅读全文

posted @ 2011-08-24 17:27 cutebear 阅读(29) 评论(0) 编辑

C#程序中最大化窗口

摘要: 我们基本上可以使用Windows API函数ShowWindowAsync方法来正常化/最大化/最小化另一应用程序。private void button1_Click(object sender, EventArgs e) { // 返回写字板程序的句柄 IntPtr hWnd = FindWindow("Notepad", "Untitled - Notepad"); if (!hWnd.Equals(IntPtr.Zero)) { // SW_SHOWMAX...阅读全文

posted @ 2011-08-24 14:45 cutebear 阅读(37) 评论(0) 编辑

2011年8月23日

.Net的类型构造器-static构造函数

摘要: 品味细节,深入.NET的类型构造器转载自:http://msdn.microsoft.com/zh-cn/dd368012.aspx1 引言今天Artech 兄在《关于 Type Initializer和 BeforeFieldInit的问题,看看大家能否给出正确的解释 》一文中让我们认识了一个关于类型构造器调用执行的有趣示例,其中也相应提出了一些关于beforefieldinit 对于类型构造器调用时机的探讨,对于我们很好的理解类型构造器给出了一个很好的应用实践体验。作为补充,本文希望从基础开始再层层深入,把《关于Type Initializer 和 BeforeFieldInit 的问题,阅读全文

posted @ 2011-08-23 17:38 cutebear 阅读(25) 评论(0) 编辑

2011年8月17日

计算 2 的 1000次方

摘要: 参考自:http://www.cnblogs.com/herbert/archive/2011/02/13/1953943.htmlProject Euler problem 16215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 21000? 计算 2 的 1000次方的所有数字的和?这个设计大数乘方问题,通用的思路就是采用数组来分段处理大数,分段表示大数。下面的算法中,我采用的是“万进制”,用数组来存储数据。原理如下: 先说计阅读全文

posted @ 2011-08-17 16:35 cutebear 阅读(54) 评论(0) 编辑

2011年8月16日

Process Monitor and Process Explorer

摘要: Process Monitor是一款系统进程监视工具,Sysinternals被微软收购以后将原来著名的文件监视工具Filemon和注册表监视工具Regmon合并成了今天的Process Monitor。process monitor 下载地址:http://technet.microsoft.com/en-us/sysinternals/bb896645下面是一些使用process monitor的例子:Process Monitor - Hands-On Labs and Exampleshttp://blogs.technet.com/b/appv/archive/2008/01/24/阅读全文

posted @ 2011-08-16 13:56 cutebear 阅读(32) 评论(0) 编辑

2011年8月12日

Conditional 编译

摘要: 根据预处理标识符执行方法。Conditional 特性是 ConditionalAttribute 的别名,可应用于方法或继承自Attribute类的子类。如果应用在其他类上会产生编译错误。Applying ConditionalAttribute to a method indicates to compilers that a call to the method should not be ...阅读全文

posted @ 2011-08-12 15:38 cutebear 阅读(15) 评论(0) 编辑

调试windows service的onstart事件

摘要: 这是转载的,觉得很不错,原文:http://www.cnblogs.com/xzwplus/archive/2008/03/30/1129452.html关于调试windows service, 其实这是一个老生常谈的问题了. 通常的处理办法是, 在service运行后, 在调试器中选择attach to process. 然而这种做法也有一定的局限性, 例如在service启动时的OnStart事件中的代码, 基本上很难调试. 往往当attach到我们的service的时候, 这部分代码已经执行过了. 于是, 有人提出, 可以另写一个project来调用这个OnStart方法, 或将OnSt阅读全文

posted @ 2011-08-12 12:03 cutebear 阅读(48) 评论(0) 编辑

<2012年2月>
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910

导航

统计

公告

昵称:cutebear
园龄:3年6个月
粉丝:3
关注:0

搜索

 

常用链接

我的标签

随笔分类(93)

随笔档案(107)

.NET

Microsoft官方网站

Other

Silverlight

WPF 很好的博客

WPF 其他学习网站

积分与排名

最新评论

阅读排行榜