Skip to main content

Timeline for answer to When & why to use delegates? by dhaval8087

Current License: CC BY-SA 4.0

Post Revisions

16 events
when toggle format what by license comment
Jan 25, 2025 at 16:59 comment added Andy N This looks like how you implement a callback.
Jan 10, 2020 at 13:06 comment added user12479221 The example will be even better, if you will show it without delegate :) Then you really can compare it.
Oct 11, 2019 at 10:49 history edited Himanshu CC BY-SA 4.0
Added output and removed unnecessary reference.
S Jan 4, 2018 at 5:46 history suggested AjCodez CC BY-SA 3.0
Fix error in IsChild and add code comments for clarity
Jan 3, 2018 at 20:40 review Suggested edits
S Jan 4, 2018 at 5:46
Nov 8, 2017 at 3:56 review Suggested edits
Nov 8, 2017 at 4:34
Dec 7, 2016 at 5:48 review Suggested edits
Dec 7, 2016 at 6:18
Sep 13, 2016 at 15:44 comment added cp.engr I think IsChild() should return p.Age < 18, not p.Age <= 18. As is, when p.Age == 18, both IsChild() and IsAdult() will return true.
Jul 29, 2016 at 2:11 comment added BigHeadCreations @BKSpurgeon in the method DisplayPeople() the third argument is FilterDelegate filter. This basically says, put any argument here that matches the signature of FilterDelegate. In this case it is a method that returns bool and takes an argument of type Person.
Feb 18, 2016 at 7:28 comment added Zaker @BKSpurgeon this line static void DisplayPeople(string title, List<Person> people, FilterDelegate filter) this contains a FilterDelegate and DisplayPeople("Children:", people, IsChild) is what passing and finally within if() the delegate will call the method.
Feb 15, 2016 at 11:26 comment added BenKoshy @dhaval8087 thanks for your answer - but where is it that methods are being added to the delegate?
Oct 25, 2015 at 1:32 comment added Chef_Code I like your delegate example, but I believe it would be more useful if you denoted the output using a comment, at the end.
Oct 26, 2012 at 4:20 review Late answers
Oct 26, 2012 at 5:04
Aug 10, 2012 at 16:40 history edited LarsTech CC BY-SA 3.0
deleted 136 characters in body
S Mar 29, 2012 at 6:04 history answered dhaval8087 CC BY-SA 3.0
S Mar 29, 2012 at 6:04 history made wiki Post Made Community Wiki by dhaval8087