VB.NET 中的ref 和C#中的ref 格式区别
今天把一个VB.NET的程序翻成C#的,在ref这堵了半天。
函数定义是这样的:
在VB.NET中可以这样引用:
但在C#中,引用要加上"ref",参见MSDN: ref(C# 参考)
函数定义是这样的:
Public Shared Function GetUsers(ByVal portalId As Integer, ByVal isHydrated As Boolean, ByVal pageIndex As Integer, ByVal pageSize As Integer, ByRef totalRecords As Integer) As ArrayList
在VB.NET中可以这样引用:
Users = UserController.GetUsers(UsersPortalId, False, CurrentPage - 1, PageSize, TotalRecords)
但在C#中,引用要加上"ref",参见MSDN: ref(C# 参考)
Users = UserController.GetUsers(UsersPortalId, false, CurrentPage-1, PageSize, ref TotalRecords);