System.Func.Invoke(TItem)

Here are the examples of the csharp api System.Func.Invoke(TItem) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

889 Examples 7

19 View Source File : DelegateKeyedCollection.cs
License : MIT License
Project Creator : graphql-aspnet

protected override TKey GetKeyForItem(replacedem item)
        {
            return _keyDelegate(item);
        }

19 View Source File : ItemSelect.razor.cs
License : MIT License
Project Creator : joadan

private bool IsHighlighted(replacedem item)
        {
            if (highlighted == null) { return false; }

            if (IdExpression != null)
            {
                return IdExpression.Invoke(highlighted) == IdExpression.Invoke(item);
            }

            return highlighted.Equals(item);
        }

19 View Source File : BindableExpandableListAdapter.cs
License : MIT License
Project Creator : CalciumFramework

public override View GetChildView(
			int groupPosition, int childPosition, 
			bool isLastChild, View convertView, ViewGroup parent)
		{
			var view = convertView;

			var item = groupings[groupPosition][childPosition];
			int layoutId = getLayoutIdFunc(item);

			if (view == null)
			{
				view = inflater.Inflate(/*Resource.Layout.OptionTemplate_Boolean*/layoutId, null);
			}
			else
			{
				if (bindingsDictionary.TryGetValue(view, out BoundViewData viewData))
				{
					var currentDataContext = viewData.DataContext;

					if (currentDataContext != null && currentDataContext.Equals(item)
						&& viewData.Applicator.HasBindings)
					{
						return view;
					}

					viewData.Applicator.RemoveBindings();

					/* If the item is not of the same type, do not reuse the view. */
					if (viewData.DataContext.GetType() != item.GetType())
					{
						view = inflater.Inflate(layoutId, null);
					}
				}
			}

			var applicator = new XmlBindingApplicator();
			applicator.ApplyBindings(view, item, layoutId);
			bindingsDictionary[view] = new BoundViewData(applicator, item);
			reverseLookup[item] = view;
			
			return view;
		}

19 View Source File : RecipeViewModel.cs
License : MIT License
Project Creator : Eilon

private int[] GetDoneIndices<replacedem>(List<replacedem> items, Func<replacedem, bool> itemDonePredicate)
        {
            var doneIndices = new List<int>();
            for (int i = 0; i < items.Count; i++)
            {
                if (itemDonePredicate(items[i]))
                {
                    doneIndices.Add(i);
                }
            }
            return doneIndices.ToArray();
        }

19 View Source File : LruCache{TKey, TItem}.cs
License : MIT License
Project Creator : DataObjects-NET

public override replacedem Add(replacedem item, bool replaceIfExists)
    {
      ArgumentValidator.EnsureArgumentNotNull(item, "item");
      var key = KeyExtractor(item);
      var cached = new KeyValuePair<TKey, replacedem>(key, item);
      KeyValuePair<TKey, replacedem> oldCached;
      if (deque.TryChangeValue(key, cached, true, replaceIfExists, out oldCached)) {
        if (!replaceIfExists)
          return oldCached.Value;
        size -= sizeExtractor(oldCached.Value);
        if (chainedCache!=null)
          chainedCache.Add(oldCached.Value, true);
        ItemRemoved(key);
      }
      size += sizeExtractor(item);
      while (size > maxSize && deque.Count > 0) {
        oldCached = deque.PopBottom();
        size -= sizeExtractor(oldCached.Value);
        if (chainedCache!=null)
          chainedCache.Add(oldCached.Value, true);
        ItemRemoved(key);
      }
      ItemAdded(key);
      return item;
    }

19 View Source File : GroupedList.razor.cs
License : MIT License
Project Creator : BlazorFluentUI

IList<replacedem> FlattenList(IEnumerable<replacedem> groupedItems, Func<replacedem,IEnumerable<replacedem>> subGroupSelector)
        {
            IList<replacedem> flattenedItems = new System.Collections.Generic.List<replacedem>();

            foreach (replacedem? item in groupedItems)
            {
                IEnumerable<replacedem>? subItems = subGroupSelector(item);
                if (subItems == null || !subItems.Any())
                    flattenedItems.Add(item);
                else
                {
                    IList<replacedem>? moreItems = FlattenList(subItems, subGroupSelector);
                    flattenedItems.AddRange(moreItems);
                }
            }

            return flattenedItems;
        }

