我在 VB.NET 中有以下代码,现在运行良好。我需要将其转换为 C#。它无法编译,因为编译器不知道代理方法。您能否让我知道如何将参数(Byref 代理作为对象)转换为 C#。太感谢了。
Public Shared Function SetupProxy(ByRef proxy As Object) As Boolean
Dim token As New UsernameToken(Var.sHTNGUsername, Var.sHTNGPassword, PasswordOption.SendPlainText)
Dim clientPolicy As New Policy
clientPolicy.Assertions.Add(New UsernameOverTransportAssertion())
proxy.SetPolicy(clientPolicy)
proxy.SetClientCredential(token)
Return True
End Function