我正在尝试将此代码从 csharp 转换为 vb。使用免费 csharp 到 vb 转换器的所有孩子,但出现错误。请让知道是否有人以前解决过这个问题。
错误:
类 'QueryParameterComparer' 必须为接口 'System.Collections.Generic.IComparer(Of QueryParameter)' 实现 'Function Compare(x As OAuthBase.QueryParameter, y As OAuthBase.QueryParameter) As Integer'
来自 c#code:
protected class QueryParameterComparer : IComparer<QueryParameter>
{
public int Compare(QueryParameter x, QueryParameter y)
{
if (x.Name == y.Name)
{
return string.Compare(x.Value, y.Value);
}
else
{
return string.Compare(x.Name, y.Name);
}
}
}
到vb代码
Protected Class QueryParameterComparer
Implements IComparer(Of QueryParameter)
#Region "IComparer Members"
Public Function Compare(ByVal x As QueryParameter, ByVal y As QueryParameter) As Integer
If x.Name = y.Name Then
Return String.Compare(x.Value, y.Value)
Else
Return String.Compare(x.Name, y.Name)
End If
End Function
#End Region
End Class