|
static IEnumerable< T > | ToAotEnumerable< T > (this IEnumerable< T > source) |
| Convert to the sequence supports AOT, basically for a value type. More...
|
|
static string | JoinText< T > (this IEnumerable< T > source, string separator="\n") |
| Join the specified sequence to a string , basically for logging. More...
|
|
static bool | IsExist (this object value) |
| Determine if the specified object is existing, i.e., not equals null . More...
|
|
static IEnumerable< T > | OfExist< T > (this IEnumerable< T > source) |
| Filter elements which is not null . More...
|
|
static IEnumerable< string > | OfText (this IEnumerable< string > source) |
| Filter elements which is not null or empty string . More...
|
|
static IEnumerable< T > | OfMatch< T > (this IEnumerable< T > source, string pattern, Func< T, string > selector=null, RegexOptions options=RegexOptions.ExplicitCapture) |
| Filter elements which matches the specified regex pattern. More...
|
|
static Dictionary< T, U > | ToDictionary< T, U > (this IEnumerable< IGrouping< T, U >> source) |
| Create a Dictionary<TKey, TValue> from the sequence of IGrouping<TKey, TValue> . More...
|
|
static Dictionary< T, U > | ToDictionary< T, U > (this IEnumerable< KeyValuePair< T, U >> source) |
| Create a Dictionary<TKey, TValue> from the sequence of KeyValuePair<TKey, TValue> . More...
|
|
static Dictionary< T, U > | KeysToDictionary< T, U > (this IEnumerable< T > source, Func< T, U > elementSelector) |
| Create a Dictionary<TKey, TValue> from the sequence according to an element selector function. More...
|
|
static IEnumerable< T > | OrderByRandom< T > (this IEnumerable< T > source) |
| Sort the elements of a sequence in random order. More...
|
|
static T | RandomElement< T > (this IEnumerable< T > source) |
| Get the random element of a sequence, or a default value if no element. More...
|
|
static T | RandomByWeight< T > (this IEnumerable<(T element, float weight)> source) |
| Get the random element of a sequence by the specified weight, or a default value if no valid element. More...
|
|
Extension methods for linq operation.
3
static Dictionary<T, U> ToDictionary< T, U > |
( |
this IEnumerable< KeyValuePair< T, U >> |
source | ) |
|
|
static |
Create a Dictionary<TKey, TValue>
from the sequence of KeyValuePair<TKey, TValue>
.
Useful for arranging a dictionary, e.g., filtering, combining, or sorting.
- Template Parameters
-
T | The key type. |
U | The element type. |
- Parameters
-
source | The source sequence. |
- Returns
- The dictionary.