简体   繁体   English

将一行VB.Net代码转换为C#

[英]Convert one line of VB.Net code to C#

I'm looking for the C# equivalent of the line below. 我正在寻找下面这一行的C#等价物。

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

'something

End If

Thannks for the help. 谢谢你的帮助。

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. @ -sign禁用字符串中的反斜杠转义处理。

Try this out too: VB to C# 试试这个: VB到C#

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

    }
    //something
}

Be sure to verify the output though. 请务必验证输出。 Converters are not 100%. 转换器不是100%。

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

I'd recommend checking out these free conversion sites for questions like these: 我建议您查看这些免费转换网站,了解以下问题:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM