The original code:
public List<Contact> GetContactListEntityCompiledLINQ()
{
if (entities == null) entities = new CompanyEntities();
ObjectQuery<Contact> contacts = compiledQuery.Invoke(entities);
if (NoTracking) contacts.MergeOption = MergeOption.NoTracking;
return contacts.ToList<Contact>();
}
My converted code:
Public Function GetContactListEntityCompiledLINQ() As List(Of Contact)
If entities Is Nothing Then entities = New CompanyEntities()
Dim contacts As ObjectQuery(Of Contact) = compiledQuery.Invoke(entities)
If NoTracking Then contacts.MergeOption = MergeOption.NoTracking
Return contacts.ToList(Of Contact)()
End Function
I get an error in Visual Studio with the VB version:
Error 1 Extension method 'Public Function ToList() As System.Collections.Generic.List(Of TSource)' defined in 'System.Linq.Enumerable' is not generic (or has no free type parameters) and so cannot have type arguments.
The error is on the Return statement, and Contact is underlined with the blue squiggly.
Any ideas?