Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / December 2003

Tip: Looking for answers? Try searching our database.

CodeDOM: MemberAttributes.New in nested CodeTypeDeclaration

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Microsoft public - 17 Nov 2003 19:58 GMT
I am trying to generate a class hierarchy like this:

public class A {
   public class A.Helper {
   }
}

public class B: A {
   public new class B.Helper: A.Helper {
   }
}

CodeDOM apparently ignores the Attribute property on the CodeTypeDeclaration
object for nested types and uses the TypeAttributes property to decorate the
type declaration.  However, TypeAttributes does not permit you to express an
equivalent to MemberAttributes.New, and the B.Helper class above comes out
without the new modifier.

The generated code compiles and works fine, but with the warning level set
at 1 or above, I have to filter through lots of warnings about missing "new"
modifiers, which makes it hard to find other, more significant, warnings.

I've tried this in framework versions 1.0, 1.1, and PDC bits of 1.2 with the
same result.

This problem has been discussed in various dotnet newsgroups, but never with
any response from Microsoft.  Can anyone in the CLR (or appropriate) group
suggest a workaround?

Thanks,
Eric Schoen
Gang Peng[MSFT] - 03 Dec 2003 21:36 GMT
You are right. You don't have a way to specify "new" for type declaration
in CodeDom.
CodeDom is not designed to generate any code you can possible write. It is
meant to be a subset of all languages.
You need to generate different code.
I don't see why you would need to generate the code you mentioned above.
If you can illustrate the scenario, we can see if it is important enough
for us to support in future.

Gang Peng
[MS]

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.