Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 131,549 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 2,247 people online right now. Registration is fast and FREE... Join Now!




disable code

 
Reply to this topicStart new topic

disable code, how to disable code

legend_018
post 6 Oct, 2008 - 05:12 PM
Post #1


New D.I.C Head

*
Joined: 11 Sep, 2008
Posts: 31

Quick question. I'm just learning C# and was wondering is \\ the only way to disable code, if I want to play around with disabling certain lines or sections. i have to put it in front of each line?

thanks,
Mary

QUOTE(legend_018 @ 6 Oct, 2008 - 06:10 PM) *

Quick question. I'm just learning C# and was wondering is \\ the only way to disable code, if I want to play around with disabling certain lines or sections. i have to put it in front of each line?

thanks,
Mary


Oh my, didn't know that this post posted many times. I didn't do that on purpose. Sorry about that.
User is offlineProfile CardPM

Go to the top of the page


legend_018
post 6 Oct, 2008 - 05:10 PM
Post #2


New D.I.C Head

*
Joined: 11 Sep, 2008
Posts: 31

Quick question. I'm just learning C# and was wondering is \\ the only way to disable code, if I want to play around with disabling certain lines or sections. i have to put it in front of each line?

thanks,
Mary
User is offlineProfile CardPM

Go to the top of the page

legend_018
post 6 Oct, 2008 - 05:10 PM
Post #3


New D.I.C Head

*
Joined: 11 Sep, 2008
Posts: 31

Quick question. I'm just learning C# and was wondering is \\ the only way to disable code, if I want to play around with disabling certain lines or sections. i have to put it in front of each line?

thanks,
Mary
User is offlineProfile CardPM

Go to the top of the page

jacobjordan
post 6 Oct, 2008 - 05:13 PM
Post #4


class Me : Perfection

Group Icon
Joined: 11 Jun, 2008
Posts: 1,103



Thanked 22 times

Dream Kudos: 1525
My Contributions


Ok, one thread on this is enough. So far, we have 4 and counting.

The only way to "disable" code is to comment it out. You can use // for a line, or a multiline /*...*/ comment.
csharp

//This line is disabled

blah blah blah

/*
This line is disabled
This line is disabled too
*/

User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 6 Oct, 2008 - 05:14 PM
Post #5


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,906



Thanked 116 times

Dream Kudos: 8450

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


What you are looking for is comments. C# has two different comment types, single line and multiline

csharp

//This is a single line comment

/*
This will comment out multiple lines at once
*/
User is online!Profile CardPM

Go to the top of the page

legend_018
post 6 Oct, 2008 - 05:26 PM
Post #6


New D.I.C Head

*
Joined: 11 Sep, 2008
Posts: 31

QUOTE(PsychoCoder @ 6 Oct, 2008 - 06:14 PM) *

What you are looking for is comments. C# has two different comment types, single line and multiline

csharp

//This is a single line comment

/*
This will comment out multiple lines at once
*/



I'm sorry, I didn't do that on purpose. When I saved the post, I left my computer after I clicked save. When I came back, my screen said the website didn't respond. I went back on and than all of a sudden, the post was there a bunch of times. I'm really sorry. I have been working with computers for over 10 years now, so I'm not some newbie that doesn't know what's she's doing "lol". Once again, sorry about that.
User is offlineProfile CardPM

Go to the top of the page

ragingben
post 7 Oct, 2008 - 04:56 AM
Post #7


New D.I.C Head

*
Joined: 7 Oct, 2008
Posts: 30


My Contributions


Hi, another solution besides comments (and one that isn't really that great) is by simply including the lines you don't want to use in either a If statement or a Switch statement where the argument is a boolean that is not met. This way you can toggle those lines on or off for debugging when the program is running.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/20/08 02:24AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month