Code Trivia #7

Posted by João Angelo on Exceptional Code See other posts from Exceptional Code or by João Angelo
Published on Tue, 29 Nov 2011 21:54:56 +0000 Indexed on 2011/11/30 2:04 UTC
Read the original article Hit count: 472

Filed under:
|
|
|

Lets go for another code trivia, it’s business as usual, you just need to find what’s wrong with the following code:

static void Main(string[] args)
{
    using (var file = new FileStream("test", FileMode.Create) { WriteTimeout = 1 })
    {
        file.WriteByte(0);
    }
}

TIP: There’s something very wrong with this specific code and there’s also another subtle problem that arises due to how the code is structured.


© Exceptional Code or respective owner

Related posts about .NET

Related posts about c#