prosoft,
Ha Ha, talk about decoupling..., this is precisely what I am asking/saying
i.e., why is GetMonthName not part of DateTime or why does
DateTimeFormatInfo accept integers and DateTime object, this is it!!!!!!!!
Was that a rhetorical question?
As I stated I would expect DateTimeFormatInfo.GetMonthName to either accept
a DateTime object, or at the very least GetMonthName would accept both month
& year as a parameter. See below for why I am leaning toward month & year as
a parameter.
The DateTimeFormatInfo knows how to format DateTime objects, I can see why
there are two types. Two types keep DateTime small, plus it allows date &
time formatting settings to be shared.
DateTime is an immutable structure as its good to have full value semantics
on a Date/Time values, you do not want aliasing on DateTime values.
DateTimeFormatInfo is a not inheritable class, as there is no real behavior
that needs to change, other then what Calendar offers. Being a class allows
you to have a single instance of DateTimeFormatInfo used in many places, in
other words you want aliasing.
GetMonthName is more of a Formatting feature then a "value" feature, hence I
would leave it on DateTimeFormatInfo.
Calendar is a must inherit class, as you have different calendars
(Gregorian, Hebrew, Hindi) that have different behaviors (Leap months,
different leap days).
The one advantage of DateTimeFormatInfo class accepting integers is if any
one defines a true Date type and a true Time type, then DateTimeFormatInfo
can still be used.
The only real short coming I see is that GetMonthName is missing the year
parameter. Or we are missing how it is suppose to work...
A true Date type is a structure that contains only a Date value (no time
part).
A true Time type is a structure that contains only a Time value (no date
part).
AS/400, DB2, Oracle, and other larger data base systems have Time, Date, and
DateTime data types, unlike .NET & SQL Server which currently only have Date
& Time combined into a single type. (I'm not sure if SQL Server 2005 will
offer us Time & Date types, however with .NET CLR integration one should be
able to add Time & Date types).
Hope this helps
Jay