怎样将以下的C#.net类代码(.cs)转换成vb.net(.vb) public static
publicstaticMembershipUserCollectionGetAllusers(){inta=Membership.GetAllUsers().Count...
public static MembershipUserCollection GetAllusers()
{
int a=Membership.GetAllUsers().Count;
return Membership.GetAllUsers(0,5, out a);
}
public static MembershipUser GetUser()
{
return Membership.GetUser();
}
计算机 编程 展开
{
int a=Membership.GetAllUsers().Count;
return Membership.GetAllUsers(0,5, out a);
}
public static MembershipUser GetUser()
{
return Membership.GetUser();
}
计算机 编程 展开
2个回答
展开全部
Public Shared Function GetAllusers() As MembershipUserCollection
Dim a As Integer = Membership.GetAllUsers().Count
GetAllusers = Membership.GetAllUsers(0, 5, a)
End Function
Public Shared Function GetUser() As MembershipUser
GetUser = Membership.GetUser()
End Function
Dim a As Integer = Membership.GetAllUsers().Count
GetAllusers = Membership.GetAllUsers(0, 5, a)
End Function
Public Shared Function GetUser() As MembershipUser
GetUser = Membership.GetUser()
End Function
追问
但是在UpDate,UpDateAll和Delete的方法头上c#是使用public static void UpDate()...开头的
我下面这样的写法对不对?vs2005提示:“函数UpDate,UpDateAll和Delete并非在所有代码路径上都返回值。当使用结果时,可能会在运行时发生空引用异常.”这个怎么解决?
Public Function UpDate(ByVal Comment As String, ByVal Email As String, ByVal IsApproved As Boolean)
End Function
追答
如果没有返回值的话,不要用Function,用Sub
Public Sub UpDate(ByVal Comment As String, ByVal Email As String, ByVal IsApproved As Boolean)
End Sub
如果需要返回值的话,就必须要确保这个函数一定是有返回值的。
展开全部
public Shared Sub GetAllusers() as MembershipUserCollection
dim a =Membership.GetAllUsers().Count
return Membership.GetAllUsers(0,5, out a)
end sub
public static GetUser() as MembershipUser
return Membership.GetUser()
end sub
回答上面的追问:
应该是你function里的代码错了,有的没有return值就over了
dim a =Membership.GetAllUsers().Count
return Membership.GetAllUsers(0,5, out a)
end sub
public static GetUser() as MembershipUser
return Membership.GetUser()
end sub
回答上面的追问:
应该是你function里的代码错了,有的没有return值就over了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询