c# to vb.net如何继承多个class?无法转换它。 SharpDevelop 也失败了
c# to vb.net How to inherit more than one class? Can't convert it. SharpDevelop failed, too
我试图将此代码从 c# 转换为 vb.net,但它总是失败,因为 vb.net 不允许将多个 class 继承到 class。
如何解决?
这是 C# 代码:
public class MyPromptService : PromptService, nsIAuthPrompt, nsIAuthPrompt2
{
nsICancelable nsIAuthPrompt2.AsyncPromptAuth(nsIChannel aChannel, nsIAuthPromptCallback aCallback, nsISupports aContext, uint level, nsIAuthInformation authInfo)
{
throw new NotImplementedException();
}
bool nsIAuthPrompt2.PromptAuth(nsIChannel aChannel, uint level, nsIAuthInformation authInfo)
{
nsString.Set(authInfo.SetUsernameAttribute, "Username");
nsString.Set(authInfo.SetPasswordAttribute, "Password");
return true;
}
}
感谢您到目前为止的帮助。
转换器应该能够推断出第二个和第三个碱基是接口(进一步添加'AddressOf'操作提示):
Public Class MyPromptService
Inherits PromptService
Implements nsIAuthPrompt, nsIAuthPrompt2
Private Function nsIAuthPrompt2_AsyncPromptAuth(ByVal aChannel As nsIChannel, ByVal aCallback As nsIAuthPromptCallback, ByVal aContext As nsISupports, ByVal level As UInteger, ByVal authInfo As nsIAuthInformation) As nsICancelable Implements nsIAuthPrompt2.AsyncPromptAuth
Throw New NotImplementedException()
End Function
Private Function nsIAuthPrompt2_PromptAuth(ByVal aChannel As nsIChannel, ByVal level As UInteger, ByVal authInfo As nsIAuthInformation) As Boolean Implements nsIAuthPrompt2.PromptAuth
nsString.Set(AddressOf authInfo.SetUsernameAttribute, "Username")
nsString.Set(AddressOf authInfo.SetPasswordAttribute, "Password")
Return True
End Function
End Class
我试图将此代码从 c# 转换为 vb.net,但它总是失败,因为 vb.net 不允许将多个 class 继承到 class。
如何解决?
这是 C# 代码:
public class MyPromptService : PromptService, nsIAuthPrompt, nsIAuthPrompt2
{
nsICancelable nsIAuthPrompt2.AsyncPromptAuth(nsIChannel aChannel, nsIAuthPromptCallback aCallback, nsISupports aContext, uint level, nsIAuthInformation authInfo)
{
throw new NotImplementedException();
}
bool nsIAuthPrompt2.PromptAuth(nsIChannel aChannel, uint level, nsIAuthInformation authInfo)
{
nsString.Set(authInfo.SetUsernameAttribute, "Username");
nsString.Set(authInfo.SetPasswordAttribute, "Password");
return true;
}
}
感谢您到目前为止的帮助。
转换器应该能够推断出第二个和第三个碱基是接口(进一步添加'AddressOf'操作提示):
Public Class MyPromptService
Inherits PromptService
Implements nsIAuthPrompt, nsIAuthPrompt2
Private Function nsIAuthPrompt2_AsyncPromptAuth(ByVal aChannel As nsIChannel, ByVal aCallback As nsIAuthPromptCallback, ByVal aContext As nsISupports, ByVal level As UInteger, ByVal authInfo As nsIAuthInformation) As nsICancelable Implements nsIAuthPrompt2.AsyncPromptAuth
Throw New NotImplementedException()
End Function
Private Function nsIAuthPrompt2_PromptAuth(ByVal aChannel As nsIChannel, ByVal level As UInteger, ByVal authInfo As nsIAuthInformation) As Boolean Implements nsIAuthPrompt2.PromptAuth
nsString.Set(AddressOf authInfo.SetUsernameAttribute, "Username")
nsString.Set(AddressOf authInfo.SetPasswordAttribute, "Password")
Return True
End Function
End Class