Click here to Skip to main content
12,893,086 members (60,693 online)
Click here to Skip to main content
Add your own
alternative version

Stats

3.3K views
Posted 30 Aug 2011

Super-Easy Code Block Toggling

, 30 Aug 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
This nice trick extends into://*/block 1/*/block 2; // commented out/*/block 3;/*/block 4; // commented out//*/and removing the first slash gives inverted alternation:/*/block 1; // commented out/*/block 2;/*/block 3; // commented out/*/block...
This nice trick extends into:

<pre lang="c#">//*/<br />
block 1<br />
/*/<br />
block 2; // commented out<br />
/*/<br />
block 3;<br />
/*/<br />
block 4; // commented out<br />
//*/</pre>


and removing the first slash gives inverted alternation:

<pre lang="c#">/*/<br />
block 1; // commented out<br />
/*/<br />
block 2;<br />
/*/<br />
block 3; // commented out<br />
/*/<br />
block 4;<br />
//*/</pre>


This enables you to alternate between odd and even sequential blocks :). It will extend to infinite count of blocks! Even more curious but sometimes usefull nonetheless, alternation can be switched wherever you like:

<pre lang="c#">/*/<br />
block 1; // commented out<br />
/*/<br />
block 2;<br />
/*/<br />
block 3; // commented out<br />
/*/<br />
block 4;<br />
/*/<br />
block 5; // commented out<br />
/*/<br />
block 6;<br />
//*/</pre>


can be switched into:

<pre lang="c#">/*/<br />
block 1; // commented out<br />
/*/<br />
block 2;<br />
/*/<br />
block 3; // commented out<br />
/*/<br />
block 4;<br />
//*/<br />
block 5;<br />
/*/<br />
block 6; // commented out<br />
//*/</pre>

:D ILa

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

ILa @ work
Engineer
Netherlands Netherlands
No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralReason for my vote of 5 Superb my 5 Pin
Ashish Tyagi 406-Sep-11 19:12
memberAshish Tyagi 406-Sep-11 19:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 30 Aug 2011
Article Copyright 2011 by ILa @ work
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid