Run Code
|
Code Wall
|
Users
|
Misc
|
Feedback
|
About
|
Login
|
Theme
Test LINQ Anagrafica
//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 Program { public static Dictionary<string, string> Anagraphic = new Dictionary<string, string> { { "Rossi", "Mario" }, { "Verdi", "Giuseppe" }, { "Bianchi", "Paolo" } }; public class Person { public string Name; public string Surname; } public static IEnumerable<Person> GetPersons() { return Anagraphic.Select(a => new Person { Surname = a.Key }); } public static void Main(string[] args) { var persons = GetPersons(); foreach (var person in persons) person.Name = Anagraphic[person.Surname]; foreach (var person in persons) Console.WriteLine("Hello, Name: '" + person.Name + "', Surname: '" + person.Surname +"'"); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Order of Ops 6.5 (added brackets)
Prime Number
dynamic object
Comp4.1
123
Daily Coding Problem: Problem #4
dice roll
Get Country IP
Luhn Formula Demo C#
005
Please log in to post a comment.