remove ToLArray extension (it is not more efficient than Enumerable.ToArray())

This commit is contained in:
John Colvin committed 2019-05-11 12:27:42 -05:00
1 parent a29eaa2618
commit 7bb077a74d
5 files changed
+7 -13

No files matched your search

@@ -73,7 +73,7 @@ namespace mbts.spark {
_has_working_orders = backing(nameof(has_working_orders), false);
contract_picker_model = new ContractPickerModel(bus, false, null, new SecurityCriteria(new[] {
new SecurityCriteriaClause() {
exchanges = EnumHelper.get_values_except(Venue.Bts).ToLArray()
exchanges = EnumHelper.get_values_except(Venue.Bts).ToArray()
}
}));
contract_picker_model.cancel_action = _close_new_leg_popup;
@@ -6,6 +6,7 @@ using mbts.ui;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Media;
using static mbts.ui.shell.ProtoBufSerializationHelper;
@@ -52,9 +53,8 @@ namespace bts.shell {
yield return _aswf;
}
public Task<IShellWindow> create(Stream load_stream) {
return dispatch_to_factory(load_stream, window_factories().ToLArray());
}
public Task<IShellWindow> create(Stream load_stream) =>
dispatch_to_factory(load_stream, window_factories().ToArray());
public void Dispose() {
foreach (var i in window_factories())
@@ -42,7 +42,7 @@ namespace mbts.collections
foreach (TModel m in e.OldItems) _remove(m);
break;
case NotifyCollectionChangedAction.Reset:
var old_views = Values.ToLArray();
var old_views = Values.ToArray();
Clear();
foreach (TValue v in old_views) ValueDestroyed?.Invoke(v);
foreach (TModel m in _models) _add(m);
@@ -3,17 +3,14 @@ using bts.collections;
using bts.utils;
using mbts.collections;
using mbts.ui.shell;
using mbts.ui.utilities;
using mbts.ui.utility;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Reactive.Linq;
using System.Windows.Data;
namespace mbts.spark.filters {
static class DiscreteValuesFilterVM {
@@ -87,7 +84,7 @@ namespace mbts.spark.filters {
public IReadOnlyCollection<TValue> items { get; }
public ObservableCollectionEx<TValue> selected_items { get; } = new ObservableCollectionEx<TValue>();
public override TValue[] get_state() => selected_items.ToLArray();
public override TValue[] get_state() => selected_items.ToArray();
protected override void _clear() {
_destroy_snapshot();
selected_items.Clear();
@@ -30,11 +30,8 @@ namespace System.Collections.Generic {
public static IEnumerable<T> OfTypeSafe<T>(this IEnumerable source) =>
source == null ? Enumerable.Empty<T>() : source.OfType<T>();
public static T[] ToLArray<T>(this IEnumerable<T> enumerable) =>
enumerable.ToList().ToArray();
public static TAccumulate AggregateWhile<T, TAccumulate>(this IEnumerable<T> source, TAccumulate seed, Func<TAccumulate, T, TAccumulate> aggregate, Func<TAccumulate, T, bool> predicate) =>
AggregateWhile(source, seed, aggregate, predicate, (curr, el, next) => curr);
AggregateWhile(source, seed, aggregate, predicate, (curr, el, next) => curr);
public static TAccumulate AggregateWhile<T, TAccumulate>(this IEnumerable<T> source, TAccumulate seed, Func<TAccumulate, T, TAccumulate> aggregate, Func<TAccumulate, T, bool> predicate, TAccumulate early_break_rv) =>
AggregateWhile(source, seed, aggregate, predicate, (curr, el, next) => early_break_rv);