Wednesday, July 29, 2009

Using Lambda Expressions for Events

In the past, we created events using the following format …

public delegate void EventListener(object src, object context);
public event EventListener SomeEvent;
public void Init()
{
SomeEvent += OnSomeEvent;
}
public void OnSomeEvent(object src, object context)
{
}

With lambda expressions, we can do the following …

public event Action<object, object> SomeEvent;
public void Init()
{
SomeEvent += (s,c) => {};
}

No doubt there are other ways to do it, but I find this simpler and more concise.

Friday, July 24, 2009

Interesting reading on Web Gardens

If you want to learn more about Web Gardens, and gains and issue you might face, read these articles.

Available right-clicking an application pool and choosing Properties in the IIS Management snap-in.

One good learning from these articles was "Web gardening can be a good way to see if your application will be able to function in a Web farm scenario on multiple servers reasonably well"