Linq Newbie. Can I write this Linq query more concise?

I'm a C# programmer, so I'm sorry if this suggestion doesn't really apply; In C#, I would typically use one line that contains the lambda and the method call; eg: var login = Repository.Create(). Single(en => en. ENTY_Name == entName) I think you could do something similar in VB like: Dim login = Repository(Of Entity).Create().

FindSingle( _ Function(en) en. ENTY_Name = entName) This probably comes down to personal preference though As an alternative, you could rewrite the whole thing using the query-like syntax; I don't use it very often so I can't convert your very quickly, but it'd be more like: Dim contract = From c in Repository(Of MBI_Contract) _ join d in Repository(Of Dealer) on c. Dealer equals d _ where d.Entity.

ENTY_Name = entName _ select c.

I'm a C# programmer, so I'm sorry if this suggestion doesn't really apply; In C#, I would typically use one line that contains the lambda and the method call; eg: var login = Repository.Create(). Single(en => en. ENTY_Name == entName); I think you could do something similar in VB like: Dim login = Repository(Of Entity).Create().

FindSingle( _ Function(en) en. ENTY_Name = entName) This probably comes down to personal preference though... As an alternative, you could rewrite the whole thing using the query-like syntax; I don't use it very often so I can't convert your very quickly, but it'd be more like: Dim contract = From c in Repository(Of MBI_Contract) _ join d in Repository(Of Dealer) on c. Dealer equals d _ where d.Entity.

ENTY_Name = entName _ select c.

Cool. Thanks for the advice. :) – Hcabnettek Jul 16 '09 at 18:25.

It works and it's pretty fast, but it seems kind of overkill to me. The FindSingle and FindAll take Expression(Of Func(Of T, Boolean)) as an arg for the Where clause.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions