add ToLArray() => ToList().ToArray() global extension
This commit is contained in:
1 parent
39434506dc
commit
4ecb2eacb4
4 files changed
+8
-5
No files matched your search
@@ -29,6 +29,9 @@ namespace System.Collections.Generic
|
||||
public static IEnumerable<T> Intersect<T, TKey>(this IEnumerable<T> enumerable, IEnumerable<TKey> intersection, Func<T, TKey> key_selector) {
|
||||
return enumerable.Where(t => intersection.Contains(key_selector(t)));
|
||||
}
|
||||
|
||||
public static T[] ToLArray<T>(this IEnumerable<T> enumerable) =>
|
||||
enumerable.ToList().ToArray();
|
||||
}
|
||||
|
||||
public static class CollectionExtensions
|
||||
|
||||
@@ -361,8 +361,8 @@ namespace mbts.spark
|
||||
|
||||
public class DiscreteValues<TRow, TValue> : DiscreteValues<TRow, TValue, TValue[]>
|
||||
{
|
||||
public DiscreteValues(ObservableCollection<TRow> rows, Func<TRow, TValue> get_row_val, string prop_name) : base(rows, get_row_val, v => v.ToArray(), v => v, prop_name) { }
|
||||
public DiscreteValues(ObservableCollection<TRow> rows, Func<TRow, TValue> get_row_val, string prop_name, IEqualityComparer<TValue> equality_comparer) : base(rows, get_row_val, v => v.ToArray(), v => v, prop_name, equality_comparer) { }
|
||||
public DiscreteValues(ObservableCollection<TRow> rows, Func<TRow, TValue> get_row_val, string prop_name) : base(rows, get_row_val, v => v.ToLArray(), v => v, prop_name) { }
|
||||
public DiscreteValues(ObservableCollection<TRow> rows, Func<TRow, TValue> get_row_val, string prop_name, IEqualityComparer<TValue> equality_comparer) : base(rows, get_row_val, v => v.ToLArray(), v => v, prop_name, equality_comparer) { }
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace mbts.ui.converters
|
||||
if (value is T)
|
||||
t = (T)value;
|
||||
string raw_str = t.ToString();
|
||||
return raw_str.Substring(0, 1) + new String(raw_str.Skip(1).Select(Char.ToLower).ToArray());
|
||||
return raw_str.Substring(0, 1) + new String(raw_str.Skip(1).Select(Char.ToLower).ToLArray());
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
|
||||
|
||||
@@ -17,8 +17,8 @@ namespace mbts.spark
|
||||
if (y == null) return 1;
|
||||
if (x.ContractCase == ContractOneofCase.Future) return y.ContractCase == ContractOneofCase.Future ? Compare(x.Symbol, x.Future, y.Symbol, y.Future) : -1;
|
||||
if (y.ContractCase == ContractOneofCase.Future) return 1;
|
||||
var xlegs = SecurityHelper.get_flat_future_legs(x).ToArray();
|
||||
var ylegs = SecurityHelper.get_flat_future_legs(y).ToArray();
|
||||
var xlegs = SecurityHelper.get_flat_future_legs(x).ToLArray();
|
||||
var ylegs = SecurityHelper.get_flat_future_legs(y).ToLArray();
|
||||
int max = Math.Min(xlegs.Length, ylegs.Length);
|
||||
for (int i = 0; i < max; i++) {
|
||||
int rv = Compare(xlegs[i].Item2, xlegs[i].Item3, ylegs[i].Item2, ylegs[i].Item3);
|
||||
|
||||
Reference in new issue
Block a user