sergun/monads.net — pull request #8 by mirik123 (2014-12-05 05:43:30+00:00)
Title: Added monads "Do" and "DoSelect" with nullaction

Added monad "Do" with action that runs when source is null, for example for logging
Added monad "DoSelect" with null action that acts like LINQ Select clause but with additional action for nulled source.

#### Examples of using Do/DoSelect

BEFORE:
```
object o1 = entry.Value.GetType().GetProperty("Value", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(entry.Value, null);
if (o1.GetType().ToString() == "System.Web.SessionState.InProcSessionState")
{
var sess = o1.GetType().GetField("_sessionItems", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(o1);
if (sess != null && sess is SessionStateItemCollection) activeSessions.Add(sess);
else
Logger.LogError("Get Sessions list error", "no session items exist");
}
else
Logger.LogError("Get Sessions list error", "no session exists");
```

AFTER:
```
entry.Value.GetType().GetProperty("Value", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(entry.Value, null)
.If(x => x.GetType().ToString() == "System.Web.SessionState.InProcSessionState")
.DoSelect(x => x.GetType().GetField("_sessionItems", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(x),
_ => Logger.LogError("Get Sessions list error", "no session exists"))
.If(x => x is SessionStateItemCollection)
.Do(x => activeSessions.Add(x),
_ => Logger.LogError("Get Sessions list error", "no session items exist"));
```