将这些行从 C# 转换为 VB.Net? [英] Convert these lines from C# to VB.Net?

查看:23
本文介绍了将这些行从 C# 转换为 VB.Net?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何将其转换为 VB.NET.

I'm wondering how this can be converted to VB.NET.

private void RaiseStreamVolumeNotification()
    {
        if (StreamVolume != null)
        {
            StreamVolume(this, new StreamVolumeEventArgs() { MaxSampleValues = (float[])maxSamples.Clone() });
        }

    }

public class StreamVolumeEventArgs : EventArgs
{
    public float[] MaxSampleValues { get; set; }
}

我正在尝试使用在线转换器进行转换,但要么失败,要么转换不正确.我认为最好的一个转换器将其转换为:

I'm trying to convert it using an online converter, but either it fails, or it converts it incorrectly. One converter, which I think is the best one, converts it to this:

Public Class StreamVolumeEventArgs
    Inherits EventArgs
Private _MaxSampleValues As Single()
    Public Property MaxSampleValues() As Single()
        Get
            Return _MaxSampleValues
        End Get
        Set(ByVal value As Single())
            _MaxSampleValues = value
        End Set
    End Property
End Class

推荐答案

可能存在一些小问题.

Private Sub RaiseStreamVolumeNotification()
        Dim SVEA As New StreamVolumeEventArgs()
        SVEA.MaxSampleValues = CType(maxSamples.Clone(), Single())
        If Not StreamVolume Is Nothing Then
            StreamVolume(this, SVEA)
        End If
End Sub

Public Class StreamVolumeEventArgs Inheirits EventArgs
    Private _MaxSampleValues As Single()
    Public Property MaxSampleValues As Single()
        Get
            Return _MaxSampleValues
        End Get
        Set(value as Single())
            _MaxSampleValues = value
        End Set
    End Property
End Class

这篇关于将这些行从 C# 转换为 VB.Net?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