PC Review


Reply
Thread Tools Rate Thread

Adding literals to an existing Enum at runtime

 
 
=?Utf-8?B?SnVuYWlkIEtoYW4=?=
Guest
Posts: n/a
 
      6th May 2005
I have seen an example of how to create a new Enum at runtime using
EnumBuilder.

However, I was wondering if I could add literals to an existing Enum at
runtime ?
 
Reply With Quote
 
 
 
 
Mattias Sjögren
Guest
Posts: n/a
 
      6th May 2005

>However, I was wondering if I could add literals to an existing Enum at
>runtime ?


No, you can't change existing types at runtime, whether or not they
are enums.

Why do you want to do that anyway? Since enum members are constants,
they are mostly used at compile time.



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
 
Reply With Quote
 
=?Utf-8?B?SnVuYWlkIEtoYW4=?=
Guest
Posts: n/a
 
      6th May 2005
I agree.
I actually wanted to explore all options to somehow synch my enums with the
DB.
The only way would be to run an emitter exe periodically to generate an
assembly.
The emitter exe would fetch the values from the DB and generate appropriate
enums.


"Mattias Sjögren" wrote:

>
> >However, I was wondering if I could add literals to an existing Enum at
> >runtime ?

>
> No, you can't change existing types at runtime, whether or not they
> are enums.
>
> Why do you want to do that anyway? Since enum members are constants,
> they are mostly used at compile time.
>
>
>
> Mattias
>
> --
> Mattias Sjögren [MVP] mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Enum at runtime shapper Microsoft ASP .NET 1 26th Jun 2007 06:40 PM
ISO Currency code - existing enum in .NET ? José Joye Microsoft C# .NET 3 2nd Nov 2006 04:06 AM
ISO Currency code - existing enum in .NET ? José Joye Microsoft Dot NET 3 2nd Nov 2006 04:06 AM
Create an enum at runtime =?Utf-8?B?U3RldmUgVGVlcGxlcw==?= Microsoft C# .NET 2 3rd Nov 2005 03:46 PM
Create an enum at runtime Lawrence Oluyede Microsoft C# .NET 9 3rd Jan 2004 05:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:44 AM.