19 View Source File : TreeView.razor.cs
License : MIT License
Project Creator : joadan

private void SetDefaultExpanded(IList<replacedem> items)
        {
            foreach (var item in items)
            {
                if (!IsExpanded(item) && DefaultExpanded(item))
                {
                    expandedItems.Add(item);
                }

                SetDefaultExpanded(ChildSelector(item));
            }
        }

19 View Source File : BTreeview.razor.cs
License : MIT License
Project Creator : BlazorComponent

public async Task EmitOpenAsync()
        {
            _oldOpen = Nodes.Values.Where(r => r.IsOpen).Select(r => ItemKey(r.Item)).ToList();
            if (ListComparer.Equals(_oldOpen, Open))
            {
                //nothing change
                return;
            }

            Open = _oldOpen;

            if (OnOpenUpdate.HasDelegate)
            {
                var open = Nodes.Values.Where(r => r.IsOpen).Select(r => r.Item).ToList();
                _ = OnOpenUpdate.InvokeAsync(open);
            }

            if (OpenChanged.HasDelegate)
            {
                await OpenChanged.InvokeAsync(Open);
            }
        }

19 View Source File : Select.razor.cs
License : MIT License
Project Creator : joadan

protected TValue GetValue(replacedem item)
        {
            if (ConvertExpression == null) return default;

            return ConvertExpression.Invoke(item);
        }

19 View Source File : BTreeview.razor.cs
License : MIT License
Project Creator : BlazorComponent

private bool FilterTreeItems(replacedem item, ref List<TKey> excluded)
        {
            if (FilterTreeItem(item, Search, ItemText))
            {
                return true;
            }

            var children = ItemChildren(item);

            if (children != null)
            {
                var match = false;

                foreach (var child in children)
                {
                    if (FilterTreeItems(child, ref excluded))
                    {
                        match = true;
                    }
                }

                if (match)
                {
                    return true;
                }
            }

            excluded.Add(ItemKey(item));
            return false;
        }

19 View Source File : ClassifiedCollection.cs
License : MIT License
Project Creator : DataObjects-NET

public bool Remove(replacedem item)
    {
      if (!set.Remove(item))
        return false;
      list.Remove(item);
      var clreplacedes = Clreplacedifier.Invoke(item);
      foreach (var @clreplaced in clreplacedes) {
        var clreplacedList = clreplacedified[@clreplaced];
        clreplacedList.Remove(item);
        if (clreplacedList.Count==0)
          clreplacedified.Remove(@clreplaced);
      }
      return true;
    }

19 View Source File : EnumerableUtils.cs
License : MIT License
Project Creator : DataObjects-NET

public static IEnumerable<replacedem> Unfold<replacedem>(replacedem first, Func<replacedem, replacedem> next)
    {
      ArgumentValidator.EnsureArgumentNotNull(next, "next");
      var current = first;
      while (current!=null) {
        yield return current;
        current = next.Invoke(current);
      }
    }

19 View Source File : BTreeview.razor.cs
License : MIT License
Project Creator : BlazorComponent

private void BuildTree(List<replacedem> items, TKey parent)
        {
            foreach (var item in items)
            {
                var key = ItemKey(item);
                var children = ItemChildren(item) ?? new List<replacedem>();

                var nodeState = new NodeState<replacedem, TKey>
                {
                    Children = children.Select(ItemKey),
                    IsOpen = OpenAll,
                    Item = item,
                    Parent = parent
                };
                Nodes.Add(key, nodeState);

                BuildTree(children, key);
            }
        }

19 View Source File : ImmutableArrayExtensions.cs
License : MIT License
Project Creator : GGG-KILLER

