Exemplo n.º 1
0
 /// <summary>
 /// Converts a single value into a sorted list containing that value the specified number of times. The list is treated as though it were sorted by the specified comparison delegate.
 /// </summary>
 /// <typeparam name="T">The type of the value.</typeparam>
 /// <param name="source">The value.</param>
 /// <param name="comparer">The comparison delegate that defines how the list is sorted.</param>
 /// <param name="count">The number of times <paramref name="source"/> is repeated. If <paramref name="count"/> is less than or equal to 0, an empty list is returned.</param>
 /// <returns>A sorted list containing <paramref name="count"/> elements, all equal to <paramref name="source"/>.</returns>
 public static ISortedList <T> Repeat <T>(T source, Func <T, T, int> comparer, int count)
 {
     return(new SortedListWrapper <T>(ListSource.Repeat(source, count), A.Comparer(comparer)));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Converts a single value into a sorted list containing that value the specified number of times. The list is treated as though it were sorted by the specified comparison object.
 /// </summary>
 /// <typeparam name="T">The type of the value.</typeparam>
 /// <param name="source">The value.</param>
 /// <param name="comparer">The comparison object that defines how the list is sorted.</param>
 /// <param name="count">The number of times <paramref name="source"/> is repeated. If <paramref name="count"/> is less than or equal to 0, an empty list is returned.</param>
 /// <returns>A sorted list containing <paramref name="count"/> elements, all equal to <paramref name="source"/>.</returns>
 public static ISortedList <T> Repeat <T>(T source, IComparer <T> comparer, int count)
 {
     return(new SortedListWrapper <T>(ListSource.Repeat(source, count), comparer));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Converts a single value into a sorted list containing that value the specified number of times. The list is treated as though it were sorted by the default comparison object.
 /// </summary>
 /// <typeparam name="T">The type of the value.</typeparam>
 /// <param name="source">The value.</param>
 /// <param name="count">The number of times <paramref name="source"/> is repeated. If <paramref name="count"/> is less than or equal to 0, an empty list is returned.</param>
 /// <returns>A sorted list containing <paramref name="count"/> elements, all equal to <paramref name="source"/>.</returns>
 public static ISortedList <T> Repeat <T>(T source, int count)
 {
     return(new SortedListWrapper <T>(ListSource.Repeat(source, count), Comparer <T> .Default));
 }