Skip to content

Commit ba49e26

Browse files
committed
Include-GenerateUnitClassSourceCode.ps1: Add xmldoc to Parse() method
Parameters and the new exceptions being thrown.
1 parent 37a9c48 commit ba49e26

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

UnitsNet/Scripts/Include-GenerateUnitClassSourceCode.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ namespace UnitsNet
281281
/// <summary>
282282
/// Parse a string with one or two quantities of the format "&lt;quantity&gt; &lt;unit&gt;".
283283
/// </summary>
284+
/// <param name="str">String to parse. Typically in the form: {number} {unit}</param>
285+
/// <param name="formatProvider">Format to use when parsing number and unit. If it is null, it defaults to <see cref="NumberFormatInfo.CurrentInfo"/> for parsing the number and <see cref="CultureInfo.CurrentUICulture"/> for parsing the unit abbreviation by culture/language.</param>
284286
/// <example>
285287
/// Length.Parse("5.5 m", new CultureInfo("en-US"));
286288
/// </example>
@@ -289,6 +291,16 @@ namespace UnitsNet
289291
/// Expected string to have one or two pairs of quantity and unit in the format
290292
/// "&lt;quantity&gt; &lt;unit&gt;". Eg. "5.5 m" or "1ft 2in"
291293
/// </exception>
294+
/// <exception cref="AmbiguousUnitParseException">
295+
/// More than one unit is represented by the specified unit abbreviation.
296+
/// Example: Volume.Parse("1 cup") will throw, because it can refer to any of
297+
/// <see cref="VolumeUnit.MetricCup" />, <see cref="VolumeUnit.UsLegalCup" /> and <see cref="VolumeUnit.UsCustomaryCup" />.
298+
/// </exception>
299+
/// <exception cref="UnitsNetException">
300+
/// If anything else goes wrong, typically due to a bug or unhandled case.
301+
/// We wrap exceptions in <see cref="UnitsNetException" /> to allow you to distinguish
302+
/// Units.NET exceptions from other exceptions.
303+
/// </exception>
292304
public static $className Parse(string str, IFormatProvider formatProvider = null)
293305
{
294306
if (str == null) throw new ArgumentNullException("str");

0 commit comments

Comments
 (0)