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
Date.prototype.clone = function () { | |
return new Date(this.valueOf()); | |
} | |
Date.prototype.addDays = function (days) { | |
var d = this.clone(); | |
d.setDate(d.getDate() + days); | |
return d; | |
} |
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
public static class TypeExtensions | |
{ | |
public static Type GetValueTypeIfNullable(this Type type) | |
{ | |
return type.IsNullable() ? type.GetGenericArguments()[0] : type; | |
} | |
public static bool IsNullable(this Type type) | |
{ | |
return (type.IsGenericType && typeof(Nullable<>) == type.GetGenericTypeDefinition()); |