The Lounge is rated PG. If you're about to post something you wouldn't want your
kid sister to read then don't post it. No flame wars, no abusive conduct, no programming
questions and please don't post ads.
Absolutely, you need to know your options to be able to choose one intelligently and understand the code of others.
Ennis Ray Lynch, Jr. wrote:
Oh, well then I'm a fan of StringComparer.InvariantCultureIgnoreCase.Compare ( string , string ) and it's ilk.
Have a property or parameter of type StringComparer so the caller can provide an appropriate instance to use.
That's not true of all events; certainly not of ones I write.
It wasn't about you; like I said, it's a generalization.
I even write events that return values, because it makes sense to do so for them.
That'd be called a "callback", not an event.
Would it not be an advantage to "define" an event as "something" that passes an EventArgs? Sounds like a simple pattern to me; a pointer to sender, and a pointer to the arguments.
I really dislike Microsoft telling me how I should write my code
Even if they would, you would not listen. I'd recommend to most other people to consider multiple points of view, but not with you*. You have your own view, and sometimes it pays to have YOU tell how I should write my code.
Have a good 2013, I hope to disagree with you* more often.
Yes, but it shouldn't be enforced by the compiler. I wouldn't want the compiler to dictate where I should put whitespace either.
Eddy Vluggen wrote:
"callback", not an event
The syntax says event so that's what it is; but that's really just a type, conceptually it could be a callback. Just as an int could be an ID or an index.
I wouldn't see a need to have two keywords for such similar concepts. Come to think of it, this is really like the difference between functions and procedures -- functions return a value and procedures don't -- some languages (Pascal and VB for instance) make the syntactic distinction and others (C-like languages for instsance) don't, and I agree with the C way of doing it.
As an aside: VB doesn't allow events to have a return value.
Eddy Vluggen wrote:
it pays to have YOU tell how I should write my code
I hope I don't do that. CP is definitely a great place to get many points of view from others with varied experiences.
<voice type="MOB" >I say this thing with the greatest respect</voice>
There has been a lot of grumbling (not alot[^]) about the new Visual Studio 2012. Well I for one think it's great. Previously, it was difficult to understand how users with Color Blindness and other Visual Issues interacted with your application. By removing all colors and highlights from the User Interface, MS has made all users equal. No more will people with better eye sight be allowed to take advantage of a better visual experience. Equality for all!