public static ImmutableArray<TResult> SelectAsArray<replacedem, TResult>(this ImmutableArray<replacedem> array, Func<replacedem, bool> predicate, Func<replacedem, TResult> selector)
        {
            if (array.Length == 0)
            {
                return ImmutableArray<TResult>.Empty;
            }

            var builder = ArrayBuilder<TResult>.GetInstance();
            foreach (var item in array)
            {
                if (predicate(item))
                {
                    builder.Add(selector(item));
                }
            }

            return builder.ToImmutableAndFree();
        }

19 View Source File : ItemValue.cs
License : MIT License
Project Creator : BlazorComponent

public object Invoke(replacedem item)
        {
            return Factory.Invoke(item);
        }

19 View Source File : EnumerableExtensions.cs
License : MIT License
Project Creator : JasperFx

public static TReturn FirstValue<replacedem, TReturn>(this IEnumerable<replacedem> enumerable, Func<replacedem, TReturn> func)
            where TReturn : clreplaced
        {
            foreach (replacedem item in enumerable)
            {
                TReturn @object = func(item);
                if (@object != null) return @object;
            }

            return null;
        }

19 View Source File : BlazoredTypeahead.razor.cs
License : MIT License
Project Creator : Blazored

private string GetSelectedSuggestionClreplaced(replacedem item, int index)
        {
            const string resultClreplaced = "blazored-typeahead__active-item";
            TValue value = ConvertMethod(item);

            if (Equals(value, Value) || (Values?.Contains(value) ?? false))
            {
                if (index == SelectedIndex)
                {
                    return "blazored-typeahead__selected-item-highlighted";
                }

                return "blazored-typeahead__selected-item";
            }

            if (index == SelectedIndex)
            {
                return resultClreplaced;
            }

            return Equals(value, Value) ? resultClreplaced : string.Empty;
        }

19 View Source File : ItemSelect.razor.cs
License : MIT License
Project Creator : joadan

private bool IsDisabled(replacedem item)
        {
            return DisabledExpression != null ? DisabledExpression(item) : false;
        }

19 View Source File : TMap.cs
License : MIT License
Project Creator : atenfyr

protected override TKey GetKeyForItem(replacedem item)
        {
            return _getKeyForItemFunction(item);
        }

19 View Source File : Select.razor.cs
License : MIT License
Project Creator : joadan

private void PopulateItemList()
        {
            itemList = new List<Lisreplacedem<replacedem, TValue>>();

            if (Items != null)
            {
                foreach (var item in Items)
                {
                    var lisreplacedem = new Lisreplacedem<replacedem, TValue>
                    {
                        Text = GetText(item),
                        Value = GetValue(item),
                        Item = item
                    };

                    if (DisabledExpression != null)
                    {
                        lisreplacedem.Disabled = DisabledExpression(item);
                    }

                    itemList.Add(lisreplacedem);
                }
            }

        }

19 View Source File : DelegateWholeItemReplacer.cs
License : MIT License
Project Creator : connellw

public object GetReplacement(object dbValue)
        {
            return _getterFunc((replacedem) dbValue);
        }

19 View Source File : ClassifiedCollection.cs
License : MIT License
Project Creator : DataObjects-NET

public void Add(replacedem item)
    {
      if (!set.Add(item) && IsSet)
        return;
      list.Add(item);
      var clreplacedes = Clreplacedifier.Invoke(item);
      foreach (var @clreplaced in clreplacedes) {
        var clreplacedList = clreplacedified.GetValueOrDefault(@clreplaced);
        if (clreplacedList==null) {
          clreplacedList = new List<replacedem>();
          clreplacedified.Add(@clreplaced, clreplacedList);
        }
        clreplacedList.Add(item);
      }
    }

19 View Source File : Utility.cs
License : MIT License
Project Creator : bbepis

public static IEnumerable<replacedem> RoundRobin<replacedem, TKey>(this IList<replacedem> source, Func<replacedem, TKey> predicate)
		{
			List<TKey> keys = source.Select(predicate)
									.Distinct()
									.ToList();

			SortedList<TKey, int> queueIndices = new SortedList<TKey, int>();

			foreach (var key in keys)
				queueIndices.Add(key, 0);

			while (queueIndices.Count > 0)
			{
				foreach (var key in keys)
				{
					if (!queueIndices.ContainsKey(key))
						continue;

					int index = queueIndices[key];

					while (index < source.Count)
					{
						var item = source[index];

						index++;

						if (Equals(predicate(item), key))
						{
							yield return item;
							break;
						}
					}

					if (index == source.Count)
						queueIndices.Remove(key);
					else
						queueIndices[key] = index;
				}
			}
		}

