0

我是 C# 新手,并且有一个用于发送电子邮件的 VB 子例程。

我不确定如何转换为 C#,有人可以帮我吗?

这是子:

Sub SendAdditionalEmails()
    Dim strDelimeter As String = ","
    Dim strEmailResult As String = ""
    'make sure they dont put a comma on the end (To)
    If InStr(Len(txtTo.Text) - 1, txtTo.Text, ",") > 0 Then
        txtTo.Text = Mid(txtTo.Text, 1, Len(txtTo.Text) - 1)
    End If

    'put the emails into the array
    Dim splitout As Array = Split(txtTo.Text, strDelimeter)
    Dim i As Integer = 0
    Me.pnlError.Visible = False
    For i = 0 To UBound(splitout)
        'loop through all the emails and send them ...
        '-------------------------------------------------------------------
        If SendEmail(splitout(i), txtSubject.Text, txtMessage.Text) = True Then
            txtTo.Text = ""
            txtSubject.Text = ""
            txtMessage.Text = ""
            chkTenantBrochure.Checked = False
            lblSuccess.Text = lblSuccess.Text & "An email was sent to: " & splitout(i) & "<br>"
            lblSuccess.Visible = True
        Else
            Me.pnlError.Visible = True
            lblError.Text = lblError.Text & "An email did not get sent to: " & splitout(i) & "<br>"
            lblError.Visible = True
        End If

    Next
End Sub
4

4 回答 4

1

我建议你看看这个问题:

将 VB.NET 转换为 C# 的好方法?

于 2009-12-30T21:05:52.350 回答
1

Telerik 有一个非常方便的Web 界面,用于将 VB.Net 转换为 C#。

于 2009-12-30T21:07:31.647 回答
1

您可以借此机会增加您对 c# 和 vb.net 的了解并自行转换。

于 2009-12-30T21:19:18.033 回答
0

您可以使用Redgate 的 .NET Reflector将已编译的 VB.NET 代码反汇编为 C#。

于 2009-12-30T21:05:20.370 回答