Question: static void checkCircles(string[] circles, string[] colors) { Hashtable hashtable = new Hashtable(); foreach(var mag in circles){ if(hashtable[mag]==null){ hashtable[mag]=1; } else{ hashtable[mag]=(int)hashtable[mag]+1; } } var variables

static void checkCircles(string[] circles, string[] colors) { Hashtable hashtable = new Hashtable(); foreach(var mag in circles){ if(hashtable[mag]==null){ hashtable[mag]=1; } else{ hashtable[mag]=(int)hashtable[mag]+1; } } var variables = colors.GroupBy(p=>p).Select(p=>new{Key = p.Key, Count = p.Count()}); int count =0; foreach(var v in variables){ if(hashtable[not.Key]==null)break; if((int)hashtable[not.Key]>=not.Count)count++; } }

can someone please explain to me what the following line of code is doing in the code above? var variables = colors.GroupBy(p=>p).Select(p=>new{Key = p.Key, Count = p.Count()});

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!