|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
C# teasersHi,
I'm looking for C# brain teasers (or VB.NET): a little piece of code that does something special, or where a little error is. Does anyone has some of these, or links to sites? Thanks! Hello Ludwig,
Use the MS certification preparation matherials for this. They are a good source for such kind of teasers --- WBR, Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour "The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it" (c) Michelangelo L> Hi, L> I'm looking for C# brain teasers (or VB.NET): a little piece of code L> that does something special, or where a little error is. Does anyone L> has some of these, or links to sites? L> Thanks! On Nov 27, 1:14 pm, Ludwig <lstuyc***@gmail.com> wrote:
> I'm looking for C# brain teasers (or VB.NET): a little piece of code Are you after "this doesn't do what you think it does" type things (eg> that does something special, or where a little error is. Does anyone > has some of these, or links to sites? overloading special cases, or captured variables) or "you should be able to get this really" questions? Jon On 27 nov, 15:01, "Jon Skeet [C# MVP]" <sk***@pobox.com> wrote: Both :)> On Nov 27, 1:14 pm, Ludwig <lstuyc***@gmail.com> wrote: > > > I'm looking for C# brain teasers (or VB.NET): a little piece of code > > that does something special, or where a little error is. Does anyone > > has some of these, or links to sites? > > Are you after "this doesn't do what you think it does" type things (eg > overloading special cases, or captured variables) or "you should be > able to get this really" questions? > > Jon On Nov 27, 2:33 pm, Ludwig <lstuyc***@gmail.com> wrote:
<snip> > Both :) Okay. I've a few ideas - I'll post some tonight.Jon On 27 nov, 15:41, "Jon Skeet [C# MVP]" <sk***@pobox.com> wrote: Thank you! Meanwhile I'm looking into the certification books - I've> On Nov 27, 2:33 pm, Ludwig <lstuyc***@gmail.com> wrote: > > <snip> > > > Both :) > > Okay. I've a few ideas - I'll post some tonight. > > Jon to take the exams anyway, so it's a good waste of time ;) Ludwig <lstuyc***@gmail.com> wrote:
<snip> > Thank you! Meanwhile I'm looking into the certification books - I've Here are some to be going on with. I'll add to the list as I remember > to take the exams anyway, so it's a good waste of time ;) them... http://pobox.com/~skeet/csharp/teasers.html -- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet World class .NET training in the UK: http://iterativetraining.co.uk On Nov 27, 2:46 pm, Jon Skeet [C# MVP] <sk***@pobox.com> wrote:
> Here are some to be going on with. I'll add to the list as I remember I love #2. I've seen your blog about beforefieldinit before. It> them... > > http://pobox.com/~skeet/csharp/teasers.html > > -- would be plain wrong to ask somebody that question in an interview :) By the way, you should keep adding to that page periodically or as you run across a good one. Brian Gideon <briangid***@yahoo.com> wrote:
> I love #2. I've seen your blog about beforefieldinit before. It Indeed. Unless they were claiming to know absolutely everything about > would be plain wrong to ask somebody that question in an interview :) C#, in which case anything is fair game. > By the way, you should keep adding to that page periodically or as you Absolutely - I've been meaning to do something like it for a while. > run across a good one. This thread was a catalyst :) -- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet World class .NET training in the UK: http://iterativetraining.co.uk On 27 nov, 22:27, Jon Skeet [C# MVP] <sk***@pobox.com> wrote:
Show quote > Brian Gideon <briangid***@yahoo.com> wrote: Here's another nice one:> > I love #2. I've seen your blog about beforefieldinit before. It > > would be plain wrong to ask somebody that question in an interview :) > > Indeed. Unless they were claiming to know absolutely everything about > C#, in which case anything is fair game. > > > By the way, you should keep adding to that page periodically or as you > > run across a good one. > > Absolutely - I've been meaning to do something like it for a while. > This thread was a catalyst :) > > -- > Jon Skeet - <sk***@pobox.comhttp://www.pobox.com/~skeet Blog:http://www.msmvps.com/jon.skeet > World class .NET training in the UK:http://iterativetraining.co.uk Console.WriteLine(1 + 2 + "3"); Console.WriteLine("1" + 2 + 3); On 27 nov, 21:46, Jon Skeet [C# MVP] <sk***@pobox.com> wrote:
Show quote > Ludwig <lstuyc***@gmail.com> wrote: Perfect, I've bookmarked your site and will have a look!! Thanks!> > <snip> > > > Thank you! Meanwhile I'm looking into the certification books - I've > > to take the exams anyway, so it's a good waste of time ;) > > Here are some to be going on with. I'll add to the list as I remember > them... > > http://pobox.com/~skeet/csharp/teasers.html > > -- > Jon Skeet - <sk***@pobox.comhttp://www.pobox.com/~skeet Blog:http://www.msmvps.com/jon.skeet > World class .NET training in the UK:http://iterativetraining.co.uk
Show quote
"Ludwig" wrote:
> Hi, > I'm looking for C# brain teasers (or VB.NET): a little piece of code > that does something special, or where a little error is. Does anyone > has some of these, or links to sites? > Thanks! > I have a program that finds prime numbers, if you are interested.
Show quote "Ludwig" wrote: > Hi, > I'm looking for C# brain teasers (or VB.NET): a little piece of code > that does something special, or where a little error is. Does anyone > has some of these, or links to sites? > Thanks! > There's one here that threw me for a loop late one night:
http://groups.google.com/group/microsoft.public.dotnet.framework/browse_frm/thread/9d5ad8caf1bf1c20/344fc9ba3b43ae3b Other fun ones include some of Joe Duffy's (and Jon Skeet's) examples of broken double-check locks. -- Show quoteChris Mullins "Ludwig" <lstuyc***@gmail.com> wrote in message news:11bc359a-1e08-407c-b2d0-fd4a425a6af7@s12g2000prg.googlegroups.com... > Hi, > I'm looking for C# brain teasers (or VB.NET): a little piece of code > that does something special, or where a little error is. Does anyone > has some of these, or links to sites? > Thanks! x = x & (x-1)
Show quote "Ludwig" <lstuyc***@gmail.com> wrote in message news:11bc359a-1e08-407c-b2d0-fd4a425a6af7@s12g2000prg.googlegroups.com... > Hi, > I'm looking for C# brain teasers (or VB.NET): a little piece of code > that does something special, or where a little error is. Does anyone > has some of these, or links to sites? > Thanks! Ludwig wrote:
> Hi, Special? How about this:> I'm looking for C# brain teasers (or VB.NET): a little piece of code > that does something special, or where a little error is. Does anyone > has some of these, or links to sites? Why does this compile: public class Program{ public static void Main(string[] args){ TypedReference typedReference = new TypedReference(); } } and this not compile: public class Program{ public static void Main(string[] args){ object typedReference = new TypedReference(); } } Alun Harford On Nov 27, 7:14 am, Ludwig <lstuyc***@gmail.com> wrote:
> Hi, This one piqued my interest some time back.> I'm looking for C# brain teasers (or VB.NET): a little piece of code > that does something special, or where a little error is. Does anyone > has some of these, or links to sites? > Thanks! http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/browse_frm/thread/686e2d628962b8c8/720965d37f201ddb?lnk=st&q=specification#720965d37f201ddb |
|||||||||||||||||||||||