Skip to content

somegenericdev/DateTimeEqualityExtensions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DateTimeEqualityExtensions

Get me on

Equality APIs for nullable DateTimes that don't suck donkey ass.

Why

The equality semantics of nullable DateTimes in C# don't make the slightest sense. I genuinely have no idea of what they were thinking. The "right" way to deal with nullable DateTimes would be using Nullable.Compare instead of equality operators, but it feels quite inconvenient and unnatural.

This library provides some wrappers over Nullable.Compare that feel more natural and ergonomic.

DateTime? dt = DateTime.Now;
DateTime? dt2 = null;
bool isGreater = dt > dt2; //false
bool isGreater2 = dt.IsGreater(dt2); //true

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages