Hi!
This may be a newbie question...
In my code I can easily use "where Obj.Feld = String", but using "where Obj.Feld.StartsWith("a")" doesn't work. See the following two functions:
Public Function EntriesByFileName(ByRef Database() As Entry, ByVal Filename As _
String) As IEnumerable(Of Entry)
Dim Result As IEnumerable(Of Entry) = From EntryObject In Database _
Where (EntryObject.FileName = Filename) Select EntryObject
Return Result
End Function
Public Function EntriesLikeFileName(ByRef Database() As Entry, ByVal _
Filename As String) As IEnumerable(Of Entry)
Filename = Filename.ToLower
Dim Result As IEnumerable(Of Entry) = From EntryObject In Database _
Where EntryObject.FileName.StartsWith("a") Select EntryObject
Return Result
End Function
The first function (byFileName) works fine. The second function (LikeFileName) doesn't. Using Startswith I get "Object reference not set to an instance of an object." What am I doing wrong?
Database is an array of Objects, a structure consisting of strings