473,480 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

CodeDom and @

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:
<code>

namespace tst.CodeDom {

public class TstType {
private TstType(String validString, @string oddString) {

}

}

}

</code>

And the generating program

<code>

namespace tst.CodeDom {

using System;

using System.CodeDom;

using System.CodeDom.Compiler;

using Microsoft.CSharp;

using System.IO;

using System.Text;

public class Generator {

[STAThread]

public static void Main(string[] args) {

create();

generate();

}

private static CodeNamespace module;

private static void generate() {

CSharpCodeProvider provider= new CSharpCodeProvider();

ICodeGenerator generator= provider.CreateGenerator();

CodeGeneratorOptions options= new CodeGeneratorOptions();

options.BlankLinesBetweenMembers= true;

options.IndentString= "\t";

//

StreamWriter writer= new StreamWriter("odd.cs", false);

generator.GenerateCodeFromNamespace(module, writer, options);

writer.Close();

}

private static void create() {

module= new CodeNamespace("tst.CodeDom");

//

CodeTypeDeclaration type=

new CodeTypeDeclaration("TstType");

module.Types.Add(type);

//

CodeConstructor constructor= new CodeConstructor();

type.Members.Add(constructor);

//

CodeParameterDeclarationExpression expression=

new CodeParameterDeclarationExpression("String", "validString");

constructor.Parameters.Add(expression);

expression=

new CodeParameterDeclarationExpression("string", "oddString");

constructor.Parameters.Add(expression);

}

}

}

</code>


Jul 19 '05 #1
0 1885

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

Similar topics

2
2346
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...
1
2277
by: John Livermore | last post by:
Hello, We have an application that uses CodeDom for dynamic in-memory compilation of code. The same code (library) is used by both an ASP.net web site and a Windows Service. The code runs fine...
0
921
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?...
3
4837
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?...
9
3964
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
5736
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
2250
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...
1
4854
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
1172
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
7046
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,...
0
7048
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,...
1
6741
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...
0
6956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4783
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...
0
4485
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...
0
2986
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
183
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.