C# Tutorial: LINQ

C# Tutorial: LINQ

Ian Schoenrock

4 года назад

11,530 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Kevin Vélez
Kevin Vélez - 21.10.2023 03:37

using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
internal class Program
{
static void Main(string[] args)
{
var myBooks = new List<Book>()
{
new Book() {Title = "C#", Price = 9.4},
new Book() {Title = "C++", Price = 5.4},
};

var books = from book in myBooks
orderby book.Price descending
select book;
books.ToList().ForEach(book => { Console.WriteLine(book.Title); });

}
}
class Book
{
public string Title { get; set; }
public double Price { get; set; }
}

}

Ответить
Kevin Vélez
Kevin Vélez - 21.10.2023 03:36

using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
internal class Program
{
static void Main(string[] args)
{
var myBooks = new List<Book>()
{
new Book() {Title = "C#", Price = 9.4},
new Book() {Title = "C++", Price = 5.4},
};

var books = from book in myBooks
where book.Title == "C#"
select book;
books.ToList().ForEach(book => { Console.WriteLine(book.Title); });

}
}
class Book
{
public string Title { get; set; }
public double Price { get; set; }
}

}

Ответить
Tiler Boston
Tiler Boston - 16.10.2023 22:20

this is the best explanation

Ответить
Fauzi zee
Fauzi zee - 15.08.2023 16:16

thank you so much. Finishing my diploma with this

Ответить
Noam Nir
Noam Nir - 07.04.2023 19:39

tnx for quick review

Ответить
Rj Aditya
Rj Aditya - 17.11.2020 12:18

It would have been better if you could have spent some more time on this and explained it in a little more detail.

Ответить