我了解结构和类类型之间的基本区别。但是,在 ASP.NET WebForms 应用程序中……在 ASP.NET WebForms 应用程序的 Session 中保存相对较大的数据结构的理想容器类型是什么?它应该是结构还是类?例如...
Public Structure SessionData
Public ShipVias As List(Of XXXXX999.sycdefil_sql_VW)
Public ShipTos As List(Of XXXXX999.ABC_Web_ShipTo_VW)
Public Dests As List(Of XXXXX999.ABC_Web_CofA_VW)
Public Owners As List(Of XXXXX999.ABC_Web_CofA_VW)
Public Carts As List(Of XXXXX999.ABC_Web_Cart_VW)
Public Carriers As List(Of XXXXX999.ABC_Carrier_Accounts_VW)
Public Countries As List(Of XXXXX999.usp_get_CountryListResult)
Public States As List(Of XXXXX999.usp_get_StatesListResult)
Public POItems As List(Of XXXXX999.usp_get_cart_infoResult)
Public SearchResults As List(Of SearchResult)
Public Addresses As List(Of AddressResult)
Public CartItems As List(Of itemsdetail)
Public POs As List(Of POResult)
Public SomeCollection As Collection
Public CmpCode As String
Public CmpStatus As String
Public CmpSIPCust As String
Public CurrentSession As String
Public AllowAccess As Boolean
Public QuickAddItems As List(Of QuickAddItem)
End Structure
正如您可能知道的那样,XXXXX999 包含一个 LINQTOSQL DataContext dbml,其中包含存储过程、函数、视图和表。
编辑点:我刚刚意识到我可以使一个结构(C#)可以为空......在vb.net Nullable(Of SessionData)......还有问号这样的伎俩...... Dim sd As SessionData?我应该将其保留为结构还是将其转换为类?