Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Linq join to tables
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Customer { public int ID { get; set; } public string Name { get; set; } } public class Order { public int ID { get; set; } public string Product { get; set; } } public class Program { public static void Main(string[] args) { // Example customers. var customers = new Customer[] { new Customer{ID = 5, Name = "Sam"}, new Customer{ID = 6, Name = "Dave"}, new Customer{ID = 7, Name = "Julia"}, new Customer{ID = 8, Name = "Sue"} }; // Example orders. var orders = new Order[] { new Order{ID = 5, Product = "Book"}, new Order{ID = 6, Product = "Game"}, new Order{ID = 7, Product = "Computer"}, new Order{ID = 8, Product = "Shirt"} }; // Join on the ID properties. var query = from c in customers join o in orders on c.ID equals o.ID select new { c.Name, o.Product }; // Display joined groups. foreach (var group in query) { Console.WriteLine("{0} bought {1}", group.Name, group.Product); } } } }
run
|
edit
|
history
|
help
0
Калькулятор
Prime Fibonacci
obrazek
Ccc
3
bubble sort
Get a webpage - the async way
Non-User input - Random Controlled - Guessing Game
My Test
Intuit // C# // listing_4.1 (Console.WriteLine _ Форматный вывод)