473,386 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Using CodeDom to edit code

BlankCan anyone give me an idea as to how to use the CodeDom to edit code?
I would like to perform mass changes (such as putting logging messages as
the first statement in all methods with method names) to a system with
hundreds of classes and thousands of methods. I know the CodeDom can allow
you manipulate the code and spit it back out, but I cannot seem to see how
to get it to pull the code into it in the first place.
Any ideas, pointers or references would be greatly appreciated!

--
John Mark Howell
Nov 16 '05 #1
2 2084
Check this link. Its detailed and simple.

http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconUsingCodeDOM.asp

Also, check

http://www.thecodeproject.com/csharp/codedomparser.asp
--
Shak
(Houston)
"John Mark Howell" <jm*********@hotmail.com> wrote in message
news:#4**************@TK2MSFTNGP11.phx.gbl...
BlankCan anyone give me an idea as to how to use the CodeDom to edit code?
I would like to perform mass changes (such as putting logging messages as
the first statement in all methods with method names) to a system with
hundreds of classes and thousands of methods. I know the CodeDom can allow you manipulate the code and spit it back out, but I cannot seem to see how
to get it to pull the code into it in the first place.
Any ideas, pointers or references would be greatly appreciated!

--
John Mark Howell

Nov 16 '05 #2
Thanks Shak, but I've already checked out both of those. The MSDN link
shows how to build a code model from scratch, the CodeProject link is a
developer written tool that is not yet complete. However, I may be able to
use the CodeProject tool as a base.

I verified that in .Net 1.0 and 1.1, all CodeCompiler derivatives return
null for CreateParser. It was apparently by design and supposedly because
not all types in all languages can be represented by a particular CodeParser
object. However, because the code generation for all .Net languages fits
within the CTS and CLR, I doubt that is the real reason.

At this point, the only way I can see to build a code model
(CodeCompileUnit) is to scan the source and add the elements one by one.
"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:Oe**************@TK2MSFTNGP12.phx.gbl...
Check this link. Its detailed and simple.
http://msdn.microsoft.com/library/de...us/cpguide/htm l/cpconUsingCodeDOM.asp
Also, check
http://www.thecodeproject.com/csharp/codedomparser.asp
Shak

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Guillaume | last post by:
I don't think I'm the only one with this challenge so… I made code with the CodeDom classes and made code to create a new solution and a new project Now I want to get the codedom code in the new...
7
by: Clint Herron | last post by:
Howdy! I posted this question on CSharpCorner.com, but then realized I should probably post it on a more active newsgroup. This will be my only cross-post. I'm creating a game engine, and...
1
by: Pardhasaradhy | last post by:
Hi, Please see the following error and revert back as early as possible. I am getting this once I request for the asp.net page. Server Error in '/tanishq' Application. Timed out waiting for...
0
by: Marco Viana | last post by:
Hi, I'm developing an ASP.NET application with Visual Studio .NET 2003 in a Win XP Professional, .NET Framework 1.1 and IIS 5.1 computer with all the lattest patches. When testing a page...
0
by: mathlec | last post by:
I have 2 WebApplication project (dummy and dummy2). The first is trying to load a UserControl compiled in the second. I've set up the application as follow: \_(Virtual directory) .:Modules:.
9
by: lee.chappers | last post by:
How can I make the CodeDom generate the following C# method? protected sealed override void Test() { } I've tried using: domMethod.Attributes = MemberAttributes.Override |...
6
by: moondaddy | last post by:
will CodeDom create XAML windows or just regular windows forms? If so, how to I tell it to create a xaml window instead of a windows form? thanks -- moondaddy@noemail.noemail
1
by: =?Utf-8?B?QU1lcmNlcg==?= | last post by:
I may have painted myself into a corner with GenerateInMemory=true. My app need a custom user step. Users want to code (sort of - they are not programmers) some refinements to a search...
0
by: thisismykindabyte | last post by:
Hello, I was wondering if anyone might know the easiest way to access static methods through a namespace(MyNamespace) from CodeDom generated code? Basically I have this in my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.