Łukasz Gąsior
  • Home
  • now!
  • Blog
  • Po polsku
Social Links
Twitter
LinkedIn
Facebook
YouTube
Reddit
Instagram
GitHub
Medium
RSS
Łukasz Gąsior
  • Home
  • now!
  • Blog
  • Po polsku
  • Po polsku

Quick Tip: 04. przeszukuj kolekcje z where zamiast foreach

  • 2009-09-01
  • 1 minute read
  • 77 views

LINQ udostępnia metodę where, która umożliwia przeszukiwanie kolekcji tak jak foreach.
Przykładowo, zamiast:
[sourcecode language=”csharp”] var polishCustomers = new List<Customer>();
foreach (var customer in customers)
{
if (customer.Country == "Poland")
polishCustomers.Add(customer);
}
[/sourcecode] możemy użyć
[sourcecode language=”csharp”] var polishCustomers = customers.Where(x => x.Country == "Poland");
[/sourcecode] czyli krótko, zwięźle i na temat 🙂
Oczywiście wcześniej musimy dodać using System.Linq;

Share
Tweet
Share
Share
Related Topics
  • C#
  • LINQ
You May Also Like
View Post
  • Po polsku

Software Craftsmanship Wrocław

  • 2017-06-06
View Post
  • Po polsku

Pilnuj typów danych

  • 2014-02-26
View Post
  • Po polsku

ReSharper Essentials – poszło!

  • 2014-02-21
View Post
  • Po polsku

Turbo-Mode Developera

  • 2014-02-19
View Post
  • Po polsku

Badanie usability by TechSmith

  • 2014-02-13
View Post
  • Po polsku

Global Windows Azure Bootcamp 2014

  • 2014-02-05
View Post
  • Po polsku

Quick tip: 12. Stosuj AsNoTracking() gdzie się da!

  • 2013-01-27
View Post
  • Po polsku

Quick tip: 11. Indexed views vs. SQL Server Express

  • 2012-07-23
click & help!
Nakarm dziecko!
Follow me
RESHARPER ESSENTIALS
ReSharper Essentials
CODINGTV();
codingtv();
Twitter Feed
Categories
  • Azure Cloud (6)
  • Po polsku (104)
  • Windows (1)
Featured Posts
  • Azure Activity Log – Change History
    • 2020-09-29
  • Diagram Driven Cloud Infrastructure with Cloud Maker
    • 2020-09-22
  • Azure ARM template, but it is not JSON!
    • 2020-09-15
About
👍 Cloud | DevOps | Development | Technical Leadership | 📗Author of "ReSharper Essentials
© 2019 Łukasz Gąsior. All rights reserved.
hosted with ♥️ on webio | Polityka prywatności

Input your search keywords and press Enter.