Click here to Skip to main content
15,881,757 members
Articles / Programming Languages / C#

C# CodeDOM parser

Rate me:
Please Sign up or sign in to vote.
4.56/5 (14 votes)
27 Jun 20026 min read 247.6K   4.3K   70  
This is a utility which parses C# source code and creates the CODEDOM tree of the code.
/*
 * bla bla bla
 * more more more more
 */
using System;
// using comment
using System.Collections;
using System.Reflection;


// Ns coment
namespace testParser //After NS comment
{
	
	
	/// <summary>
	/// test class
	/// </summary>
	[PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")]
	 public class Class2 //After Class
	{
		 
		// Old style comment
		string val1="bla";	

		/// <summary>
		/// 3 in one statement
		/// </summary>
		int i,j,k;
		/// <summary>
		/// 
		/// </summary>
		 public Class2() {}		
		
		 /* Old style multiline
		  * something here 
		  */
		 public string prop 
		 {		
			get { return "";}
		 }

		/// <summary>
		/// 
		/// </summary>
		/// <param name="i"></param>
		/// <param name="j"></param>
		/// <returns></returns>
		public  int methodA( int i, int j)  // After method
		
		 {
			//Inside method
		 return 0;
			//before local declaration
			int i;
		 }

		
		//single line comment
		public event EventHandler evt;

		/// <summary>
		/// indexer - why it did not generate tag for param automatically
		/// </summary>
		public object this[int i]
		 {
			//inside indexer block 
			get {
				 
				 return null;
			 }

		 }

	}

    /// <summary>

    /// something
    /// </summary>
	public delegate int MyDelegate([PAttribute]object o);

	/*
	 * anything 
	 */

	[IsReallyNothing]
	public interface INothing
	{}

	[FlagsAttribute]
	public enum En1 // After enum
	{
		/// <summary>
		/// Value 1
		/// </summary>
		[V1Attribute("mfbu")]
		val1=1,
		[V2Attribute("mfbu")]
		val2=2
	}

	[ValAttribute(true, loc="somewhere", mode="auto")]
	/// <summary>
	/// structure
	/// </summary>
	public struct Str1 {} 

	
	

}



By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Czech Republic Czech Republic
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions