Click here to Skip to main content
15,899,126 members
Home / Discussions / C#
   

C#

 
GeneralRe: Execute And wait Pin
JDM67631-Dec-10 8:14
JDM67631-Dec-10 8:14 
Questionregistration form Pin
AISIDA AKINWALE MAYOMI1-Dec-10 3:34
AISIDA AKINWALE MAYOMI1-Dec-10 3:34 
AnswerRe: registration form Pin
Pete O'Hanlon1-Dec-10 3:43
mvePete O'Hanlon1-Dec-10 3:43 
AnswerRe: registration form Pin
Henry Minute1-Dec-10 3:45
Henry Minute1-Dec-10 3:45 
AnswerRe: registration form Pin
musefan1-Dec-10 3:54
musefan1-Dec-10 3:54 
QuestionWindows Tab Control Flickering Pin
vishnukamath1-Dec-10 1:37
vishnukamath1-Dec-10 1:37 
AnswerRe: Windows Tab Control Flickering Pin
Abhinav S1-Dec-10 1:42
Abhinav S1-Dec-10 1:42 
QuestionSwitching on type Pin
creatiive30-Nov-10 23:44
creatiive30-Nov-10 23:44 
Hi,

This is probably a design issue really. I have an object which is AbsMyObject (abstract). Now, what I am currently doing is testing what type it is, and passing it in to a method like this;

if (AbsMyObject is type1)
myMethod((type1)AbsMyObject);
if (AbsMyObject is type2)
myMethod((type2)AbsMyObject);

Im just overloading 'myMethod' so depending on what type my object actually is, a different method is called. Whilst this implementation works as expected, im ending up with tons of these "if object is" If statements and it just feels like a bad design. It also feels like this might have been encountered before and so there might be a better way of achieving this Smile | :)

Any pointers would be greatly appriciated!
Regards,
AnswerRe: Switching on type Pin
phil.o1-Dec-10 0:01
professionalphil.o1-Dec-10 0:01 
AnswerRe: Switching on type Pin
Pete O'Hanlon1-Dec-10 0:49
mvePete O'Hanlon1-Dec-10 0:49 
AnswerRe: Switching on type Pin
musefan1-Dec-10 1:01
musefan1-Dec-10 1:01 
GeneralRe: Switching on type Pin
creatiive1-Dec-10 2:34
creatiive1-Dec-10 2:34 
GeneralRe: Switching on type Pin
musefan1-Dec-10 2:55
musefan1-Dec-10 2:55 
AnswerRe: Switching on type Pin
Keith Barrow1-Dec-10 1:18
professionalKeith Barrow1-Dec-10 1:18 
GeneralRe: Switching on type Pin
musefan1-Dec-10 1:24
musefan1-Dec-10 1:24 
GeneralRe: Switching on type Pin
Keith Barrow1-Dec-10 1:52
professionalKeith Barrow1-Dec-10 1:52 
GeneralRe: Switching on type Pin
PIEBALDconsult1-Dec-10 2:26
mvePIEBALDconsult1-Dec-10 2:26 
GeneralRe: Switching on type Pin
Pete O'Hanlon1-Dec-10 2:57
mvePete O'Hanlon1-Dec-10 2:57 
AnswerRe: Switching on type Pin
PIEBALDconsult1-Dec-10 2:28
mvePIEBALDconsult1-Dec-10 2:28 
QuestionCall XP Mode shortcut programmatically [modified] Pin
spif200130-Nov-10 20:36
spif200130-Nov-10 20:36 
AnswerRe: Call XP Mode shortcut programmatically Pin
Rajesh Anuhya30-Nov-10 22:27
professionalRajesh Anuhya30-Nov-10 22:27 
GeneralRe: Call XP Mode shortcut programmatically Pin
spif200130-Nov-10 22:35
spif200130-Nov-10 22:35 
AnswerRe: Call XP Mode shortcut programmatically Pin
Eddy Vluggen1-Dec-10 1:23
professionalEddy Vluggen1-Dec-10 1:23 
GeneralRe: Call XP Mode shortcut programmatically Pin
spif20011-Dec-10 1:52
spif20011-Dec-10 1:52 
GeneralRe: Call XP Mode shortcut programmatically Pin
Eddy Vluggen1-Dec-10 2:32
professionalEddy Vluggen1-Dec-10 2:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.