@@ -34,6 +34,13 @@ public static string SafeToString(this object obj)
3434 return str ;
3535 }
3636
37+ /// <summary>
38+ /// Get the maximum of the elements from the given enumerable.
39+ /// </summary>
40+ /// <typeparam name="T">Type of object for which the enumerable is defined.</typeparam>
41+ /// <param name="elements">An enumerable object of type T</param>
42+ /// <param name="comparer">A comparer for ordering elements of type T. The comparer should handle null values.</param>
43+ /// <returns>An object of type T. If the enumerable is empty or has all null elements, then the method returns null.</returns>
3744 public static T MaxElement < T > ( this IEnumerable < T > elements , Func < T , T , int > comparer ) where T : class
3845 {
3946 if ( elements == null )
@@ -63,12 +70,27 @@ public static T MaxElement<T>(this IEnumerable<T> elements, Func<T,T,int> compar
6370 return maxElement ;
6471 }
6572
73+ /// <summary>
74+ /// Get the minimum of the elements from the given enumerable.
75+ /// </summary>
76+ /// <typeparam name="T">Type of object for which the enumerable is defined.</typeparam>
77+ /// <param name="elements">An enumerable object of type T</param>
78+ /// <param name="comparer">A comparer for ordering elements of type T. The comparer should handle null values.</param>
79+ /// <returns>An object of type T. If the enumerable is empty or has all null elements, then the method returns null.</returns>
6680 public static T MinElement < T > ( this IEnumerable < T > elements , Func < T , T , int > comparer ) where T : class
6781 {
6882 return MaxElement < T > ( elements , ( elementX , elementY ) => - 1 * comparer ( elementX , elementY ) ) ;
6983 }
7084
71- public static int ExtentWitdhComparer ( this IScriptExtent extentX , IScriptExtent extentY )
85+ /// <summary>
86+ /// Compare extents with respect to their widths.
87+ ///
88+ /// Width of an extent is defined as the difference between its EndOffset and StartOffest properties.
89+ /// </summary>
90+ /// <param name="extentX">Extent of type IScriptExtent.</param>
91+ /// <param name="extentY">Extent of type IScriptExtent.</param>
92+ /// <returns>0 if extentX and extentY are equal in width. 1 if width of extent X is greater than that of extent Y. Otherwise, -1.</returns>
93+ public static int ExtentWidthComparer ( this IScriptExtent extentX , IScriptExtent extentY )
7294 {
7395
7496 if ( extentX == null && extentY == null )
@@ -102,6 +124,13 @@ public static int ExtentWitdhComparer(this IScriptExtent extentX, IScriptExtent
102124 }
103125 }
104126
127+ /// <summary>
128+ /// Check if the given coordinates are wholly contained in the instance's extent.
129+ /// </summary>
130+ /// <param name="scriptExtent">Extent of type IScriptExtent.</param>
131+ /// <param name="line">1-based line number.</param>
132+ /// <param name="column">1-based column number</param>
133+ /// <returns>True if the coordinates are wholly contained in the instance's extent, otherwise, false.</returns>
105134 public static bool Contains ( this IScriptExtent scriptExtent , int line , int column )
106135 {
107136 if ( scriptExtent . StartLineNumber > line || scriptExtent . EndLineNumber < line )
0 commit comments