我是C#的新手,并且有一个用于发送电子邮件的VB子例程。
我不知道如何转换为C#,有人可以帮助我吗?
这是sub:
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
答案 0 :(得分:1)
我建议你看一下这个问题:
答案 1 :(得分:1)
Telerik有一个非常方便的web interface用于将VB.Net转换为C#。
答案 2 :(得分:1)
您可以借此机会增加对c#和vb.net的了解并自行转换。
答案 3 :(得分:0)
您可以使用Redgate's .NET Reflector将已编译的VB.NET代码反汇编为C#。