需要将此代码转换为VB

时间:2012-08-16 13:00:05

标签: c# vb.net ienumerable c#-to-vb.net

我根本不熟悉C#.NET。我需要将其转换为VB。有人可以帮我一把吗?

public IEnumerable<CodecInfo> AudioCodecs
        {
            get { return softPhone.Codecs.Where(c => c.CodecType == CodecMediaType.Audio); }
        }

谢谢

3 个答案:

答案 0 :(得分:5)

Public ReadOnly Property AudioCodecs As IEnumerable(Of CodecInfo)
    Get
        Return From c In softPhone.Codecs
               Where c.CodecType = CodecMediaType.Audio
    End Get
End Property

查询语法比VB.NET中的方法语法更具可读性

答案 1 :(得分:3)

Public ReadOnly Property AudioCodecs() As IEnumerable(Of CodecInfo)
    Get
        Return softPhone.Codecs.Where(Function(c) c.CodecType = CodecMediaType.Audio)
    End Get
End Property

将来你可以使用C#-VB.NET转换器:

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

答案 2 :(得分:0)

Public ReadOnly Property AudioCodecs() As IEnumerable(Of CodecInfo)
    Get
        Return softPhone.Codecs.Where(Function(c) c.CodecType = CodecMediaType.Audio)
    End Get
End Property