boudino
October 24th, 2005, 08:27 AM
Hi all
Do you hear/read about LINQ? It is a feature of future version of C# - C# 3.0. It can seem that it is quite early to take care about it, but I think we should start discuss it soon if we want to change something about it.
Quickly, LINQ incorporates (pseudo) SQL syntax into C# to allow programer easy manipulate and query collection. More informations can be found on http://msdn.microsoft.com/netframework/future/linq/ and many examples on http://msdn.microsoft.com/vcsharp/future/linqsamples/
LINQ can looks like:
string[] words = { "aPPLE", "BlUeBeRrY", "cHeRry" };
var upperLowerWords =
from w in words
select new {Upper = w.ToUpper(), Lower = w.ToLower()}
where w.StartsWith("a");
I very wellcome whats behind LINQ and whats it can provide, but I think it is confusing to breed C# language syntax with SQL syntax. I believe it is a way to the ****. It is unnecessary, C# constructs is everything we need.
I suggest following approach which fully respects C# 3.0 syntax (it uses so called Lambda calculus):
string[] words = { "aPPLE", "BlUeBeRrY", "cHeRry" };
var selectedWords = words.Select(w => {return w.StartsWith("a")});
var projection = Collect(w2 => {return new {
Upper = w2.ToUpper(),
Lower = w2.ToLower()};
(I have splited it into to statements only for typographical reasons).
I prefer to have only methods in combination with lambda calculus (which is an advanced form of anonymous methods from C# 2.0).
What is your opinion? What do you think about my approach?
(I want no flamewar here, so please do dont argue with others, just post your opinion).
Do you hear/read about LINQ? It is a feature of future version of C# - C# 3.0. It can seem that it is quite early to take care about it, but I think we should start discuss it soon if we want to change something about it.
Quickly, LINQ incorporates (pseudo) SQL syntax into C# to allow programer easy manipulate and query collection. More informations can be found on http://msdn.microsoft.com/netframework/future/linq/ and many examples on http://msdn.microsoft.com/vcsharp/future/linqsamples/
LINQ can looks like:
string[] words = { "aPPLE", "BlUeBeRrY", "cHeRry" };
var upperLowerWords =
from w in words
select new {Upper = w.ToUpper(), Lower = w.ToLower()}
where w.StartsWith("a");
I very wellcome whats behind LINQ and whats it can provide, but I think it is confusing to breed C# language syntax with SQL syntax. I believe it is a way to the ****. It is unnecessary, C# constructs is everything we need.
I suggest following approach which fully respects C# 3.0 syntax (it uses so called Lambda calculus):
string[] words = { "aPPLE", "BlUeBeRrY", "cHeRry" };
var selectedWords = words.Select(w => {return w.StartsWith("a")});
var projection = Collect(w2 => {return new {
Upper = w2.ToUpper(),
Lower = w2.ToLower()};
(I have splited it into to statements only for typographical reasons).
I prefer to have only methods in combination with lambda calculus (which is an advanced form of anonymous methods from C# 2.0).
What is your opinion? What do you think about my approach?
(I want no flamewar here, so please do dont argue with others, just post your opinion).