tags:

views:

186

answers:

5

Hi all,

I'm looking for the C# equivalent of the line below.

If New FileInfo(c:\images\test.jpg).Length < 25 * 1024 Then

'something

End If

Thannks for the help.

+14  A: 

At least that's a straightforward one.

if (new FileInfo(@"c:\images\test.jpg").Length < (25 * 1024))
{
    // something
}

The @-sign disables backslash escape processing in the string.

Jeffrey Hantin
the fastest gun gets the votes
Neil N
+1  A: 
if (new FileInfo(@"c:\Images\test.jpg").Length < 25 * 1024)
{
  // something
}
jsight
A: 
if(new FileInfo(@"c:\images\test.jpg").Length < 1024 * 4))
{
  // something
}
Neil N
1025 * 4? *giggle*
Jeffrey Hantin
yarr </Pirate>
Neil N
+2  A: 

Try this out too: VB to C#

{
    if (new FileInfo("c:\\images\\test.jpg").Length < 25 * 1024) {

    }
    //something
}

Be sure to verify the output though. Converters are not 100%.

beach
+1  A: 

I'd recommend checking out these free conversion sites for questions like these:

http://www.developerfusion.com/tools/convert/vb-to-csharp/
http://converter.telerik.com/

brendan