Skip to content

Instantly share code, notes, and snippets.

@rarous
Created April 16, 2013 09:09
Show Gist options
  • Select an option

  • Save rarous/5394524 to your computer and use it in GitHub Desktop.

Select an option

Save rarous/5394524 to your computer and use it in GitHub Desktop.
// before
var bdayEl = el.Descendant("DatumNarozeni");
var birthday = bdayEl != null ? (DateTime?)Convert.ToDateTime(bdayEl.Value) : null;
// after Maybe
var birthday = from bday in el.Descendant("DatumNarozeni").ToMaybe()
select Convert.ToDateTime(bday.Value).ToMaybe();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment