public void FunctionalUsage() { var repository = new ThingamajigRepository(); var queryResult = repository.Get(); queryResult.Found(thingamajig => Debug.WriteLine("found a thingamajig named: {0}", thingamajig)); queryResult.Missing(() => Debug.WriteLine("no thingamajig found")); }
public void ImperativeUsage() { var repository = new ThingamajigRepository(); var queryResult = repository.Get(); if (queryResult.HasResult) { Debug.WriteLine("found a thingamajig named: {0}", queryResult.Result.Name); } else { Debug.WriteLine("no thingamajig found"); } }