Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 773897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:02:26+00:00 2026-05-14T19:02:26+00:00

I know that if I have a block of code I don’t want compiled

  • 0

I know that if I have a block of code I don’t want compiled when in release mode I can wrap that code block in:

#if DEBUG
   while(true)
{ Console.WriteLine("StackOverflow rules"); }
#endif

This will keep this code block from compiling in any mode other than DEBUG.

I know there is an attribute that can be placed on an entire method that will do that same, but for the life of me I can’t remember what that attribute is. I believe that it’s down the System.Diagnostics namespace, but I’m not really sure.

BTW: I’m using .NET 4, but I know this attribute existed in .NET 2 because I have used in in old projects.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T19:02:26+00:00Added an answer on May 14, 2026 at 7:02 pm

    It’s the ConditionalAttribute.

    Indicates to compilers that a method
    call or attribute should be ignored
    unless a specified conditional
    compilation symbol is defined.

    You should define it as [Conditional("DEBUG")] and make sure that the DEBUG constant is not being defined in release mode.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have ten or more(i don't know) tables that have a column named foo
I have a block of code that takes way too long to process for
I have a block of code that's essentially: for(int i=0;i<aInt;i++){ CGPoint points[2] = {CGPointMake(i,0),CGPointMake(i,bArray[i])};
I have a block of PHP code that looks like this: $flag = false;
I know that I have to use: rdtsc. The measured function is deterministic but
I know that exceptions have a performance penalty, and that it's generally more efficient
I know that i have to dispose all unmanaged resources in a class or
As a web developer I am using PHP and I know that I have
To start, I know that I have to have the </script> tag, and there
I'm trying to remove all of the leaves. I know that leaves have no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.