Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Implementing IList
Author:
Ed N.
Submitted:
6/1/2004
Version:
VB.NET
Compatibility:
VB.NET
Category:
Controls
Views:
35450
I'm just learning VB.Net and it took me 1/2 a day to figure out how to create a class that implements IList. I'm posting the code here to help anyone else that might need it.
Declarations:
dim NewIListClass as New IListClass
Code:
Class IListClass Implements IList ' Shell of IList interface ' By Ed Niklas 6-1-2004 Private _Item As Object Private _Count As Integer Private _IsFixedSize As Boolean Private _IsSynchronized As Boolean Private _SyncRoot As Object Private _IsReadOnly As Boolean Default Property Item(ByVal index As Integer) As Object _ Implements IList.Item Get Item = _Item End Get Set(ByVal Value As Object) _Item = Value End Set End Property Public ReadOnly Property Count() As Integer _ Implements IList.Count Get Count = _Count End Get End Property Public ReadOnly Property IsFixedSize() As Boolean _ Implements IList.IsFixedSize Get IsFixedSize = _IsFixedSize End Get End Property Public ReadOnly Property IsReadOnly() As Boolean _ Implements IList.IsReadOnly Get IsReadOnly = _IsReadOnly End Get End Property Public ReadOnly Property IsSynchronized() As Boolean _ Implements IList.IsSynchronized Get IsSynchronized = _IsSynchronized End Get End Property Public ReadOnly Property SyncRoot() As Object _ Implements IList.SyncRoot Get SyncRoot = _SyncRoot End Get End Property Private Function Add(ByVal o As Object) As Integer _ Implements IList.Add Return Me.Add(CType(o, Object)) End Function Public Function Contains(ByVal value As Object) As Boolean _ Implements IList.Contains End Function Public Function GetEnumerator() As IEnumerator _ Implements IList.GetEnumerator End Function Public Function IndexOf(ByVal value As Object) As Integer _ Implements IList.IndexOf End Function Public Sub Clear() _ Implements IList.Clear End Sub Public Sub CopyTo(ByVal array As Array, ByVal index As Integer) _ Implements IList.CopyTo End Sub Public Sub Insert(ByVal index As Integer, ByVal value As Object) _ Implements IList.Insert End Sub Public Sub Remove(ByVal value As Object) _ Implements IList.Remove End Sub Public Sub RemoveAt(ByVal index As Integer) _ Implements IList.RemoveAt End Sub End Class
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement