Initial add of three projects

This commit is contained in:
2019-01-04 00:04:44 +01:00
commit c638f0cf2d
54 changed files with 549 additions and 0 deletions

47
BooksLambda/Program.cs Normal file
View File

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BooksLambda
{
public class Program
{
static void Main(string[] args)
{
var books = new BookRepository().GetBooks();
//var cheapBooks = books.FindAll(IsCheaperThan10Dollars);
var cheapBooks = books.FindAll(b => b.Price<10);
foreach (var book in cheapBooks)
{
Console.WriteLine(book.Title);
}
}
//static bool IsCheaperThan10Dollars(Book book)
//{
// return book.Price < 10;
//}
}
public class BookRepository
{
public List<Book> GetBooks()
{
return new List<Book>
{
new Book(){Title="Title 1", Price=5.25m},
new Book(){Title="Title 2", Price=9.25m},
new Book(){Title="Title 3", Price=10.75m}
};
}
}
public class Book
{
public string Title { get; set; }
public decimal Price { get; set; }
}
}