2012-05-16 82 views
0

我是新的VB.net并希望得到一些帮助。 我如何转换下面的代码从C#到VB.NET如何将下面的代码从C#转换为VB.net(linq转换为xml)

protected override Func<XElement, Person> Selector  
    {   
     get   
     {    
      return x => new Person() 
      {     
       Id = x.Attribute("Id").GetGuid(),     
        FirstName = x.Attribute("FirstName").Value,     
        LastName = x.Attribute("LastName").Value,     
         Dias = x.Attribute("Dias").GetByte()    

      };   
     }  
    } 

回答

0

我发现这个免费工具的工作转换C#来Vb.net相当不错:

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

结果:

Protected Overrides ReadOnly Property Selector() As Func(Of XElement, Person) 
    Get 

     Return Function(x) New Person() With { _ 
      Key .Id = x.Attribute("Id").GetGuid(), _ 
      Key .FirstName = x.Attribute("FirstName").Value, _ 
      Key .LastName = x.Attribute("LastName").Value, _ 
      Key .Dias = x.Attribute("Dias").GetByte() _ 
     } 
    End Get 
End Property