19 View Source File : LruCache{TKey, TItem}.cs
License : MIT License
Project Creator : DataObjects-NET

public override void RemoveKey(TKey key, bool removeCompletely)
    {
      KeyValuePair<TKey, replacedem> oldCached;
      if (deque.TryGetValue(key, out oldCached)) {
        deque.Remove(key);
        size -= sizeExtractor(oldCached.Value);
        if (chainedCache!=null) {
          if (removeCompletely)
            chainedCache.RemoveKey(key);
          else
            chainedCache.Add(oldCached.Value, true);
        }
        ItemRemoved(key);
      }
    }

19 View Source File : BTreeview.razor.cs
License : MIT License
Project Creator : BlazorComponent

private bool FilterTreeItem(replacedem item, string search, Func<replacedem, string> itemText)
        {
            var text = itemText(item).ToString();
            return text.ToLower().IndexOf(search.ToLower()) > -1;
        }

19 View Source File : LruCache{TKey, TItem}.cs
License : MIT License
Project Creator : DataObjects-NET

public override void Clear()
    {
      while (deque.Count > 0) {
        var cached = deque.PopBottom();
        var key = cached.Key;
        size -= sizeExtractor(cached.Value);
        if (chainedCache!=null)
          chainedCache.Add(cached.Value, true);
        ItemRemoved(key);
      }
      size = 0;
      Cleared();
    }

19 View Source File : EnumerableUtils.cs
License : MIT License
Project Creator : DataObjects-NET

public static IEnumerable<replacedem> Unfold<replacedem>(replacedem first, Func<replacedem, bool> include, Func<replacedem, replacedem> next)
    {
      ArgumentValidator.EnsureArgumentNotNull(next, "next");
      var current = first;
      while (include.Invoke(current)) {
        yield return current;
        current = next.Invoke(current);
      }
    }

19 View Source File : BTreeview.razor.cs
License : MIT License
Project Creator : BlazorComponent

private void UpdateActive()
        {
            if (Active == null || !Active.Any())
            {
                return;
            }

            var hasActive = false;
            foreach (var nodeState in Nodes.Values)
            {
                var key = ItemKey(nodeState.Item);
                if (Active.Contains(key) && (MultipleActive || !hasActive))
                {
                    nodeState.IsActive = true;
                    hasActive = true;
                }
                else
                {
                    nodeState.IsActive = false;
                }
            }
        }

19 View Source File : FlagRegistry.cs
License : MIT License
Project Creator : DataObjects-NET

public void Register(replacedem item)
    {
      GetContainer(flagExtractor(item)).Add(item);
    }

19 View Source File : TopoLogicalSorting.cs
License : GNU General Public License v3.0
Project Creator : BitCrackers

private void Release(replacedem item)
        {
            var key = getKey(item);
            sortedItems.Add(key);

            var releasedItems = waitList.Remove(key);
            if (releasedItems != null)
            {
                foreach (var releasedItem in releasedItems)
                {
                    readyToOutput.Enqueue(releasedItem);
                }
            }
        }

19 View Source File : DictionaryExtensions.cs
License : Apache License 2.0
Project Creator : enyim

public static Dictionary<TKey, TValue> IntoDictionary<replacedem, TKey, TValue>(this IEnumerable<replacedem> self, Dictionary<TKey, TValue> target, Func<replacedem, TKey> keySelector, Func<replacedem, TValue> valueSelector)
		{
			foreach (var item in self)
			{
				target[keySelector(item)] = valueSelector(item);
			}

			return target;
		}

19 View Source File : BTreeviewNode.razor.cs
License : MIT License
Project Creator : BlazorComponent

