今天把一个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);

相关文章:

  • 2021-11-08
  • 2022-12-23
猜你喜欢
  • 2021-10-20
  • 2022-03-04
  • 2021-09-18
  • 2021-09-13
  • 2022-01-05
相关资源
相似解决方案