Click here to Skip to main content
       

Visual Basic

 
GeneralRe: How to update Gridview with value textbox = Null PinmemberEddy Vluggen17-Oct-12 5:51 
GeneralRe: How to update Gridview with value textbox = Null Pinmemberzaimah17-Oct-12 6:25 
GeneralRe: How to update Gridview with value textbox = Null Pinmemberzaimah17-Oct-12 7:04 
GeneralRe: How to update Gridview with value textbox = Null PinmemberEddy Vluggen17-Oct-12 10:20 
AnswerRe: [SOLVED] How to update Gridview with value textbox = Null PinmemberjosephSurgeon31-Oct-12 5:27 
QuestionIndex was outside the bounds of the array [modified] Pinmemberetteychan12-Oct-12 20:03 
AnswerRe: Index was outside the bounds of the array PinmvpRichard MacCutchan12-Oct-12 22:07 
QuestionConfused by my own code: LINQ FirstOrDefault PinmemberSteven St. John11-Oct-12 14:18 
I'm a hobbyist programmer, and sometimes I go many months without programming. I have recently come back to a project I started months ago, and I am confused by my own (working) code.
 
Here's the code that is confusing me:
 
Dim groupToAdd As DavisGroup
groupToAdd = Aggregate g In groupList Into FirstOrDefault(g.Name = newGroupName)
 
The variable groupList is a ListOf(DavisGroup). The code is testing to see whether the list already contains an object with the Name (String property of DavisGroup) "newGroupName" as the names have to be unique. My code goes on to do something different depending on if groupToAdd is a returned object or is Nothing. What I don't get is what "Aggregate" is doing.
 
In trying to search for an answer, I rewrote the same code like this:
 
groupToAdd = groupList.FirstOrDefault(Function(g) g.Name = newGroupName)
 
As far as I can tell, this code works in exactly the same way.
 
My questions:
 
What is Aggregate doing in this particular snippet?
Are these two snippets equivalent?
If so, is there a reason to prefer one over the other?
AnswerRe: Confused by my own code: LINQ FirstOrDefault PinmemberSteven St. John16-Oct-12 7:58 
QuestionVB.NET Parameters error PinmemberDiego Carrion11-Oct-12 5:12 
AnswerRe: VB.NET Parameters error PinmemberSimon_Whale11-Oct-12 5:45 
GeneralRe: VB.NET Parameters error PinmemberDiego Carrion11-Oct-12 5:47 
GeneralRe: VB.NET Parameters error PinmemberChandraRam11-Oct-12 12:06 
QuestionSlow Ping and not guaranteed success PinmemberHerboren10-Oct-12 6:44 
AnswerRe: Slow Ping and not guaranteed success PinmvpDave Kreskowiak10-Oct-12 9:13 
GeneralRe: Slow Ping and not guaranteed success PinmemberHerboren10-Oct-12 12:33 
GeneralRe: Slow Ping and not guaranteed success PinmvpDave Kreskowiak10-Oct-12 14:01 
GeneralRe: Slow Ping and not guaranteed success PinmemberHerboren10-Oct-12 17:20 
GeneralRe: Slow Ping and not guaranteed success PinmvpDave Kreskowiak11-Oct-12 0:50 
GeneralRe: Slow Ping and not guaranteed success PinmemberEddy Vluggen15-Oct-12 2:19 
QuestionFunction Not Found From Dll Component PinmemberAmbiguousName10-Oct-12 2:57 
AnswerRe: Function Not Found From Dll Component PinmemberEddy Vluggen11-Oct-12 1:08 
GeneralRe: Function Not Found From Dll Component PinmemberAmbiguousName12-Oct-12 2:07 
GeneralRe: Function Not Found From Dll Component PinmemberEddy Vluggen12-Oct-12 2:25 
GeneralRe: Function Not Found From Dll Component PinmemberAmbiguousName12-Oct-12 2:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 28 Dec 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid