By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,241 Members | 760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,241 IT Pros & Developers. It's quick & easy.

CodeDom and @

P: n/a

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?
A short example follows whic produces following kind of output:

namespace tst.CodeDom {

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





And the generating program


namespace tst.CodeDom {

using System;

using System.CodeDom;

using System.CodeDom.Compiler;

using Microsoft.CSharp;

using System.IO;

using System.Text;

public class Generator {


public static void Main(string[] args) {




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);



private static void create() {

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


CodeTypeDeclaration type=

new CodeTypeDeclaration("TstType");



CodeConstructor constructor= new CodeConstructor();



CodeParameterDeclarationExpression expression=

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



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






Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.