|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Create Property on the flyHello,
Is it possible to add a property to a class on the fly? If yes, How can I do this or where can I find an exemple? Thank you Marc R. Marc,
A (non static) class is a *template* that you use at design time, so what do you mean with "on the fly"? Cor Show quoteHide quote "Marc Robitaille" <marc.marie AT globetrotter.net.del> schreef in bericht news:OaKH49DFHHA.4016@TK2MSFTNGP02.phx.gbl... > Hello, > > Is it possible to add a property to a class on the fly? If yes, How can I > do this or where can I find an exemple? > > Thank you > > Marc R. > Hello Cor,
In my project, I need to create an Enum of a list of files and create a property from my enum at runtime. I have already found a peace of code to creates Enum on the fly at runtime but nothing on properties Thank you "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message de news: uGEQmGEFHHA.1***@TK2MSFTNGP05.phx.gbl...Show quoteHide quote > Marc, > > A (non static) class is a *template* that you use at design time, so what > do you mean with "on the fly"? > > Cor > > "Marc Robitaille" <marc.marie AT globetrotter.net.del> schreef in bericht > news:OaKH49DFHHA.4016@TK2MSFTNGP02.phx.gbl... >> Hello, >> >> Is it possible to add a property to a class on the fly? If yes, How can I >> do this or where can I find an exemple? >> >> Thank you >> >> Marc R. >> > > I suspect you don't *need* to create the enum of files but if you told us
more about what you are trying to do we might be able to suggest a better way. Marc Robitaille wrote:
> In my project, I need to create an Enum of a list of files and create a [IMHO] No; you don't.> property from my enum at runtime. There are plenty of ways of doing .. whatever it is you're actually trying to achieve .. without creating new Types at run-time. Whilst it's /ever/ so clever that VB can do this, it's a Pain in the Proverbial to try and work out what happened when it [inevitably] goes wrong. Since you're working with files, I'd suggest a property that is indexed by /file name/ as a starting point, probably derived from some sort of collection base class so that you can iterate through them. HTH, Phill W. Yes, I was thinking "Dictionary" ;)
Show quoteHide quote "Phill W." <p-.-a-.-w-a-r-d@o-p-e-n-.-a-c-.-u-k> wrote in message news:ekmi0q$b3u$1@south.jnrs.ja.net... > Marc Robitaille wrote: > >> In my project, I need to create an Enum of a list of files and create a >> property from my enum at runtime. > > [IMHO] No; you don't. > > There are plenty of ways of doing .. whatever it is you're actually trying > to achieve .. without creating new Types at run-time. Whilst it's /ever/ > so clever that VB can do this, it's a Pain in the Proverbial to try and > work out what happened when it [inevitably] goes wrong. > > Since you're working with files, I'd suggest a property that is indexed by > /file name/ as a starting point, probably derived from some sort of > collection base class so that you can iterate through them. > > HTH, > Phill W. Marc Robitaille wrote:
> Hello Cor, Just curious, where did you find that code? I don't really need it but> > In my project, I need to create an Enum of a list of files and create a > property from my enum at runtime. I have already found a peace of code to > creates Enum on the fly at runtime but nothing on properties > it sounds like a neat trick, and I'd like to see how it works. ;)
VB vs. C# language challenge question
Full Screen connect vb app to sql 2005 express Dropping folder on desk top icon how to make cookies into an array? edit text in file using streamreader and string.replace Can't Figure Out why this array is out of bounds now! Delete Selected Lines from Text File loading treeview dynamically is very slow Add a META line to an existing HTML doc programmatically |
|||||||||||||||||||||||