Example #1
0
 private static IArraySortHelper <T> CreateArraySortHelper()
 {
     if (typeof(IComparable <T>).IsAssignableFrom(typeof(T)))
     {
         defaultArraySortHelper = (IArraySortHelper <T>)RuntimeTypeHandle.Allocate(typeof(GenericArraySortHelper <string>).TypeHandle.Instantiate(new Type[] { typeof(T) }));
     }
     else
     {
         defaultArraySortHelper = new ArraySortHelper <T>();
     }
     return(defaultArraySortHelper);
 }
Example #2
0
 private static IArraySortHelper <TKey, TValue> CreateArraySortHelper()
 {
     if (typeof(IComparable <TKey>).IsAssignableFrom(typeof(TKey)))
     {
         ArraySortHelper <TKey, TValue> .defaultArraySortHelper = (IArraySortHelper <TKey, TValue>)RuntimeTypeHandle.Allocate(typeof(GenericArraySortHelper <string, string>).TypeHandle.Instantiate(new Type[]
         {
             typeof(TKey),
             typeof(TValue)
         }));
     }
     else
     {
         ArraySortHelper <TKey, TValue> .defaultArraySortHelper = new ArraySortHelper <TKey, TValue>();
     }
     return(ArraySortHelper <TKey, TValue> .defaultArraySortHelper);
 }