473,327 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Help! How to make overridden method sealed using the CodeDom?

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;

but I just can't get the CodeDom to produce the "sealed" keyword...

Thanks,
- Lee

Jul 1 '06 #1
9 3961
An overriden method is assumed to be virtual. An overriden method is not
considerred a new method but simply a redefinition of the original method it
is not allowed to change such information. Allowing such a change to occur
would logically break many things.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung
<le**********@googlemail.com> wrote in message
news:11**********************@d56g2000cwd.googlegr oups.com...
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;

but I just can't get the CodeDom to produce the "sealed" keyword...

Thanks,
- Lee

Jul 1 '06 #2
There's nothing wrong with sealing a virtual method. (See
http://msdn2.microsoft.com/en-us/library/ms173150.aspx) What
specifically do you see breaking when I seal a virtual method?

Anyway, does anyone know how to seal a virtual method using the
CodeDom?

- Lee
Greg Young wrote:
An overriden method is assumed to be virtual. An overriden method is not
considerred a new method but simply a redefinition of the original method it
is not allowed to change such information. Allowing such a change to occur
would logically break many things.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung
<le**********@googlemail.com> wrote in message
news:11**********************@d56g2000cwd.googlegr oups.com...
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;

but I just can't get the CodeDom to produce the "sealed" keyword...

Thanks,
- Lee


Jul 1 '06 #3
Greg Young wrote:
An overriden method is assumed to be virtual. An overriden method is not
considerred a new method but simply a redefinition of the original method
it is not allowed to change such information. Allowing such a change to
occur would logically break many things.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung
<le**********@googlemail.com> wrote in message
news:11**********************@d56g2000cwd.googlegr oups.com...
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;

but I just can't get the CodeDom to produce the "sealed" keyword...

Thanks,
- Lee


Hi Greg,

You can seal an overridden method (with the 'sealed' keyword), in order to
stop further overriding of the method by derived classes, but remember, if
you override a method, you can still call the base class' implementation,
by means of the base.<MethodName>() syntax, inside that method... so
it /sort of/ is a new method.

--
Hope this helps,
Tom Spink
Jul 1 '06 #4
I apologize too early in the morning ..
<le**********@googlemail.com> wrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
There's nothing wrong with sealing a virtual method. (See
http://msdn2.microsoft.com/en-us/library/ms173150.aspx) What
specifically do you see breaking when I seal a virtual method?

Anyway, does anyone know how to seal a virtual method using the
CodeDom?

- Lee
Greg Young wrote:
An overriden method is assumed to be virtual. An overriden method is not
considerred a new method but simply a redefinition of the original method
it
is not allowed to change such information. Allowing such a change to
occur
would logically break many things.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung
<le**********@googlemail.com> wrote in message
news:11**********************@d56g2000cwd.googlegr oups.com...
> 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;
>
> but I just can't get the CodeDom to produce the "sealed" keyword...
>
> Thanks,
> - Lee
>

Jul 1 '06 #5

No problem. :-) Thanks for trying to help anyway.

- Lee

Greg Young wrote:
I apologize too early in the morning ..
<le**********@googlemail.com> wrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
There's nothing wrong with sealing a virtual method. (See
http://msdn2.microsoft.com/en-us/library/ms173150.aspx) What
specifically do you see breaking when I seal a virtual method?

Anyway, does anyone know how to seal a virtual method using the
CodeDom?

- Lee
Greg Young wrote:
An overriden method is assumed to be virtual. An overriden method is not
considerred a new method but simply a redefinition of the original method
it
is not allowed to change such information. Allowing such a change to
occur
would logically break many things.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung
<le**********@googlemail.com> wrote in message
news:11**********************@d56g2000cwd.googlegr oups.com...
> 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;
>
> but I just can't get the CodeDom to produce the "sealed" keyword...
>
> Thanks,
> - Lee
>


Jul 1 '06 #6
I expect that you will find this is a CodeDOM limitation. There are many
items which cannot be expressed in codedom (even some very basic concepts
like switch statements and while loops.

Cheers,

Greg

<le**********@googlemail.com> wrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...

No problem. :-) Thanks for trying to help anyway.

- Lee

Greg Young wrote:
I apologize too early in the morning ..
<le**********@googlemail.com> wrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
> There's nothing wrong with sealing a virtual method. (See
> http://msdn2.microsoft.com/en-us/library/ms173150.aspx) What
> specifically do you see breaking when I seal a virtual method?
>
> Anyway, does anyone know how to seal a virtual method using the
> CodeDom?
>
> - Lee
>
>
> Greg Young wrote:
>> An overriden method is assumed to be virtual. An overriden method is
>> not
>> considerred a new method but simply a redefinition of the original
>> method
>> it
>> is not allowed to change such information. Allowing such a change to
>> occur
>> would logically break many things.
>>
>> Cheers,
>>
>> Greg Young
>> MVP - C#
>> http://codebetter.com/blogs/gregyoung
>>
>>
>> <le**********@googlemail.com> wrote in message
>> news:11**********************@d56g2000cwd.googlegr oups.com...
>> > 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;
>> >
>> > but I just can't get the CodeDom to produce the "sealed" keyword...
>> >
>> > Thanks,
>> > - Lee
>> >
>

Jul 1 '06 #7
Really!? No switches or while loops? Looks like I need to abandon the
CodeDom then. You'd think I'd learn and give up trying to use these
inextensible frameworks...