public async Task CheckChildren()
        {
            if (Children == null || Children.Any() || LoadChildren == null || _hasLoaded) return;

            IsLoading = true;

            try
            {
                await LoadChildren(Item);
            }
            finally
            {
                IsLoading = false;
                _hasLoaded = true;
            }
        }

19 View Source File : ArrayBuilderExtensions.cs
License : MIT License
Project Creator : GGG-KILLER

public static ImmutableArray<TResult> SelectAsArray<replacedem, TResult>(this ArrayBuilder<replacedem> items, Func<replacedem, TResult> map)
        {
            switch (items.Count)
            {
                case 0:
                    return ImmutableArray<TResult>.Empty;

                case 1:
                    return ImmutableArray.Create(map(items[0]));

                case 2:
                    return ImmutableArray.Create(map(items[0]), map(items[1]));

                case 3:
                    return ImmutableArray.Create(map(items[0]), map(items[1]), map(items[2]));

                case 4:
                    return ImmutableArray.Create(map(items[0]), map(items[1]), map(items[2]), map(items[3]));

                default:
                    var builder = ArrayBuilder<TResult>.GetInstance(items.Count);
                    foreach (var item in items)
                    {
                        builder.Add(map(item));
                    }

                    return builder.ToImmutableAndFree();
            }
        }

19 View Source File : CollectionExtensions.cs
License : MIT License
Project Creator : arcusmaximus

public static IEnumerable<IGrouping<TKey, replacedem>> GroupByContiguous<TKey, replacedem>(this IEnumerable<replacedem> items, Func<replacedem, TKey> keySelector)
        {
            Grouping<TKey, replacedem> currentGroup = null;
            foreach (replacedem item in items)
            {
                TKey key = keySelector(item);
                if (currentGroup != null && !EqualityComparer<TKey>.Default.Equals(key, currentGroup.Key))
                {
                    yield return currentGroup;
                    currentGroup = null;
                }

                if (currentGroup == null)
                    currentGroup = new Grouping<TKey, replacedem>(key);

                currentGroup.Items.Add(item);
            }
            if (currentGroup != null)
                yield return currentGroup;
        }

19 View Source File : OracleSerializeTests.cs
License : Apache License 2.0
Project Creator : jamescourtney

private static void VerifySorted<TList, replacedem, TKey>(
            TList items, 
            Func<replacedem, TKey> keyGet,
            Func<int, TKey> oracleGet,
            Func<TKey, bool> oracleContains,
            IComparer<TKey> comparer) where TList : IList<replacedem>
        {
            TKey previous = keyGet(items[0]);

            for (int i = 0; i < items.Count; ++i)
            {
                TKey current = keyGet(items[i]);
                TKey oracle = oracleGet(i);

                replacedert.True(comparer.Compare(previous, current) <= 0, $"Expect: {previous} <= {current}");
                replacedert.True(comparer.Compare(previous, oracle) <= 0, $"Expect: {previous} <= {oracle}");
                replacedert.True(comparer.Compare(current, oracle) == 0, $"Expect: {current} == {oracle}");

                // FlatBuffers c# has a bug where binary search is broken when using default values.
                // replacedert.True(oracleContains(current));
            }
        }

19 View Source File : GroupedList.razor.cs
License : MIT License
Project Creator : BlazorFluentUI

public static int GetPlainItemsCount(replacedem item, Func<replacedem, IEnumerable<replacedem>> subgroupSelector)
        {
            IEnumerable<replacedem>? subItems = subgroupSelector(item);
            if (subItems == null || !subItems.Any())
                return 1;
            else
            {
                int count = 0;
                foreach (replacedem? subItem in subItems)
                {
                    int subcount = GroupedList<replacedem,TKey>.GetPlainItemsCount(subItem, subgroupSelector);
                    count += subcount;
                }
                return count;
            }
        }

19 View Source File : ItemSelect.razor.cs
License : MIT License
Project Creator : joadan

private void AddSelecreplacedemFromValue(TValue value)
        {
            var item = Items.FirstOrDefault(e => EqualityComparer<TValue>.Default.Equals(ConvertExpression(e), value));
            if (item != null)
            {
                selectedItems.Add(item);
            }
        }

19 View Source File : BTreeview.razor.cs
License : MIT License
Project Creator : BlazorComponent

public async Task EmitActiveAsync()
        {
            _oldActive = Nodes.Values.Where(r => r.IsActive).Select(r => ItemKey(r.Item)).ToList();
            if (ListComparer.Equals(_oldActive, Active))
            {
                //nothing change
                return;
            }

            Active = _oldActive;

            if (OnActiveUpdate.HasDelegate)
            {
                var active = Nodes.Values.Where(r => r.IsActive).Select(r => r.Item).ToList();
                _ = OnActiveUpdate.InvokeAsync(active);
            }

            if (ActiveChanged.HasDelegate)
            {
                await ActiveChanged.InvokeAsync(Active);
            }
            else
            {
                StateHasChanged();
            }
        }

19 View Source File : ItemSelect.razor.cs
License : MIT License
Project Creator : joadan

private string GetSelectedText(replacedem item)
        {
            if (SelectedTextExpression == null) return item.ToString();
            return SelectedTextExpression.Invoke(item);
        }

19 View Source File : BlazoredTypeahead.razor.cs
License : MIT License
Project Creator : Blazored

private async Task SelectResult(replacedem item)
        {
            var value = ConvertMethod(item);
       
            if (IsMultiselect)
            {
                var valueList = Values ?? new List<TValue>();

                if (valueList.Contains(value))
                    valueList.Remove(value);
                else
                    valueList.Add(value);

                await ValuesChanged.InvokeAsync(valueList);
            }
            else
            {
                if (Value != null && Value.Equals(value)) return;
                Value = value;
                await ValueChanged.InvokeAsync(value);
            }

            _editContext?.NotifyFieldChanged(_fieldIdentifier);

            Initialize();
        }

19 View Source File : ItemSelect.razor.cs
License : MIT License
Project Creator : joadan

private TValue GetValue(replacedem item)
        {
            return ConvertExpression.Invoke(item);
        }

19 View Source File : ApexCandleSeries.cs
License : MIT License
Project Creator : apexcharts

public IEnumerable<IDataPoint<replacedem>> GetData()
        {
            var data = Items
         .Select(d => new ListPoint<replacedem>
         {
             X = XValue.Compile().Invoke(d),
             Y = new List<decimal>
             {
                         Open.Compile().Invoke(d),
                         High.Compile().Invoke(d),
                         Low.Compile().Invoke(d),
                       Close.Compile().Invoke(d)
             },
             Items = Items
         });

            if (OrderBy != null)
            {
                data = data.OrderBy(o => OrderBy.Compile().Invoke(o));
            }
            else if (OrderByDescending != null)
            {
                data = data.OrderByDescending(o => OrderByDescending.Compile().Invoke(o));
            }

            return data;

        }

19 View Source File : ItemSelect.razor.cs
License : MIT License
Project Creator : joadan

private bool IsSelected(replacedem item)
        {
            if (IdExpression != null)
            {
                return selectedItems.FirstOrDefault(e => IdExpression.Invoke(e) == IdExpression.Invoke(item)) != null;
            }

            return selectedItems.Contains(item);
        }

19 View Source File : DataLoaderBase.cs
License : MIT License
Project Creator : ChilliCream

protected void TryAddToCache<replacedem, TK, TV>(
            string cacheKeyType,
            IEnumerable<replacedem> items,
            Func<replacedem, TK> key,
            Func<replacedem, TV> value)
            where TK : notnull
        {
            if (_cache is not null)
            {
                foreach (replacedem item in items)
                {
                    TaskCacheKey cacheKey = new(cacheKeyType, key(item));
                    _cache.TryAdd(cacheKey, () => Task.FromResult(value(item)));
                }
            }
        }

19 View Source File : BTreeview.razor.cs
License : MIT License
Project Creator : BlazorComponent

