473,597 Members | 2,138 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CodeDom using statement

Hi,

Is there a way to declare a using statement with the CodeDom?

Something like:

using (obj = new Object())
{
obj.DoSomething ;
}
Thanks,
Pascal Pare

Nov 17 '05 #1
1 3502
Pascal,

Probably not, because this isn't something that is guaranteed to exist
across languages (the using statement compiles to a try/finally statement
ultimately). You wil have to create the full expansion that the compiler
does.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

<pa*********@ho tmail.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Hi,

Is there a way to declare a using statement with the CodeDom?

Something like:

using (obj = new Object())
{
obj.DoSomething ;
}
Thanks,
Pascal Pare

Nov 17 '05 #2

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

Similar topics

0
1908
by: Ron Bullman | last post by:
Hi, I havent been able to find any documentation about @ in the CodeDom context. The problem is when generating C# code from CodeDom it will associate a @-tag with all C# specific types. Why? And how to configure the CodeDom to generate code without @-tags? Ron A short example follows whic produces following kind of output:
0
2346
by: john | last post by:
Is there a way to create a switch statement with the CodeDom? I can use the CodeConditionStatement to create an if / else statement, but i cant find how to create a switch statement And if not, how do you create an if / else if / else if / else statement?
2
2097
by: John Mark Howell | last post by:
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,...
0
1207
by: DSP56k | last post by:
Using the CodeDomExample http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemcodedomcompilercodedomproviderclasstopic.asp I added support for C++. The example will generate the C++ code listing using the MCppCodeProvider OK, but when it comes to the statement: ICodeCompiler compiler = provider.CreateCompiler();
5
1316
by: Tim Bond | last post by:
I am using the Codedom classes to generate some code. Generally it is pretty intuitive but I have not been able to determine how to generate the 'not' statement. Specifically I want to be able to generate something like: if not testexpression then ... end if The if is fine it is a codeConditionStatement but I am not sure how to do the 'not'.
3
4847
by: Alexey Lavnikov | last post by:
I'm playing with CodeDOM and CSharpCodeProvider. I've found the following possibilities: CodeDOM -> Assembly C# Source code -> Assembly I miss the C# Source code -> CodeDOM only. Is it there? Or it's hidden under the hood?
9
3974
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 | MemberAttributes.Family | MemberAttributes.Final;
6
5754
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
2
2275
by: CodeMonkey775 | last post by:
I'm having problems passing a variable to a method which is executed and compiled using CodeDom. The situation is I have a List<CellData> with cells, each containing a formula (like Excel). I am trying to pass this list to an executable section of code which is compiled during run-time. The formulas are calculated in CodeDom and the result is returned on the same List<CellData> object I passed. The user-defined class which holds the cell data...
0
7965
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7885
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6686
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5426
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2399
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1493
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.