C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Create a Generic Colletion to store objects in VB.Net


Posted Date: 05 Jun 2007    Resource Type: Code Snippets    Category: ADO.NET

Posted By: Bharathi       Member Level: Diamond
Rating:     Points: 10



The code will represent a user defined collections for storing objects and retriving objects from the Collection and to manipulate it.

For example you can have the collection of class objects in this collection.
This collection can be iterated using For Each.


Public Class GenericCollection
Implements IEnumerable, IEnumerator
Dim arr As New ArrayList
Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
Return arr.GetEnumerator()
End Function

Public ReadOnly Property Current() As Object Implements System.Collections.IEnumerator.Current
Get
Return arr.GetEnumerator.Current()
End Get
End Property

Public Function MoveNext() As Boolean Implements System.Collections.IEnumerator.MoveNext
GetEnumerator.MoveNext()
End Function

Public Sub Reset() Implements System.Collections.IEnumerator.Reset
arr.Clear()
End Sub

Public Sub Add(ByVal obj As object)
arr.Add(obj)
End Sub

Public Function Count() As Integer
Return arr.Count
End Function

Public Function RemoveAt(ByVal Index As Integer)
arr.RemoveAt(index)
End Function

Public Function Remove(ByVal obj As object)
arr.Remove(obj)
End Function

Public Function Item(ByVal Index As Integer) As object
Return arr.Item(Index)
End Function

End Class




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: To access Stored Procedure in DataAdapter
Previous Resource: How to get the active processes running in Microsoft SQL Server database?
Return to Discussion Resource Index
Post New Resource
Category: ADO.NET


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

conference calls

Contact Us    Privacy Policy    Terms Of Use