public async Task EmitSelectedAsync()
        {
            _oldValue = Nodes.Values.Where(r => r.IsSelected).Select(r => ItemKey(r.Item)).ToList();
            if (ListComparer.Equals(_oldValue, Value))
            {
                //nothing change
                return;
            }

            Value = _oldValue;

            if (OnInput.HasDelegate)
            {
                var value = Nodes.Values.Where(r => r.IsSelected).Select(r => r.Item).ToList();
                _ = OnInput.InvokeAsync(value);
            }

            if (ValueChanged.HasDelegate)
            {
                await ValueChanged.InvokeAsync(Value);
            }
            else
            {
                StateHasChanged();
            }
        }

19 View Source File : EnumerableExtraExtensions.cs
License : GNU General Public License v3.0
Project Creator : Acumatica

public static List<replacedem> ItemsWithMaxValues<replacedem>(this IEnumerable<replacedem> source, Func<replacedem, double> selector)
		{
			source.ThrowOnNull(nameof(source));
			selector.ThrowOnNull(nameof(selector));

			double maxValue = double.MinValue;
			List<replacedem> result = new List<replacedem>(capacity: 2);

			foreach (replacedem item in source)
			{
				double value = selector(item);

				if (maxValue > value)
					continue;

				if (maxValue < value)
				{
					result.Clear();
					maxValue = value;
				}
				
				result.Add(item);
			}

			return result;
		}

19 View Source File : ApexPointSeries.cs
License : MIT License
Project Creator : apexcharts

public IEnumerable<IDataPoint<replacedem>> GetData()
        {
            IEnumerable<DataPoint<replacedem>> data;

            if (YValue != null)
            {
                data = Items.Select(e => new DataPoint<replacedem>
                {
                    X = XValue.Compile().Invoke(e),
                    Y = YValue.Compile().Invoke(e),
                    Items = new List<replacedem> { e }
                });

            }
            else if (YAggregate != null)
            {
                data = Items.GroupBy(e => XValue.Compile().Invoke(e))
               .Select(d => new DataPoint<replacedem>
               {
                   X = d.Key,
                   Y = YAggregate.Compile().Invoke(d),
                   Items = d.ToList()
               });
            }
            else
            {
                return new List<IDataPoint<replacedem>>();
            }


            if (OrderBy != null)
            {
                data = data.OrderBy(o => OrderBy.Compile().Invoke(o));
            }
            else if (OrderByDescending != null)
            {
                data = data.OrderByDescending(o => OrderByDescending.Compile().Invoke(o));
            }

            return data;
        }

19 View Source File : TopoLogicalSorting.cs
License : GNU General Public License v3.0
Project Creator : BitCrackers

private void Process(replacedem item)
        {
            var pendingDependencies = getDependencies(item)
                .Where(key => !sortedItems.Contains(key))
                .ToArray();

            if (pendingDependencies.Length > 0)
            {
                waitList.Add(item, pendingDependencies);
            }
            else
            {
                readyToOutput.Enqueue(item);
            }
        }

19 View Source File : BTreeview.razor.cs
License : MIT License
Project Creator : BlazorComponent

private void UpdateOpen()
        {
            if (Open == null || !Open.Any())
            {
                return;
            }

            foreach (var nodeState in Nodes.Values)
            {
                var key = ItemKey(nodeState.Item);
                if (Open.Contains(key))
                {
                    nodeState.IsOpen = true;
                }
                else
                {
                    nodeState.IsOpen = false;
                }
            }
        }

19 View Source File : EnumerableExtensions.cs
License : MIT License
Project Creator : DataObjects-NET

public static IEnumerable<replacedem> Flatten<replacedem>(this IEnumerable<replacedem> root,
      Func<replacedem, IEnumerable<replacedem>> childrenExtractor, Action<replacedem> exitAction, bool rootFirst)
    {
      // The validation of arguments is omitted to increase performance.
      foreach (var item in root) {
        var children = childrenExtractor.Invoke(item);
        if(rootFirst)
          yield return item;
        if(children != null)
          foreach (var childItem in children.Flatten(childrenExtractor, exitAction, rootFirst))
            yield return childItem;
        if(!rootFirst)
          yield return item;
        if(exitAction != null)
          exitAction.Invoke(item);
      }
    }

See More Examples