View Full Version : Ignore sections of code - wish list item
flash7ok
28-Mar-2006, 09:10 AM
I have C# projects that are built for both Windows and Pocket PC. It would really be helpful if I could have BC ignore certain sections of code that are user specified. That is, if I could tell BC to ignore the #region "Windows Form Designer generated code", that would be fantastic, as generally this is the only difference between my Windows and Pocket PC projects. By letting the user specify the "#region" to ignore certain parts of the code, this would make it a very flexible feature for both C# and VB.NET programmers.
kencl
28-Mar-2006, 11:49 AM
Try this. In your code, bracket the section you want to ignore with line comments. EG (using # as the line comment char as I don't know C#)
# BC Ignore Start
<user code>
# BC Ignore End
Then in BC, create a new Rule. In the importance tab, unimportant text section, click New. Choose "Delimited" category then copy your comment start and end "tags" to the "begins with" and "ends with" fields.
I'd name it "Ignore Users - I wish!"
Thanks much for the tip. To make it work, I had to delete the current rule for comment - '// to end of line; add my rule as you say // BC Ignore Start, // BC Ignore End; then re-add the original rule back in. In other words, the original Unimportant Text rule took precedence over my new rule before I changed the order of them. Thanks again! :)
kencl
09-Apr-2006, 06:33 AM
Your welcome. I use something similar to specify code folding points in UltraEdit.
Good point about ignorance precedence (couldn't resist...). Something to keep in mind as I'm in the process of building a complex set of minor difference rules for a project.
vBulletin® v3.7.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.