Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Trials
//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; using System.Linq; namespace Rextester { public class ids{ public string name; public string id; } public class Program { public static void Main(string[] args) { //Your code goes here Console.WriteLine("Hello, world!"); List<ids> collectionofids = new List<ids>(); var id = new ids(); id.name = "nandhini"; id.id = "1"; collectionofids.Add(id); var ids = new ids(); ids.name = "priya"; ids.id = "1"; collectionofids.Add(ids); var dict = collectionofids.Aggregate(new Dictionary<string,List<ids>>(),(p,c)=>{ if(p.ContainsKey(c.id)){ p[c.id].Add(c); } else{ p[c.id] = new List<ids>(){id}; } return p; }); int i=1; foreach(var a in dict){ Console.WriteLine(i++); Console.Write("=>key:"+a.Key); var c = dict[a.Key]; Console.Write("Value:"); foreach(var b in c) { Console.Write(b.name,","); } } } } }
run
|
edit
|
history
|
help
0
Problem 5 SingleDigit
a
dgd dy retert
test device logger
Today's work
code
Number Comparer
Fibonacci and finding nth fibo number
Planet-D ver. 0.7
buble sort