Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Lambdas
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Text.RegularExpressions; namespace Rextester { public class FancyDataStructure<T> { IEnumerable<T> data; public void init(IEnumerable<T> data) { // very fancy and complicated! this.data = data; } public void doSomething(Action<T> whatToDo, Func<T, bool> condition) { foreach (T item in data) { if (condition(item)) { whatToDo(item); } } } } public class Program { public static void Main(string[] args) { // filtering, etc. Func<int, bool> biggerThanEight = (num => num > 8); Action<int> log = (num => Console.WriteLine(num)); FancyDataStructure<int> fds = new FancyDataStructure<int>(); fds.init(new List<int>(){ 5, 7, 9, 10, 6 }); fds.doSomething(log, biggerThanEight); } } }
run
|
edit
|
history
|
help
0
Math 10.96
Login Silencioso
Kumaran-RegText-CityStatePostalCode Parsing
WindowsFormsApp1
All
Basma 2
1234
10857
asxsdxsdf
Bubble Sort