Open GoogleCodeExporter opened 8 years ago
Nevermind, don't use the above constructor, I didn't think it through very
well.
(I'm a lazy programmer after all) Here is a better one:
public MigrationAttribute(Int16 year, byte month, byte day, byte step)
{
if (day > 31)
throw new ArgumentOutOfRangeException("day");
if (month > 12)
throw new ArgumentOutOfRangeException("month");
if (year > 4096)
throw new ArgumentOutOfRangeException("year");
checked
{
// | year ||mnt||day| | step |
// 00000000 00000000 00000000 00000000
Version = year << 17 + (month << 13) + (day << 8) + step;
}
}
Original comment by hired.m...@gmail.com
on 28 Apr 2010 at 4:07
It would be better to use the built in DateTime or Calendar objects to validate
the
time stamp. Also, different projects may want slightly different standards on
version numbers so it could make sense to provide different overloads. I would
consider including:
1) date, hour, minute
2) date, hour, minute, second
3) date, step (as hired.mind shows)
Original comment by WalkerCo...@gmail.com
on 24 May 2010 at 8:33
Yeah I would love to have used a DateTime object but unfortunately it's not
possible
due to the nature of Attributes. Attribute arguments must be a constant type.
Original comment by hired.m...@gmail.com
on 26 May 2010 at 8:27
Original issue reported on code.google.com by
hired.m...@gmail.com
on 23 Apr 2010 at 6:24