Thanks,
- Lee
Greg Young wrote:
I expect that you will find this is a CodeDOM limitation. There are many
items which cannot be expressed in codedom (even some very basic concepts
like switch statements and while loops.

Cheers,

Greg

<le**********@googlemail.com> wrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...

No problem. :-) Thanks for trying to help anyway.

- Lee

Greg Young wrote:
I apologize too early in the morning ..
<le**********@googlemail.com> wrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
> There's nothing wrong with sealing a virtual method. (See
> http://msdn2.microsoft.com/en-us/library/ms173150.aspx) What
> specifically do you see breaking when I seal a virtual method?
>
> Anyway, does anyone know how to seal a virtual method using the
> CodeDom?
>
> - Lee
>
>
> Greg Young wrote:
>> An overriden method is assumed to be virtual. An overriden method is
>> not
>> considerred a new method but simply a redefinition of the original
>> method
>> it
>> is not allowed to change such information. Allowing such a change to
>> occur
>> would logically break many things.
>>
>> Cheers,
>>
>> Greg Young
>> MVP - C#
>> http://codebetter.com/blogs/gregyoung
>>
>>
>> <le**********@googlemail.com> wrote in message
>> news:11**********************@d56g2000cwd.googlegr oups.com...
>> > 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;
>> >
>> > but I just can't get the CodeDom to produce the "sealed" keyword...
>> >
>> > Thanks,
>> > - Lee
>> >
>


Jul 1 '06 #8
Here are a few of the things that can't be expressed
http://blogs.msdn.com/bclteam/archiv...16/396915.aspx

Cheers,

Greg
<le**********@googlemail.com> wrote in message
news:11*********************@75g2000cwc.googlegrou ps.com...
Really!? No switches or while loops? Looks like I need to abandon the
CodeDom then. You'd think I'd learn and give up trying to use these
inextensible frameworks...

Thanks,
- Lee
Greg Young wrote:
I expect that you will find this is a CodeDOM limitation. There are many
items which cannot be expressed in codedom (even some very basic concepts
like switch statements and while loops.

Cheers,

Greg

<le**********@googlemail.com> wrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>
> No problem. :-) Thanks for trying to help anyway.
>
> - Lee
>
> Greg Young wrote:
>> I apologize too early in the morning ..
>>
>>
>> <le**********@googlemail.com> wrote in message
>> news:11**********************@m79g2000cwm.googlegr oups.com...
>> > There's nothing wrong with sealing a virtual method. (See
>> > http://msdn2.microsoft.com/en-us/library/ms173150.aspx) What
>> > specifically do you see breaking when I seal a virtual method?
>> >
>> > Anyway, does anyone know how to seal a virtual method using the
>> > CodeDom?
>> >
>> > - Lee
>> >
>> >
>> > Greg Young wrote:
>> >> An overriden method is assumed to be virtual. An overriden method
>> >> is
>> >> not
>> >> considerred a new method but simply a redefinition of the original
>> >> method
>> >> it
>> >> is not allowed to change such information. Allowing such a change
>> >> to
>> >> occur
>> >> would logically break many things.
>> >>
>> >> Cheers,
>> >>
>> >> Greg Young
>> >> MVP - C#
>> >> http://codebetter.com/blogs/gregyoung
>> >>
>> >>
>> >> <le**********@googlemail.com> wrote in message
>> >> news:11**********************@d56g2000cwd.googlegr oups.com...
>> >> > 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;
>> >> >
>> >> > but I just can't get the CodeDom to produce the "sealed"
>> >> > keyword...
>> >> >
>> >> > Thanks,
>> >> > - Lee
>> >> >
>> >
>

Jul 1 '06 #9

<le**********@googlemail.comwrote in message
news:11*********************@75g2000cwc.googlegrou ps.com...
Really!? No switches or while loops? Looks like I need to abandon the
CodeDom then. You'd think I'd learn and give up trying to use these
inextensible frameworks...
CodeDom supports only features that are part of every language it can
generate, so it's rarely the best choice when you want to generate code only
in a specific language. It's a shame, because some of its features, like
being able set set indentation and brace conventions for the generated
source, are very handy.
Jul 2 '06 #10

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

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
9
by: Tom | last post by:
A question for gui application programmers. . . I 've got some GUI programs, written in Python/wxPython, and I've got a help button and a help menu item. Also, I've got a compiled file made with...
4
by: Sarir Khamsi | last post by:
Is there a way to get help the way you get it from the Python interpreter (eg, 'help(dir)' gives help on the 'dir' command) in the module cmd.Cmd? I know how to add commands and help text to...
6
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect...
2
by: BT Openworld | last post by:
I have just had to upgrade to Access 2003 as Access 97 EMail (SendObject) doesn't work when loaded on Windows XP. I'm finding my way around Access 2003 but my biggest problem is getting...
27
by: Bruce Dodds | last post by:
I recently started using Access 2003 for the first time. I wanted to pass on some comments about the Help system to Access MVPs who frequent this board. I'm doing this in the hope that some of...
3
by: lord.zoltar | last post by:
I've managed to get a nice little chm help system written. Now I need to display it! I added a HelpProvider to my MDIParent form and set the namespace of the HelpProvider to be the help file. So...
10
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably...
1
by: trunxnirvana007 | last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' 'UPGRADE_WARNING: Couldn't resolve...
0
by: hitencontractor | last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003. I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About. The application...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.