Issue 218 in noda-time: Consider moving factory methods from BclDateTimeZone to BclDateTimeZoneSource

7 views
Skip to first unread message

noda...@googlecode.com

unread,
May 4, 2013, 5:45:37 AM5/4/13
to noda...@googlegroups.com
Status: New
Owner: malcolm.rowe
Labels: Type-Defect Priority-Low

New issue 218 by malcolm.rowe: Consider moving factory methods from
BclDateTimeZone to BclDateTimeZoneSource
http://code.google.com/p/noda-time/issues/detail?id=218

For the TZDB source, we can obtain a DateTimeZone via:

TzdbDateTimeZoneSource source;
DateTimeZone zone = source.ForId(id);

For the BCL source, we can use:

BclDateTimeZoneSource source;
BclDateTimeZone zone = source.ForId(id);

(note the covariant return value)

or we can use:

BclDateTimeZone zone = BclDateTimeZone.ForSystemDefault();
BclDateTimeZone zone = BclDateTimeZone.FromTimeZoneInfo(timeZoneInfo);

I can somewhat understand why, but the For/From bothers me for a start, and
I wonder whether it'd be clearer to put these on BclDateTimeZoneSource; in
particular, it'd probably make explaining why
DateTimeZoneCache.GetSystemDefault() can potentially fail easier (because
it calls BclDateTimeZoneSource.MapTimeZoneId / ForId).

This might not be worth doing (we'd need to obsolete the existing methods,
for example), but I thought I'd raise it for future discussion.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages