debug switch in visual studio - easy question

Discussion in 'ASP .Net' started by Dan, Mar 18, 2005.

  1. Dan

    Dan Guest

    Hi
    I need to execute a line of code when debugging and another when in release
    without having to manually comment and uncomment. Can anyone tell me the
    switch syntax in c# in visual studio? thanls
    Dan, Mar 18, 2005
    #1
    1. Advertising

  2. Dan

    Brock Allen Guest

    protected void Page_Load(object sender, EventArgs e)
    {
    #if DEBUG
    Response.Write("DEBUG");
    #endif
    }


    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Hi
    > I need to execute a line of code when debugging and another when in
    > release
    > without having to manually comment and uncomment. Can anyone tell me
    > the
    > switch syntax in c# in visual studio? thanls
    Brock Allen, Mar 18, 2005
    #2
    1. Advertising

  3. On Fri, 18 Mar 2005 11:37:08 -0600, Brock Allen
    <_hate_spam_too> wrote:

    > protected void Page_Load(object sender, EventArgs e)
    > {
    > #if DEBUG
    > Response.Write("DEBUG");
    > #endif
    > }
    >
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    >> Hi
    >> I need to execute a line of code when debugging and another when in
    >> release
    >> without having to manually comment and uncomment. Can anyone tell me
    >> the
    >> switch syntax in c# in visual studio? thanls

    >
    >
    >


    and a full reference is on MSDN:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/vclrfcsharpspec_2_5.asp

    note there is an #else as well ;)

    --
    Craig Deelsnyder
    Microsoft MVP - ASP/ASP.NET
    Craig Deelsnyder, Mar 18, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wh
    Replies:
    2
    Views:
    495
    Cowboy \(Gregory A. Beamer\)
    Jan 16, 2004
  2. Thirumalai
    Replies:
    0
    Views:
    632
    Thirumalai
    May 22, 2006
  3. rockdale
    Replies:
    1
    Views:
    589
    Juan T. Llibre
    Aug 23, 2006
  4. xman
    Replies:
    0
    Views:
    468
  5. xman
    Replies:
    1
    Views:
    567
    Victor Bazarov
    Aug 17, 2005
Loading...

Share This Page