VB.NET中使用类的简单线性链表

时间:2013-03-03 13:57:26

标签: vb.net singly-linked-list

如何使用类在VB.NET中实现线性链表?

如何为线性链表修改此类?

还有遍历列表,删除节点等的方法

Public Class clsHol
    Private dt As Date
    Private tp As String
    Private remark As String

    Public Function setValues(ByVal d As Date, ByVal t As String, ByVal r As String)
        remark = r
        tp = t
        remark = r
    End Function

    Public Function getDate()
        Return dt
    End Function

    Public Function getTyp()
        Return tp
    End Function

    Public Function getRemark()
        Return remark
    End Function
End Class

1 个答案:

答案 0 :(得分:1)

样品:

Sub Main()
    Dim voLList As New LinkedList(Of clsHol)

    voLList.AddFirst(new clsHol())
    voLList.AddLast(new clsHol())
    voLList.AddLast(new clsHol())
End Sub