none
Format Code Block doesn't seem to work. RRS feed

  • Question

  • If I try to format the following block of text as C#:
    public event EventHandler MyFirstEvent;
    public event EventHandler MySecondEvent;

    protected void OnMyFirstEvent(EventArgs e)
    {
      if(MyFirstEvent != null)
      {
         MyFirstEvent(this, e)
      }
    }

    protected void OnMySecondEvent(EventArgs e)
    {
      if(MySecondEvent != null)
      {
        MySecondEvent(this, e);
      }
    }

    private void Intialize()
    {
      MyFirstEvent += this_MyFirstEvent;
    }

    private void this_MyFirstEvent(object sender, EventArgs e)
    {
      // raise another event when processing this one:
      OnMySecondEvent(EventArgs.Empty);
    }

    I get this:
    public event EventHandler MyFirstEvent;<BR>public event EventHandler   
    MySecondEvent;<BR><BR>protected void OnMyFirstEvent(EventArgs e)<BR>{<BR>&nbsp;   
    if(MyFirstEvent != null)<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;   
    MyFirstEvent(this, e)<BR>&nbsp; }<BR>}<BR><BR>protected void   
    OnMySecondEvent(EventArgs e)<BR>{<BR>&nbsp; if(MySecondEvent != null)<BR>&nbsp;   
    {<BR>&nbsp;&nbsp;&nbsp; MySecondEvent(this, e);<BR>&nbsp; }<BR>}<BR><BR>private   
    void Intialize()<BR>{<BR>&nbsp; MyFirstEvent +=   
    this_MyFirstEvent;<BR>}<BR><BR>private void this_MyFirstEvent(object sender,   
    EventArgs e)<BR>{<BR>&nbsp; // raise another event when processing this   
    one:<BR>&nbsp; OnMySecondEvent(EventArgs.Empty);<BR>}<BR> 

    http://www.peterRitchie.com/blog
    Monday, June 2, 2008 3:39 PM

Answers

All replies