i want to use an List to store the title, path,… from Documents.
I declared the list like this:
Dim MyDocuments As New List(Of Document)
But i don’t really know how to handle the list.
i want to use the list instead of an ReDim Array.
For i = 0 To results - 1 Step 1 ' forschleife zum durchlaufen der Ergebnisse
Try
MyDocuments.Add(New Document())
array_results(i, 0) = hits.Doc(i).Get("title")
array_results(i, 0) += hits.Doc(i).Get("doc_typ")
array_results(i, 1) = hits.Doc(i).Get("pfad")
'array_results(i, 2) = hits.Doc(i).Get("date_of_create") '
array_results(i, 2) = hits.Doc(i).Get("last_change")
array_results(i, 3) = CStr(hits.Score(i))
array_results(i, 4) = hits.Doc(i).Get("doc_typ")
Can I store the object Document, or do i have to create an own class??
Is there a good tutorial for using the list? (i searched, but didn’t found something good)
Is the List of (T) the right data structure?
but how can i do like mylist(i) ->gettitle() or something like this?
thanks in advance!
Yes, you can store your documents in a generic List. Deciding if a
List<T>is the right data structure or not depends on what you want to do with it. Maybe if you provide more information someone could come up with a better example. I don’t know VB.NET so i’ll do it in C#.More information about the
List<T>can be found here: http://msdn.microsoft.com/en-us/library/6sh2ey19.aspxMore information on lambda expressions can be found here: http://msdn.microsoft.com/en-us/library/bb397687.aspx
This article on SO shows how to use lambdas to search a
List<T>