ToTimeZoneInfo method

TimeZone ToTimeZoneInfo(
  1. ExchangeService? service
)
Converts this time zone definition into a TimeZoneInfo structure. The service.

Implementation

TimeZone ToTimeZoneInfo(ExchangeService? service) {
  throw NotImplementedException("TimeZoneDefinition.ToTimeZoneInfo");
//            this.Validate();
//
//            TimeZone result;
//
//            // Retrieve the base offset to UTC, standard and daylight display names from
//            // the last transition group, which is the one that currently applies given that
//            // transitions are ordered chronologically.
//            TimeZoneTransitionGroup.CustomTimeZoneCreateParams creationParams =
//                this.transitions[this.transitions.Count - 1].TargetGroup.GetCustomTimeZoneCreationParams();
//
//            List<TimeZoneInfo.AdjustmentRule> adjustmentRules = <TimeZoneInfo.AdjustmentRule> [];
//
//            DateTime startDate = DateTime.MinValue;
//            DateTime endDate;
//            DateTime effectiveEndDate;
//
//            for (int i = 0; i < this.transitions.Count; i++)
//            {
//                if (i < this.transitions.Count - 1)
//                {
//                    endDate = (this.transitions[i + 1] as AbsoluteDateTransition).DateTime;
//                    effectiveEndDate = endDate.AddDays(-1);
//                }
//                else
//                {
//                    endDate = DateTime.MaxValue;
//                    effectiveEndDate = endDate;
//                }
//
//                // OM:1648848 Due to bad timezone data from clients the
//                // startDate may not always come before the effectiveEndDate
//                if (startDate < effectiveEndDate)
//                {
//                    TimeZoneInfo.AdjustmentRule adjustmentRule = this.transitions[i].TargetGroup.CreateAdjustmentRule(startDate, effectiveEndDate);
//
//                    if (adjustmentRule != null)
//                    {
//                        adjustmentRules.Add(adjustmentRule);
//                    }
//
//                    startDate = endDate;
//                }
//                else
//                {
//                    service.TraceMessage(
//                        TraceFlags.EwsTimeZones,
//                            string.Format(
//                                "The startDate '{0}' is not before the effectiveEndDate '{1}'. Will skip creating adjustment rule.",
//                                startDate,
//                                effectiveEndDate));
//                }
//            }
//
//            if (adjustmentRules.Count == 0)
//            {
//                // If there are no adjustment rule, the time zone does not support Daylight
//                // saving time.
//                result = TimeZoneInfo.CreateCustomTimeZone(
//                    this.Id,
//                    creationParams.BaseOffsetToUtc,
//                    this.Name,
//                    creationParams.StandardDisplayName);
//            }
//            else
//            {
//                result = TimeZoneInfo.CreateCustomTimeZone(
//                    this.Id,
//                    creationParams.BaseOffsetToUtc,
//                    this.Name,
//                    creationParams.StandardDisplayName,
//                    creationParams.DaylightDisplayName,
//                    adjustmentRules.ToArray());
//            }
//
//            return result;
}