NullableTypes/src/Types NullConvert.cs,1.7,1.8
Status: Inactive
Brought to you by:
lukadotnet
From: Damien G. <dam...@us...> - 2005-10-11 12:18:45
|
Update of /cvsroot/nullabletypes/NullableTypes/src/Types In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4083/src/Types Modified Files: NullConvert.cs Log Message: Remove formatted NullableGuid conversion and add XML documentation to NullableTimeSpan conversion. Index: NullConvert.cs =================================================================== RCS file: /cvsroot/nullabletypes/NullableTypes/src/Types/NullConvert.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NullConvert.cs 6 Oct 2005 16:05:35 -0000 1.7 --- NullConvert.cs 11 Oct 2005 12:18:52 -0000 1.8 *************** *** 13,16 **** --- 13,17 ---- // 28-Jan-2005 DamienG Upgrade Added helpers for NullableGuid and added regions. // 26-Sep-2005 DamienG Upgrade Added helpers for NullableTimeSpan. + // 11-Oct-2005 DamienG Upgrade Remove formated NullableGuid converter and added XML docs for NullableTimeSpan. // *************** *** 139,143 **** /// <summary> /// Converts the specified <see cref="NullableGuid"/> value to an equivalent ! /// <see cref="System.Byte"/> value using a conventional <see cref="System.Byte"/> value to /// represent the <see cref="NullableGuid.Null"/> value. /// </summary> --- 140,144 ---- /// <summary> /// Converts the specified <see cref="NullableGuid"/> value to an equivalent ! /// <see cref="System.Guid"/> value using a conventional <see cref="System.Guid"/> value to /// represent the <see cref="NullableGuid.Null"/> value. /// </summary> *************** *** 161,205 **** /// <summary> - /// Converts the specified <see cref="NullableGuid"/> value to an equivalent - /// <see cref="System.String"/> value using a conventional <see cref="System.String"/> value to - /// represent the <see cref="NullableGuid.Null"/> value. - /// </summary> - /// <param name="x"> - /// The <see cref="NullableGuid"/> value to convert. - /// </param> - /// <param name="conventionalNullValue"> - /// The <see cref="System.String"/> value that conventionally represent the - /// <see cref="NullableGuid.Null"/> value. - /// </param> - /// <param name="format"> - /// A string that specifies the return format of <paramref name="x"/> if it is not - /// <see cref="NullableGuid.Null"/>. - /// </param> - /// <returns> - /// <paramref name="conventionalNullValue"/> if <paramref name="x"/> is - /// <see cref="NullableGuid.Null"/> otherwise the equivalent string of the - /// <see cref="NullableGuid.Value"/> of <paramref name="x"/> formatted as specified by - /// <paramref name="format"/>. - /// </returns> - /// <exception cref="System.FormatException"> - /// <paramref name="x"/> is not <see cref="NullableGuid.Null"/> and the <paramref name="format"/> - /// is invalid for a Byte. - /// </exception> - /// <remarks> - /// If <paramref name="format"/> is a null reference (Nothing in Visual Basic) or an empty string (""), - /// general format specifier ("G") will be used. - /// <para> - /// The <see cref="System.Globalization.NumberFormatInfo"/> for the current culture is used when - /// applying fomatting. - /// </para> - /// </remarks> - public static string From(NullableGuid x, string conventionalNullValue, string format) { - if (x.IsNull) - return conventionalNullValue; - - return x.Value.ToString(format, sysGlb.CultureInfo.CurrentCulture); - } - - /// <summary> /// Converts the specified <see cref="NullableInt16"/> value to an equivalent /// <see cref="System.Int16"/> value using a conventional <see cref="System.Int16"/> value to --- 162,165 ---- *************** *** 686,693 **** /// <see cref="NullableTimeSpan.Null"/> value. /// </param> - /// <param name="format"> - /// A string that specifies the return format of <paramref name="x"/> if it is not - /// <see cref="NullableTimeSpan.Null"/>. - /// </param> /// <returns> /// <paramref name="conventionalNullValue"/> if <paramref name="x"/> is --- 646,649 ---- *************** *** 696,705 **** /// <paramref name="format"/>. /// </returns> - /// <exception cref="System.FormatException"> - /// The length of <paramref name="format"/> is 1, and it is not one of the format specifier characters - /// defined for DateTimeFormatInfo. - /// <para> -or- </para> - /// <paramref name="format"/> does not contain a valid custom format pattern. - /// </exception> public static sys.TimeSpan From(NullableTimeSpan x, sys.TimeSpan conventionalNullValue) { if (x.IsNull) --- 652,655 ---- *************** *** 1352,1355 **** --- 1302,1332 ---- } + /// <summary> + /// Converts the specified <see cref="System.String"/> representation of a number to its + /// <see cref="NullableTimeSpan"/> equivalent. + /// </summary> + /// <param name="x"> + /// The <see cref="System.String"/> value to convert. + /// </param> + /// <param name="conventionalNullValue"> + /// The <see cref="System.String"/> value that conventionally represent the null value. + /// </param> + /// <returns> + /// <see cref="NullableTimeSpan.Null"/> if <paramref name="x"/> is equals to + /// <paramref name="conventionalNullValue"/> otherwise a <see cref="NullableTimeSpan"/> constructed + /// parsing <paramref name="x"/>. + /// </returns> + /// <exception cref="System.ArgumentNullException"> + /// <paramref name="x"/> is a null reference (Nothing in Visual Basic) and + /// <paramref name="conventionalNullValue"/> is not a null reference. + /// </exception> + /// <exception cref="System.FormatException"> + /// <paramref name="x"/> value is not <paramref name="conventionalNullValue"/> and + /// <see cref="NullableDateTime.Parse"/> failed on <paramref name="x"/>. + /// </exception> + /// <exception cref="System.OverflowException"> + /// <paramref name="x"/> value is not <paramref name="conventionalNullValue"/> and + /// <see cref="NullableDateTime.Parse"/> caused an overflow on <paramref name="x"/>. + /// </exception> public static NullableTimeSpan ToNullableTimeSpan(sys.TimeSpan x, sys.TimeSpan conventionalNullValue) { if (x == conventionalNullValue) |