@@ -9,6 +9,9 @@ public struct LengthPercentageOrNumber
99 private static readonly Regex _lengthRegex = new Regex ( @"(?<Value>\d+(?:\.\d+)?)\s*(?<Unit>%|\w+)?" , RegexOptions . Compiled | RegexOptions . Singleline ) ;
1010 private readonly LengthContext _context ;
1111 private readonly double _value ;
12+ /// <summary>
13+ /// Represents a length, percentage, or number value that has been resolved based on the context.
14+ /// </summary>
1215 public double Value => ResolveValue ( ) ;
1316
1417
@@ -130,15 +133,33 @@ private double ResolveValue()
130133 }
131134 }
132135 /// <summary>
133- ///
136+ /// Represents a length that may have a value that is context dependent.
134137 /// </summary>
135- /// <param name="value"></param>
136- /// <param name="context">If null, units will be ignored</param>
138+ /// <param name="value">The numerical part of the length that is related to the <paramref name="context"/> </param>
139+ /// <param name="context">If <see langword=" null"/> , units will be ignored</param>
137140 public LengthPercentageOrNumber ( double value , LengthContext context )
138141 {
139142 _context = context ;
140143 _value = value ;
141144 }
145+ /// <summary>
146+ /// Parses a string representation of a length, percentage, or number value into a <see cref="LengthPercentageOrNumber"/> instance.
147+ /// </summary>
148+ /// <param name="owner">
149+ /// The element that the length is associated with.
150+ /// </param>
151+ /// <param name="value">A string representation of a length</param>
152+ /// <param name="orientation">Used to establish the context of the length.
153+ /// Should be <see cref="LengthOrientation.Horizontal"/> for inherntly horizontal values like 'x' and 'dx'.
154+ /// Should be <see cref="LengthOrientation.Vertical"/> for inherntly vertical values like 'y' and 'dy'.
155+ /// Should be <see cref="LengthOrientation.None"/> for other values.
156+ /// </param>
157+ /// <returns>
158+ /// A <see cref="LengthPercentageOrNumber"/> instance that represents the parsed value.
159+ /// </returns>
160+ /// <exception cref="ArgumentException">
161+ /// Thrown when the provided value is not a valid length, percentage, or number.
162+ /// </exception>
142163 public static LengthPercentageOrNumber Parse ( Shape owner , string value , LengthOrientation orientation = LengthOrientation . None )
143164 {
144165 var lengthMatch = _lengthRegex . Match ( value . Trim ( ) ) ;
0 commit comments