Hi,
i wrote the following code:
CodeCompileUnit compileUnit = new CodeCompileUnit ();
CodeNamespace ns = new CodeNamespace(" MyNS");
this.compileUni t.Namespaces.Ad d(ns);
ns.Imports.Add( new CodeNamespaceIm port("System")) ;
ns.Imports.Add( new
CodeNamespaceIm port("System.Co llections.Gener ic"));
ns.Imports.Add( new CodeNamespaceIm port("System.Te xt"));
CodeTypeDeclara tion ioClass = new CodeTypeDeclara tion("Client");
ioClass.BaseTyp es.Add("IOBase" );
ns.Types.Add(io Class);
and I use CSharpCodeProvi der.GenerateCod eFromCompileUni t() to generate the
code,
it produce the following code:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.507 27.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MyNS {
using System;
using System.Collecti ons.Generic;
using System.Text;
public class Client : IOBase {
}
}
I found that this "using" statments are inside the namespace. The examples
of MSDN are also like that.
Is it possible to make the "using" statments at the begining?
Thanks.
Kwokho, Fung.
i wrote the following code:
CodeCompileUnit compileUnit = new CodeCompileUnit ();
CodeNamespace ns = new CodeNamespace(" MyNS");
this.compileUni t.Namespaces.Ad d(ns);
ns.Imports.Add( new CodeNamespaceIm port("System")) ;
ns.Imports.Add( new
CodeNamespaceIm port("System.Co llections.Gener ic"));
ns.Imports.Add( new CodeNamespaceIm port("System.Te xt"));
CodeTypeDeclara tion ioClass = new CodeTypeDeclara tion("Client");
ioClass.BaseTyp es.Add("IOBase" );
ns.Types.Add(io Class);
and I use CSharpCodeProvi der.GenerateCod eFromCompileUni t() to generate the
code,
it produce the following code:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.507 27.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MyNS {
using System;
using System.Collecti ons.Generic;
using System.Text;
public class Client : IOBase {
}
}
I found that this "using" statments are inside the namespace. The examples
of MSDN are also like that.
Is it possible to make the "using" statments at the begining?
Thanks.
Kwokho, Fung.