William Basics

Keep learning, never ending.

[UnitTest] -How to test a private method in C#?

引言 对于是否要测试私有方法的争论由来已久。很多人对于这个问题总是不从正面回答,反而掉过头来尝试说服提问者放弃这个想法。是的,我们虽然有很多理

[WPF] - Data Binding

Introduction 在应用了MVVM设计模式的情况下,Data Binding特别常见。因为我们需要通过它来将前后端分离,让UI的归UI,业务归业务。 所谓Dat

[Algorithm] - C# - Join the xml nodes name by using backtracking

背景与问题介绍 XML文件,大家都很熟悉了。其中的各个节点组成了一颗“树”。 比如 <A> <B> <C/> </B> <D> <E/> </D> <F> <G/> </F> </A> “客户”要求希望开发一个程序,来通过节点

[Better code] - C# - Using Indexer

什么是Indexer? Indexer 可以帮助我们如同用索引来访问数组中的元素一样来访问自定义对象中的元素。它不仅可以帮助我们写出更流畅的代码,更提高了代

[UnitTest] - 用FluentAssertions让单元测试代码更优美

Introduction 早在2005年,Martin Fowler就提出了“fluent interface“这种编码风格(link)。我们比较熟悉的LINQ就是这”

WPF - Realtime charting by using DevExpress WPF toolkit

Realtime charting by using DevExpress WPF toolkit Realtime chart的用途十分广泛,特别是在测量领域尤为常见。 这个代码样例实现了一个realtime chart的原型,借助了DevEx

WPF - Localization on-the-fly

WPF的本地化或者说对多国语言的支持,微软官方给出的方案是借助Uid加上WPF Samples中的小工具locBaml来实现。这种方案的一个缺

WPF - Locbaml : Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly

这个error信息十分隐晦,解决方案是将LocBaml.exe拷贝到project的build目录下(xxxproject\bin\Debu

WPF - Creating Control Template Assembly

WPF - Creating Control Template Assembly 1. 新建一个WPF User Control Library project 删除 User Control1.xaml 2. Add New Item - Resource Dictionary MyButtonTemplate.xaml <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> </ResourceDictionary> 在MyButtonTemplate.xaml中加入template定义。

Go Concurrency

Concurrency in Go Go提供了两个独特创新的方式来实现并发,他们就是goroutine和channel。 goroutine是Go程序中可执行的最小单元。c