VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > VB.net教程 >
  • 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

出处:https://www.cnblogs.com/guwei4037/p/5639456.html

 


相关教程