Created
June 30, 2015 14:45
-
-
Save DapperJohn/a7f305a4fd76b3d5dc2e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////////////////// | |
//if datetime is null return min value | |
/////////////////////////////////////// | |
var tradeDate = (r["Trade Date"]).ToString(); | |
var settlementDate = (r["Stl Date"]).ToString(); | |
if ((r["Stl Date"]) != null){ | |
tradeDate = Convert.ToDateTime(r["Trade Date"]).ToString("MM/dd/yyyy"); | |
} | |
else tradeDate = DateTime.MinValue.ToString(); | |
if ((r["Stl Date"]) != null){ | |
settlementDate = Convert.ToDateTime(r["Stl Date"]).ToString("MM/dd/yyyy"); | |
} | |
else settlementDate = DateTime.MinValue.ToString(); | |
////////////////////////////////////////////// | |
//can be easily written like this instead | |
////////////////////////////////////////////// | |
var tradeDate = (r["Stl Date"]) != null ? Convert.ToDateTime(r["Trade Date"]).ToString("MM/dd/yyyy") : DateTime.MinValue.ToString(); | |
var settlementDate = (r["Stl Date"]) != null ? Convert.ToDateTime(r["Stl Date"]).ToString("MM/dd/yyyy") : DateTime.MinValue.ToString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment