Created
January 3, 2017 07:57
-
-
Save jutikorn/21d0c6385fac05b61985fa4efde6c1d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StringAppend | |
{ | |
public delegate void StringOverflow(object sender, int Overflow); | |
public event StringOverflow StringOverflow_EventHandle; | |
} | |
class Program | |
{ | |
void Main(string[] args) | |
{ | |
StringAppend sa = new StringAppend(); | |
sa.StringOverflow_EventHandle += new StringAppend.StringOverflow(string_over); | |
sa.StringOverflow_EventHandle += string_over; | |
sa.StringOverflow_EventHandle += (sender, Overflow) => { }; | |
sa.StringOverflow_EventHandle += delegate { | |
}; | |
} | |
private void string_over(object sender, int num_over) | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line 15 your handler is in StringAppend class. Therefore you need to create object of that class first and then use the handler method.
you can rewrite something like this.
but for line 16 that handler method is in a class therefore you don't need to create new object, just use method directly in optional you can use this keyword.