/// <summary> /// Returns a String that represents the current Object. /// </summary> /// <returns>A String that represents the current Object.</returns> public override string ToString() { StringBuilder buffer = new StringBuilder(256); foreach (TsCHdaTimeOffset offset in (ICollection)this) { if (offset.Value >= 0) { buffer.Append("+"); } buffer.AppendFormat("{0}", offset.Value); buffer.Append(TsCHdaTimeOffset.OffsetTypeToString(offset.Type)); } return(buffer.ToString()); }
/////////////////////////////////////////////////////////////////////// #region Private Methods /// <summary> /// Creates a new offset object from the components extracted from a string. /// </summary> private static TsCHdaTimeOffset CreateOffset(bool positive, int magnitude, string units) { foreach (TsCHdaRelativeTime offsetType in Enum.GetValues(typeof(TsCHdaRelativeTime))) { if (offsetType == TsCHdaRelativeTime.Now) { continue; } if (units == TsCHdaTimeOffset.OffsetTypeToString(offsetType)) { TsCHdaTimeOffset offset = new TsCHdaTimeOffset { Value = (positive) ? magnitude : -magnitude, Type = offsetType }; return(offset); } } throw new ArgumentOutOfRangeException("units", units, "String is not a valid offset time type."); }