var blog = new ThoughtStream(me); RSS 2.0
 Thursday, May 15, 2008

I've been toying around with various ideas in code, and I've come to the conclusion that the following formula is true:

Lambda Expressions + Func<> and Action<> = Easy Command Patterns

As a very contrived, quick example:

public class DoStuff
{
    private Func<CommandResult> Step1 { get; set; }
 
    private Func<CommandResult> Step2 { get; set; }
 
    public DoStuff(Func<CommandResult> step1, Func<CommandResult> step2)
    {
        Step1 = step1;
        Step2 = step2;
    }
 
    public void DoTheStuffProcessing()
    {
        CommandResult result = step1();
 
        if (result.Succeeded)
        {
            step2();
        }
    }
}

It's ... so ... beautiful ...

Thursday, May 15, 2008 2:00:34 PM (Central Standard Time, UTC-06:00)  #    Comments [0]. Trackback 
Tags: .NET | Lambda Expressions | Principles and Patterns

Comments are closed.
Navigation
About Me
View Derick Bailey's profile on LinkedIn

Send mail to the author(s) Contact Me
Archive
<December 2008>
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2008
Derick Bailey
Sign In
Statistics
Total Posts: 91
This Year: 91
This Month: 0
This Week: 0
Comments: 40
Themes
Pick a theme:
All Content © 2008, Derick Bailey
DasBlog theme 'Business' created by Christoph De Baene (delarou)