You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
914 B
29 lines
914 B
// Author: Gockner, Simon
|
|
// Created: 2020-11-20
|
|
// Copyright(c) 2020 SimonG. All Rights Reserved.
|
|
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
|
|
namespace Lib.Tools
|
|
{
|
|
public static class Enumerables
|
|
{
|
|
public static ObservableCollection<T> ToObservableCollection<T>(this IEnumerable<T> enumerable) => new ObservableCollection<T>(enumerable);
|
|
public static ObservableCollection<T> ToObservableCollectionOfType<T>(this IEnumerable enumerable) => enumerable.Cast<T>().ToObservableCollection();
|
|
|
|
public static IEnumerable<T> ForEach<T>(this IEnumerable<T> enumerable, Action<T> action)
|
|
{
|
|
IEnumerable<T> list = enumerable.ToList();
|
|
foreach (T item in list)
|
|
{
|
|
action(item);
|
|
}
|
|
|
|
return list;
|
|
}
|
|
}
|
|
} |