1234567891011121314151617181920212223 |
- namespace FNZCM.BlazorWasm.Utility
- {
- 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 IReadOnlyCollection<T> KeepNoEmpty<T>(this IReadOnlyCollection<T> source)
- {
- if (source == null) return new T[1];
- if (source.Count == 0) return new T[1];
- return source;
- }
- }
- }
|