Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 07:11

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C# - Events. Why would I use them?

Discussion on C# - Events. Why would I use them? within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2011
Posts: 648
Received Thanks: 413
C# - Events. Why would I use them?

I know this is sorta offtopic, but the general programming section is mainly german speaking - dont get me wrong, thats my native language, but when it comes to programming I dont even understand exceptions in my language..

My question is rather simple I guess:

Why would i ever your events?

I see no point for them to exist. I can do the same thing on variables by an simple get{} set{} accessor, and within methods, i can simply call another method.

Ofc there might be that thing with subscribing to multiple handlers and unsubscribing, but i can simply do a boolean check within my get / set. Unless im doing like 5 different things in them based on some condition, i´d have to write more code using events.

I hope someone could explain the benefits to me. I´ve been on codeproject and msdn for some time now but cant find a reason to use them. I know how to define them, how to implement them but i fail to understand the point of their existence.

Thanks in advance!
Y u k i is offline  
Old 02/24/2014, 14:37   #2
 
elite*gold: 0
Join Date: Sep 2013
Posts: 197
Received Thanks: 140
SteveRambo is offline  
Thanks
2 Users
Old 02/24/2014, 15:08   #3
 
elite*gold: 0
Join Date: Oct 2006
Posts: 110
Received Thanks: 67
I am not going to go into details, but how I see it is, that they are good at keeping layers detachable from each other.
hadeset is offline  
Old 02/24/2014, 17:15   #4
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946


And

Super Aids is offline  
Old 02/25/2014, 08:11   #5
 
elite*gold: 0
Join Date: May 2011
Posts: 648
Received Thanks: 413
Okay, I read all of your Posts/Links and came to the conclusion, that there is no point for me to use them yet. I simply dont have any scenarios where it would benefit me enough to consider it.

Imho, delegates and events just kill readablilty.
Y u k i is offline  
Old 02/25/2014, 08:57   #6
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,211
Received Thanks: 4,114
Delegates can be very helpful. In fact, you'll see me using them in Project Phoenix's socket system. I use delegates as a replacement for pure virtual functions. Then, inheritance comes into play in initializing those delegates. Just one design idea, but there's a lot of uses for delegates. You can use delegates to point to functions outside a tree or other data structure, or store entire functions to memory in data structures using events. There really is a lot you can do with them.
Spirited is offline  
Thanks
2 Users
Reply


Similar Threads Similar Threads
Events, Event's, Events...
05/16/2014 - Metin2 Private Server - 12 Replies
CritcaL's Eventvorschläge Hey Leute im folgendem werdet ihr Eventvorschläge bekommen. Ich habe diese Event's natürlich nicht selber geschrieben:P. Habe sie aus verschieden Server und Foren zusammengefasst. Manche sind selber geschrieben, aber die Grund idee, kam nicht von mir. Dann fangen wir mal an: Die Bedrohung des Affen Die Bedrohung des Affen Hierbei handelt es sich um eine Art "Spawn und Rettungsevent". Es werden einige Monster (Affen) aus den Dungeons gespawnt. Per...
[Events]Reminder - New Events Update!
01/13/2014 - S4 League - 6 Replies
Close plox#
Beendete Events | Finished Events
03/04/2013 - Combat Arms - 0 Replies
Hey Leute, hier kommen alle Event Threads rein, damit ihr sie auf einen Blick habt. Natürlich kommen nur die abgeschlossenen Events hier rein. Über die aktuellen könnt ihr in den Threads disskutieren. http://www.elitepvpers.com/forum/combat-arms/2435 976-events-20-feb-2013-a.html http://www.elitepvpers.com/forum/combat-arms/2449 532-events-27-feb-2013-a.html http://www.elitepvpers.com/forum/combat-arms/2460 783-events-06-m-r-2013-a.html...
[Free Giveaway] Twink Accs Rdy For All Events / Secret Events / Returned Warrior
01/11/2012 - Freebies - 3 Replies
like title says nothing special some low twink accs rdy for all events secrets events and returned warrior too just pm me if you need



All times are GMT +2. The time now is 07:11.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.