예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string           mystring     = "Abracadabra";
            WorksWithAString StringAction = DisplayString;

            StringAction(mystring);
            StringAction = DisplayLength;
            StringAction(mystring);
        }
예제 #2
0
파일: Form1.cs 프로젝트: Addikins/CIS217
        private void demoButton_Click(object sender, EventArgs e)
        {
            // Create a string.
            string mystring = "Abracadabra";

            // Create a delegate referencing the DisplayString method.
            WorksWithAString StringAction = DisplayString;

            // Add the DisplayLength method to the delegate.
            StringAction += DisplayLength;

            // Call the methods that StringAction references.
            StringAction(mystring);
        }