本帖最后由 it_1980 于 2012-12-03 13:20:01 编辑

解决方案 »

  1.   

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;namespace WindowsFormsApplication2
    {
    public class testA
    {
    private testB _tb; public testA()
    {
    this._tb = new testB();
    this._tb.onB+=new testB.onBHander(onB);
    this._tb.exec();
    } private void onB(object sender, string a)
    {
    Console.WriteLine(a);
    } } public class testB
    {
    public delegate void onBHander(object sender, string a);
    public event onBHander onB; private testC _tc; public testB()
    {
    if(this._tc==null)
    this._tc = new testC();
    this._tc.onC += new testC.onCHandler(onC); }
    public void exec()
    {
    this._tc.test1();
    }
    private void onC(object sender, string a)
    {
    if (onB != null)
    {
    onB(sender, a);
    }
    }
    } public class testC
    {
    public delegate void onCHandler(object sender, string a);
    public event onCHandler onC; public void test1()
    {
    if (onC != null)
    onC(this, "a");
    }

    }
      

  2.   

    ouyang4683 你这个和我写的有啥区别?感觉这样写很乱
      

  3.   

    testA能不能直接订阅testC的事件呢?
      

  4.   

    只是改了你代码里的错能 你都用的public 类 testA里声明个 testC就行