|
Imports System
Imports System.Collections
Imports System.Xml.Serialization
Namespace Config
' Represents the Pages which use the Page Templates in the PageConfig
<XmlRoot("Pages")> _
Public Class PageCollection
Inherits System.Collections.CollectionBase
' The default Page Template to be used by Pages that implement the
' PageBase class, but are not registered individually
<XmlAttributeAttribute()> _
Public DefaultTemplateName As String
' Indexer that will return the Page at the specified index
<XmlArrayItem("Page")> _
Default Public Property Item(ByVal index As Int32) As Page
Get
' Return the Page from the internal IList at the specified index
Return CType(Me.List.Item(index), Page)
End Get
Set(ByVal Value As Page)
' Store the specified Page in the internal IList
Me.List.Item(index) = Value
End Set
End Property
' Method that will Add a Page to the PageCollection
' @page: The Page to add to the PageCollection
Public Sub Add(ByVal page As Page)
' Add the specified Page to the internal IList
Me.List.Add(page)
End Sub
' Method that will insert the specified Page to the PageCollection at
' the specified index
' @index: The index at which to Page should be inserted
' @page: The Page to insert into the PageCollection
Public Sub Insert(ByVal index As Int32, ByVal page As Page)
' Insert the specified Page to the internal IList
Me.List.Insert(index, page)
End Sub
' Method that will remove the specified Page from the PageCollection
' @page: The Page to be removed from the PageCollection
Public Sub Remove(ByVal page As Page)
' Remove the page from the internal IList
Me.List.Remove(page)
End Sub
' Method that will return the index of the specified Page in the PageCollection
' @page: The Page whose index is being requested
' returns: The index of the specified Page in the PageCollection
Public Function IndexOf(ByVal page As Page) As Int32
' Obtain the index of the Page from the interal IList
Return Me.List.IndexOf(page)
End Function
' Method that will determine if the specified Page exists in the PageCollection
' @page: The Page to be located
'returns: A boolean value indicated whether or not the PageCollection contains the specified Page
Public Function Contains(ByVal page As Page) As Boolean
' Check to see if the Page exists in the internal IList
Return Me.List.Contains(page)
End Function
End Class
End Namespace
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Scott Van Vliet is a Principal Consultant with Neudesic based in Irvine, CA. He has been designing and developing technology solutions for the past 8 years, and has worked with Microsoft .NET technologies for over 3 years. Scott is currently developing solutions with ASP.NET 2.0, C# 2.0, Windows Presentation Foundation (codename "Avalon"), SQL Server 2000/2005, Reporting Services and SharePoint.
Scott welcomes feedback and can be reached through his Weblog at
http://weblogs.asp.net/skillet/.