Linq in 3.0 Framework
-
In my smart client application (3.0 Framework) i would like to use Linq. Whe i tried below code.
string[] names = { "Burke", "Connor", "Frank",
"Everett", "Albert", "George",
"Harris", "David" };IEnumerable<string> expr = from s in names where s.Length == 5 orderby s select s.ToUpper(); foreach (string item in expr) { Console.WriteLine(item); }
This code is throwing an error message
Could not find an implementation of the query pattern for source type 'string[]'. 'Where' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'?
i have used System.Linq directive in code but unable to add 'System.Core.dll' becuse as it disable. As per the requirement we need to stick on with 3.0 Framework. Any other way to do it. -
In my smart client application (3.0 Framework) i would like to use Linq. Whe i tried below code.
string[] names = { "Burke", "Connor", "Frank",
"Everett", "Albert", "George",
"Harris", "David" };IEnumerable<string> expr = from s in names where s.Length == 5 orderby s select s.ToUpper(); foreach (string item in expr) { Console.WriteLine(item); }
This code is throwing an error message
Could not find an implementation of the query pattern for source type 'string[]'. 'Where' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'?
i have used System.Linq directive in code but unable to add 'System.Core.dll' becuse as it disable. As per the requirement we need to stick on with 3.0 Framework. Any other way to do it.Tiger456 wrote:
Could not find an implementation of the query pattern for source type 'string[]'. 'Where' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'?
I think
IEnumerable
is not supported by LINQ in .NET 3.0 Framework. You need to implement that functionality manually or initialize query result withvar
statement. Click Here for more..[^]Regards, Hiren. "The more we give of anything, the more we shall get back." - Grace Speare (you can consider this quote while giving vote also) Microsoft Dynamics CRM
modified on Friday, December 3, 2010 1:28 AM
-
Tiger456 wrote:
Could not find an implementation of the query pattern for source type 'string[]'. 'Where' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'?
I think
IEnumerable
is not supported by LINQ in .NET 3.0 Framework. You need to implement that functionality manually or initialize query result withvar
statement. Click Here for more..[^]Regards, Hiren. "The more we give of anything, the more we shall get back." - Grace Speare (you can consider this quote while giving vote also) Microsoft Dynamics CRM
modified on Friday, December 3, 2010 1:28 AM
-
Thanks for the response. But using this method will force the client machine to have .NET 3.5 Framework to run appication right ?
Yes, For your code you need to upgrade to FW 3.5. Or you can achieve the same manually using the link I provided.
Regards, Hiren. "The more we give of anything, the more we shall get back." - Grace Speare (you can consider this quote while giving vote also) Microsoft Dynamics CRM
-
Yes, For your code you need to upgrade to FW 3.5. Or you can achieve the same manually using the link I provided.
Regards, Hiren. "The more we give of anything, the more we shall get back." - Grace Speare (you can consider this quote while giving vote also) Microsoft Dynamics CRM