Re: Switch on GET/SET accessor
From: Tamir Khason (tamir-NOSPAM_at_tcon-NOSPAM.co.il)
Date: 02/18/04
- Next message: Bret Pehrson: "Re: Vote for a edit/continue function in csharp whidbey"
- Previous message: David Rose: "StreamWriter: How to format a decimal?"
- In reply to: Stoitcho Goutsev \(100\) [C# MVP]: "Re: Switch on GET/SET accessor"
- Next in thread: v-jetan_at_online.microsoft.com: "Re: Switch on GET/SET accessor"
- Reply: v-jetan_at_online.microsoft.com: "Re: Switch on GET/SET accessor"
- Reply: v-jetan_at_online.microsoft.com: "Re: Switch on GET/SET accessor"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 18 Feb 2004 21:16:36 +0200
Thank you for response, but I sill have problem with it :)
I'll try to be more specific...
Two patterns:
1#
I have class named ItemInTheStore it has type (car, dressware, bread)
If the type of Item is FOOD, I do not need property named bra size, but I
still want to present it in the grid with NULL value in column size, but not
0 (or -1) 'cos it's integer
2#
I have class of experiment and it has type (type a and type b) in case of
type A value of hemoglobin level (for example) is obsolete and make no
sense, but ExperimentCollection has membes of both types and they should be
displayed together in the grid, but hemoglobin level value (float) column
should be NULL (not 0) in case of experiment type A
I believe it's clearer now ;)
"Stoitcho Goutsev (100) [C# MVP]" <100@100.com> wrote in message
news:OmEi69k9DHA.3648@TK2MSFTNGP11.phx.gbl...
> Hi Tamir
>
> > I found some workaround by using #if directives.... Still looking for
> better
> > solution.
>
> #if directives are preprocessor directives. You can include/exclude some
> portion of your source files for compiling. You cannot use preprocessor
> directives at run time. As far as I can see from your code you want to
> add/remove properties at runtime. This is not posible.
>
> > Stoitcho, I want to explain the propose of such thing:
> > I have data class which has some propertie of type. In some type other
> > properties are obsolete, so nothing in the program will go to use or
bind
> > it, but if there is other type of the class those properties are needed.
> > Of couse it possible to build abstract class and inherit from, but it is
> not
> > very good idea, when your objects are for data propose only and will not
> be
> > runed anyway.
> > So, if you still think that it does not make sense, response and we'll
> > discuss about... :)
>
> Frankly, it still doesn't make sense to me. IMHO you need to completely
> different classes. How you said they can share common base class or
> interface. There are some design patterns that might help you:
> ObjectFactory, Adapter or even visitor.
>
> Ofcourse maybe I'm not gettig your problem correctly. If you post some
> simple example of what do you need it may help us a lot.
>
> B\rgds
> 100
>
>
- Next message: Bret Pehrson: "Re: Vote for a edit/continue function in csharp whidbey"
- Previous message: David Rose: "StreamWriter: How to format a decimal?"
- In reply to: Stoitcho Goutsev \(100\) [C# MVP]: "Re: Switch on GET/SET accessor"
- Next in thread: v-jetan_at_online.microsoft.com: "Re: Switch on GET/SET accessor"
- Reply: v-jetan_at_online.microsoft.com: "Re: Switch on GET/SET accessor"
- Reply: v-jetan_at_online.microsoft.com: "Re: Switch on GET/SET accessor"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|