Skip to content

Instantly share code, notes, and snippets.

@nutrino
Last active October 15, 2015 04:04
Show Gist options
  • Save nutrino/a5704f39b89a60dbabab to your computer and use it in GitHub Desktop.
Save nutrino/a5704f39b89a60dbabab to your computer and use it in GitHub Desktop.
using System;
class Customer
{
public string City { get; set; }
}
class Customers
{
private Customer c;
public Customers()
{
c = new Customer();
c.City = "New York";
}
public Customer Where(Func<Customer, bool> predicate)
{
if (predicate(c) == true)
return c;
else
return null;
}
}
public class Program
{
public static void Main()
{
var customers = new Customers();
var list = from c in customers where c.City == "London" select c;
Console.WriteLine("Hello World " + ((list != null) ? list.ToString() : "null"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment