欢迎光临
我们一直在努力

用vb.net开发api viewer(3)-.NET教程,Windows开发

建站超值云服务器,限时71元/月

在项目文件中添加新项-类(cconst.vb)
代码如下:
namespace api
    public class cconst
        implements istore
        dim constlist as sortedlist
        dim constlistcsharp as sortedlist
        sub new()
            constlist = new sortedlist()
            constlistcsharp = 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 constlist.containskey(key) then
                    constlist.add(key, data)
                end if
            else
                if not constlistcsharp.containskey(key) then
                    constlistcsharp.add(key, data)
                end if
            end if
        end sub
        overloads function getdata(byval key as string) as string implements istore.getdata
            if constlist.containskey(key) then
                return ctype(constlist.item(key), string)
            else
                return nothing
            end if
        end function
        overloads function getdata(byval index as integer) as string implements istore.getdata
            return ctype(constlist.getbyindex(index), string)
        end function
        readonly property count() as integer implements istore.count
            get
                return constlist.count()
            end get
        end property
        readonly property getkey(byval index as integer) as string implements istore.getkey
            get
                if index < constlist.count then
                    return ctype(constlist.getkey(index), string)
                else
                    return ""
                end if
            end get
        end property
        overloads function getdatacsharp(byval key as string) as string implements istore.getdatacsharp
            if constlistcsharp.containskey(key) then
                return ctype(constlistcsharp.item(key), string)
            else
                return nothing
            end if
        end function
        overloads function getdatacsharp(byval index as integer) as string implements istore.getdatacsharp
            if index < constlistcsharp.count then
                return ctype(constlistcsharp.getbyindex(index), string)
            else
                return nothing
            end if
        end function
    end class
end namespace
在项目中添加新项—类(cdeclare.vb)
代码如下
namespace api
    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

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 用vb.net开发api viewer(3)-.NET教程,Windows开发
分享到: 更多 (0)

相关推荐

  • 暂无文章