This project has moved. For the latest updates, please go here.

Alternative to #region for <code>?

Sep 4, 2008 at 8:50 PM

I love the Code Block Component and have been using it for a while. Now I'm starting to pull in code snippets from actual example code for our project. I'm using the #region to annotate my source but I'm wondering what it would take to pull in entire definitions without having to put #region in the code, e.g. <code source="myfile.cs" ClassDef="MyClass"> or FuncDef="MyFunc", etc. It's not a big deal since adding #region doesn't hurt anything but sometimes it would be nice to pull in samples without touching the source file in any way.



Sep 5, 2008 at 12:10 AM

The code block component is unaware of the actual language of the file when extracting regions, if there is one for that matter (i.e. an XML file).  Using a region tag to delimit the sections allows this to happen easily.  To specify specific methods or classes would require parsing the file in the given language and would make the process much more complex.