0

我是新的 VB.net,希望得到一些帮助。如何将以下代码从 C# 转换为 VB.NET

    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()               

            };         
        }     
    } 
4

1 回答 1

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
于 2012-05-16T20:16:49.093 回答