Created
June 10, 2015 08:02
-
-
Save aklefdal/f4114cfbb37c32cbdf93 to your computer and use it in GitHub Desktop.
Døde personer
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
private bool IsPersonDead(DateTime? dodstidspunkt) | |
{ | |
if (dodstidspunkt == null) | |
return false; | |
DateTime deathDate = (DateTime)dodstidspunkt; | |
int compareResult = DateTime.Compare(DateTime.Now, deathDate); | |
if (compareResult > 0) | |
return true; | |
if (compareResult <= 0) | |
return false; | |
return false; | |
} |
bjartwolf
commented
Jun 10, 2015
private float ProbabilityOfPersonDead(DateTime? dodstidspunkt)
{
if (!dodstidspunkt.HasValue)
return 0.0f;
else if (dodstidspunkt.Value < DateTime.Now)
return 1.0f;
else
return float.NaN;
}
Ser ingen problemer med å bruke DateTime.Now heller. Det er litt morsomt at en person kan være levende og død i forskjellige tidssoner, litt avhengig av tidssonen du sammenligner i.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment