var larry = new CustomerBuilder().WithName("Larry").WithAge(30).Build();
The fluent interface applied to the code makes it incredibly simple for anyone to ascertain the intent of this code at a glance. The key to this ability to easily chain members together in nearly any order is that each member of the class returns a reference to itself. This reference can then be used to to add additional commands onto the chain. Let’s take a look at the CustomerBuilder class…
internal class CustomerBuilder
{
private string _name;
private int _age;
public Customer Build()
{
return new Customer(_name, _age);
}
public CustomerBuilder WithName(string name)
{
_name = name;
return this;
}
public CustomerBuilder WithAge(int age)
{
_age = age;
return this;
}
}
var person = new Customer() { Name = "Larry", Age = 30 };
PowerPoint Slide
|
Keyboard Shortcut
|
|
Day 1
Show Shortcut Keys
|
|
Day 2
Open Smart Tag
Ctrl + .
Open Smart Tag
Ctrl + Shift + F10
|
|
Day 3
Navigate Forwards
Ctrl + –
Navigate Backwards
Ctrl + Shift + -
|
|
Day 4
Tools, Options…, Display Line Numbers
|
|
Day 5
Cycle Clipboard Ring
Ctrl + Shift + V
|
|
Day 6
Go to Definition
F12
|
|
Day 7
Go to Line
Ctrl + G
|
|
Day 8
Vertical Block Selection
Alt + Mouse
|
|
Day 9
View Properties Window
F4
View Properties Window
Alt + Enter
|
|
Day 10
Comment Selection
Ctrl + K, Ctrl + C
Uncomment Selection
Ctrl + K, Ctrl + U
|
|
Day 11
Toggle Code / Design Views
F7
|
|
Day 12
Make Lowercase
Ctrl + U
Make Uppercase
Ctrl + Shift + U
|
|
Day 13
Incremental Search
|
Ctrl + I
|
|
Day 14
Ctrl + Tab Navigator Window
Ctrl + Tab
|
|
Day 15
View Object Browser
Ctrl + Alt + J
|
|
Day 16
Delete Line
Ctrl + L
|
|
Day 17
Add New Item to Project
Ctrl + Shift + A
|
|
Day 18
Close Current Document
Ctrl + F4
|
|
Day 19
Toggle Breakpoint
F9
|
|
Day 20
Find All References
Shift + F12
|
|
Day 21
Move Cursor One Word Right
Ctrl + Right Arrow
Move Cursor One Word Left
Ctrl + Left Arrow
|
|
Day 22
The Rename Refactor
Ctrl + R, R
|
|
Day 23
Find All References
Shift + F12
|
|
Day 24
Format Document
Ctrl + K, Ctrl + D
|
|
Day 25
View Task List
Ctrl + \, Ctrl + T
|
|
Day 26
Find in Files
Ctrl + Shift + F
|
|
Day 27
Toggle Outlining Expansion
Ctrl + M, Ctrl + M
|
|
Day 28
Close All Documents
Alt + W, L
|
|
Day 29
Save Any Output Window
Ctrl + S
|
|
Day 30
Build Solution
Ctrl + S
|
|
Day 31
Reset Window Layout
Alt, W, R
|
url rewiting
http://www.addedbytes.com/apache/url-rewriting-for-beginners/
linq 101 examples
http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx