如何通過強類型列表搜索字符串?如何搜索字符串的強類型列表?
我在嘗試。載有(TheString),但它的錯誤,說明無法轉換類型的對象「System.String」輸入「o7thCrawler.Typing.ImportantTyping」
下面是代碼:
Public Class LinkTyping
Public Property Url As String
Public Property Title As String
Public Property Content As String
End Class
If Not (_InternalUrls.Contains(_Url & _Link)) Then
_InternalUrls.Add(New Typing.LinkTyping() With {
.Url = _Url & _Link,
.Content = Item.Value,
.Title = If(Item.Attribute("title") IsNot Nothing,
Item.Attribute("title").Value,
Nothing)
})
End If
InternalUrls = List(Of Typing.LinkTyping) – Kevin 2012-03-14 17:05:24
@ o7thWebDesign您是否正在爲您的LinkTyping類實現自定義比較器 - 用於'.Contains'?上面的代碼是如何爲你工作的? – Basic 2012-03-14 17:07:36
工作很好。它抓住了所有潛在的重複。我使用了.Any,因爲我在這之前已經強制所有的.ToLower()。 – Kevin 2012-03-14 18:37:42