本文整理汇总了VB.NET中System.Web.SessionState.ISessionStateItemCollection接口的典型用法代码示例。如果您正苦于以下问题:VB.NET ISessionStateItemCollection接口的具体用法?VB.NET ISessionStateItemCollection怎么用?VB.NET ISessionStateItemCollection使用的例子?那么, 这里精选的接口代码示例或许可以为您提供帮助。
在下文中一共展示了ISessionStateItemCollection接口的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Clear
' 导入命名空间
Imports System.Web
Imports System.Web.SessionState
Imports System.Collections
Imports System.Collections.Specialized
Namespace Samples.AspNet.Session
Public Class MySessionStateItemCollection
Implements ISessionStateItemCollection
Private pItems As SortedList = New SortedList()
Private pDirty As Boolean = False
Public Property Dirty As Boolean Implements ISessionStateItemCollection.Dirty
Get
Return pDirty
End Get
Set
pDirty = value
End Set
End Property
Public Property Item(index As Integer) As Object Implements ISessionStateItemCollection.Item
Get
Return pItems(index)
End Get
Set
pItems(index) = value
pDirty = True
End Set
End Property
Public Property Item(name As String) As Object Implements ISessionStateItemCollection.Item
Get
Return pItems(name)
End Get
Set
pItems(name) = value
pDirty = True
End Set
End Property
Public ReadOnly Property Keys As NameObjectCollectionBase.KeysCollection _
Implements ISessionStateItemCollection.Keys
Get
Return CType(pItems.Keys, NameObjectCollectionBase.KeysCollection)
End Get
End Property
Public ReadOnly Property Count As Integer Implements ICollection.Count
Get
Return pItems.Count
End Get
End Property
Public ReadOnly Property SyncRoot As Object Implements ICollection.SyncRoot
Get
Return Me
End Get
End Property
Public ReadOnly Property IsSynchronized As Boolean Implements ICollection.IsSynchronized
Get
Return False
End Get
End Property
Public Function GetEnumerator() As IEnumerator Implements ICollection.GetEnumerator
Return pItems.GetEnumerator()
End Function
Public Sub Clear() Implements ISessionStateItemCollection.Clear
pItems.Clear()
pDirty = True
End Sub
Public Sub Remove(name As String) Implements ISessionStateItemCollection.Remove
pItems.Remove(name)
pDirty = True
End Sub
Public Sub RemoveAt(index As Integer) Implements ISessionStateItemCollection.RemoveAt
If index < 0 OrElse index >= Me.Count Then _
Throw New ArgumentOutOfRangeException("The specified index is not within the acceptable range.")
pItems.RemoveAt(index)
pDirty = True
End Sub
Public Sub CopyTo(array As Array, index As Integer) Implements ICollection.CopyTo
pItems.CopyTo(array, index)
End Sub
End Class
End Namespace