【发布时间】:2011-04-18 12:11:20
【问题描述】:
我想将Sorted 定义为ErrorProviderMessageCollection 类型,这就是unsortedCollection 的定义。
Dim Sorted As ErrorProviderMessageCollection = From item In unsortedCollection
Order By item.Control.TabIndex
我该怎么做?
Public Class ErrorProviderMessage Implements IComparable(Of ErrorProviderMessage)
Private _Message As String
Private _Control As Control
Public Sub New(ByVal message As String, ByVal control As Control)
_Message = message
_Control = control
End Sub
Public ReadOnly Property Message() As String
Get
Return _Message
End Get
End Property
Public ReadOnly Property Control() As Control
Get
Return _Control
End Get
End Property
Public Function CompareTo(ByVal other As ErrorProviderMessage) As Integer Implements System.IComparable(Of ErrorProviderMessage).CompareTo
Return Me.Control.TabIndex.CompareTo(other.Control.TabIndex)
End Function
End Class
Public Class ErrorProviderMessageCollection
Inherits System.Collections.ObjectModel.Collection(Of ErrorProviderMessage)
End Class
【问题讨论】: