首页 > 代码库 > VB.NET转C#代码的工具

VB.NET转C#代码的工具

比如VB.NET的代码:

For Each prop In entity.Details.Properties.All().
        OfType(Of Microsoft.LightSwitch.Details.IEntityStorageProperty)()

        If prop.Name <> "Id" Then 
            If Not Object.Equals(prop.Value, prop.OriginalValue) Then 
                oldvals += String.Format("{0}{1}: {2}", vbCrLf, prop.Name, prop.OriginalValue)
                newvals += String.Format("{0}{1}: {2}", vbCrLf, prop.Name, prop.Value)
            End If 
        End If 
   Next 

转为C#的代码:

foreach (var prop in entity.Details.Properties.All().OfType<Microsoft.LightSwitch.Details.IEntityStorageProperty>())
{
     
    if (prop.Name != "Id")
    {
        if (!object.Equals(prop.Value, prop.OriginalValue))
        {
            oldvals += string.Format("{0}{1}: {2}", "\r\n", prop.Name, prop.OriginalValue);
            newvals += string.Format("{0}{1}: {2}", "\r\n", prop.Name, prop.Value);
        }
    }
}

代码转换工具链接:http://www.ttrar.com/html/VBNet-to-C-Sharp-Converter.html#down


VB.NET转C#代码的工具