VB.NET 中的ref 和C#中的ref 格式区别

今天把一个VB.NET的程序翻成C#的,在ref这堵了半天。

函数定义是这样的:

Public Shared Function GetUsers(ByVal portalId As IntegerByVal isHydrated As BooleanByVal pageIndex As IntegerByVal pageSize As IntegerByRef totalRecords As IntegerAs 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);

posted on 2006-12-10 17:40  m2land  阅读(1725)  评论(0编辑  收藏  举报

导航