Along the lines of the previous post, some common lambda expressions:
Func<bool> tester = () => true;
Func<string, string> selector = str => str.ToUpper();
Func<string, int, string[]> extract = (s,i) => i > 0 ? s.Split(delimiters,i) : s.Split(delimiters);
Func<string, NumberStyles, IFormatProvider, int> parser = int.Parse;
button1.Click += async (sender, e) => { await Task.Delay(1000); textbox1.Text = "Voila!" }
var firstLargerThanIndexNumbers = numbers.TakeWhile( (n,index) => n > index);
var query = people.join( pets,
people => people,
pets => pets.Owner,
(person, pet) => new { Pet = pet.Name, "OwnerName"=person.Name });
grades.OrderByDescending(grade => grade).Take(3);
Enumerable.Repeat("Repetition", 15);
var squares = Enumerable.Range(1, 10).Select(x => x * x);
Func<bool> tester = () => true;
Func<string, string> selector = str => str.ToUpper();
Func<string, int, string[]> extract = (s,i) => i > 0 ? s.Split(delimiters,i) : s.Split(delimiters);
Func<string, NumberStyles, IFormatProvider, int> parser = int.Parse;
button1.Click += async (sender, e) => { await Task.Delay(1000); textbox1.Text = "Voila!" }
var firstLargerThanIndexNumbers = numbers.TakeWhile( (n,index) => n > index);
var query = people.join( pets,
people => people,
pets => pets.Owner,
(person, pet) => new { Pet = pet.Name, "OwnerName"=person.Name });
grades.OrderByDescending(grade => grade).Take(3);
Enumerable.Repeat("Repetition", 15);
var squares = Enumerable.Range(1, 10).Select(x => x * x);
No comments:
Post a Comment