nyk0r

Lambda Cast

Nov 18th, 2011
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.44 KB | None | 0 0
  1. var convertStrategy =
  2.    rowDef.UpdateFrequency.Equals("MONTHLY", StringComparison.InvariantCultureIgnoreCase)
  3.       ? (Func<DateTime, DateTime>) (e => new DateTime(e.Year, e.Month, 1))
  4.       : (Func<DateTime, DateTime>) (e => new DateTime(e.Year, 1, 1));
  5.  
  6. One of `(Func<DateTime, DateTime>)` casts is redundant, i.e. it is possible to remove either of them.
  7. But even if I replace `var` with `Func<DateTime, DateTime>` I still need one of them.
Advertisement
Add Comment
Please, Sign In to add comment