Re: Type convertsion from string
- From: Marc Gravell <marc.gravell@xxxxxxxxx>
- Date: Sun, 21 Oct 2007 21:25:58 -0700
1: the main purpose of Bag here was to provide something that the
propdesc could talk to; an interface would serve just as well; can
provide example [see later]
2: by using an alternative PropertyDescriptor subclass; can provide
example [see later]
3,5,7: I haven no idea; not really used any of them much...
6: sorry; I was unclear; the first reference to each should have
served as a label, the second reference to each should have served as
a back reference, but *1 was somehow to put the values, and *2 was
somehow to track the properties
---
How to add property to type at runtimeI'll assume (from previous) that this means static? Pretty much can't
AFAIK
or create new type which contains newIt would have to be Reflection.Emit or dynamic compilation (compiler,
regular value property defined at runtime ?
code-dom, etc)
In 3,5,7 and "static" you've added needs that weren't mentioned
originally. I maintain that runtime properties are a very good way to
go *in general*, and most of the native .NET code (including winform/
wpf binding, etc) will copy perfectly with this. However, given the
external factors (mono being a biggie!) I can see how keeping it as
simple as possible would be desirable. I was just trying to offer my
best advice on the (limited) information provided at the time. If you
have different needs, or you simply don't agree (which is fine), then
"compile away". But I genuinely would advise you to parse and white-
list input... I don't know how isolated each user is from each other,
but if user A can create a formula that user B then uses, is similar
to an xss risk? If user A only affects user A then less of a problem.
Anyway, I can (if you want) provide examples for 1, 2 and hopefully 4,
but I don't intend going to the trouble unless you say so - as it
sounds like you may have overriding compatibility issues with this
approach. In which case, sorry to have wasted your time. Better to
have considered both though, I guess!
Marc
.
- Follow-Ups:
- Re: Type convertsion from string
- From: Marc Gravell
- Re: Type convertsion from string
- References:
- Type convertsion from string
- From: Andrus
- Re: Type convertsion from string
- From: Jon Skeet [C# MVP]
- Re: Type convertsion from string
- From: Andrus
- Re: Type convertsion from string
- From: Marc Gravell
- Re: Type convertsion from string
- From: Andrus
- Re: Type convertsion from string
- From: Marc Gravell
- Re: Type convertsion from string
- From: Andrus
- Re: Type convertsion from string
- From: Marc Gravell
- Re: Type convertsion from string
- From: Andrus
- Re: Type convertsion from string
- From: Marc Gravell
- Re: Type convertsion from string
- From: Andrus
- Re: Type convertsion from string
- From: Marc Gravell
- Re: Type convertsion from string
- From: Andrus
- Type convertsion from string
- Prev by Date: Re: Scanning hard drive
- Next by Date: Re: Scanning hard drive
- Previous by thread: Re: Type convertsion from string
- Next by thread: Re: Type convertsion from string
- Index(es):
Relevant Pages
|