Click here to Skip to main content
15,879,474 members
Articles / General Programming / File

VB 9.0, C# 3.0 API Viewer

Rate me:
Please Sign up or sign in to vote.
4.35/5 (10 votes)
24 May 2012CPOL5 min read 79.8K   4.2K   42  
This is a remake of Pramod Kumar Sing's 2002 API Viewer.
Namespace RSP
    Public Class CDeclare
        Implements IStore
        Dim DeclareList As SortedList
        Dim DeclareListCSharp As SortedList

        Sub New()
            DeclareList = New SortedList()
            DeclareListCSharp = New SortedList()
        End Sub

        Sub Add(ByVal Key As String, ByVal Data As String, Optional ByVal bCSharp As Boolean = False) Implements IStore.Add
            If Not bCSharp Then
                If Not DeclareList.ContainsKey(Key) Then
                    DeclareList.Add(Key, Data)
                End If
            Else
                If Not DeclareListCSharp.ContainsKey(Key) Then
                    DeclareListCSharp.Add(Key, Data)
                End If
            End If
        End Sub

        Overloads Function GetData(ByVal Key As String) As String Implements IStore.GetData
            If DeclareList.ContainsKey(Key) Then
                Return CType(DeclareList.Item(Key), String)
            Else
                Return Nothing
            End If
        End Function

        Overloads Function GetData(ByVal index As Integer) As String Implements IStore.GetData
            Return CType(DeclareList.GetByIndex(index), String)
        End Function

        ReadOnly Property Count() As Integer Implements IStore.Count
            Get
                Return DeclareList.Count()
            End Get
        End Property

        ReadOnly Property GetKey(ByVal index As Integer) As String Implements IStore.GetKey
            Get
                If index < DeclareList.Count Then
                    Return CType(DeclareList.GetKey(index), String)
                Else
                    Return ""
                End If
            End Get
        End Property

        Overloads Function GetDataCSharp(ByVal Key As String) As String Implements IStore.GetDataCSharp
            If DeclareListCSharp.ContainsKey(Key) Then
                Return CType(DeclareListCSharp.Item(Key), String)
            Else
                Return Nothing
            End If
        End Function

        Overloads Function GetDataCSharp(ByVal index As Integer) As String Implements IStore.GetDataCSharp
            If index < DeclareListCSharp.Count Then
                Return CType(DeclareListCSharp.GetByIndex(index), String)
            Else
                Return Nothing
            End If
        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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Retired
United States United States
I am currently retired.
I have no degree but I have some programming experience
when I was in college(Cobol, Pascal).

My accomplishments thus far are;
Best VB.Net article for January(2009)
Best VB.Net article for July(2009)

Comments and Discussions