12345678910111213141516171819202122 |
- namespace FNZCM.BlazorWasm.Helpers
- {
- public static class ExtenstionMetohd
- {
- public static IEnumerable<(T item, int index)> WithIndex<T>(this IEnumerable<T> self)
- => self.Select((item, index) => (item, index));
- public static TV GetEx<TK, TV>(this IDictionary<TK, TV> dic, TK key)
- {
- if (key == null) return default;
- return dic.TryGetValue(key, out var tv)
- ? tv
- : default;
- }
- public static T[] KeepNoEmpty<T>(this T[] source)
- {
- if (false == (source?.Length > 0)) return new T[1];
- return source;
- }
- }
- }
|