Did not work my friend... I got this error: Unable to cast object of type 'System.Collections.Generic.List`1[Sample.Car]' to type 'Sample.Cars'.
Juan M. Oviedo Date: Thu, 11 Jun 2009 11:38:25 +0530 Subject: [DotNetDevelopment] Re: LINQ Error From: [email protected] To: [email protected] Hi Juan Try this code..........and enjoy Partial Public Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim crs As New Cars crs.Add(New Car() With {.Color = "Rojo"}) crs.Add(New Car() With {.Color = "Verde"}) crs.Add(New Car() With {.Color = "Rojo"}) crs.Add(New Car() With {.Color = "Azul"}) Dim otrocarros As List(Of Car) otrocarros = (From c In crs Where c.Color.StartsWith("R") Select c).ToList() For Each oc In otrocarros Response.Write(oc.Color.ToString) Next End Sub End Class Public Class Cars Inherits List(Of Car) End Class Public Class Car Private _color As String Public Property Color() As String Get Return _color End Get Set(ByVal value As String) _color = value End Set End Property End Class Thanks!!!!
