C# -Interview Question Anonymous Type
Posted
by Amutha
on Stack Overflow
See other posts from Stack Overflow
or by Amutha
Published on 2010-04-14T19:39:57Z
Indexed on
2010/04/14
19:43 UTC
Read the original article
Hit count: 364
c#3.0
|language-features
Recently i was asked to prove the power of C# 3.0 in a single line( might be tricky)
i wrote
new int[] { 1, 2, 3 }.Union(new int[]{10,23,45}).
ToList().ForEach(x => Console.WriteLine(x));
and explained you can have (i) anonymous array (ii) extension method (iii)lambda and closure all in a single line.I got spot offer.
But.....
The interviewer asked me how will you convert an anonymous type into know type :(
I am 100% sure ,we can not do that.The interviewer replied there is 200% chance to do that if you have a small work around.I was clueless.
As usual,I am waiting for your valuable reply(Is it possible?).
© Stack Overflow or respective owner