Click here to Skip to main content
15,887,596 members
Home / Discussions / C#
   

C#

 
GeneralRe: Method in a class Pin
Pete O'Hanlon23-Aug-10 4:41
mvePete O'Hanlon23-Aug-10 4:41 
GeneralMessage Closed Pin
23-Aug-10 12:53
_beauw_23-Aug-10 12:53 
GeneralRe: Method in a class Pin
Bernhard Hiller23-Aug-10 19:33
Bernhard Hiller23-Aug-10 19:33 
AnswerRe: Method in a class Pin
Abhinav S23-Aug-10 4:21
Abhinav S23-Aug-10 4:21 
QuestionThe strategy Pattern: a recurring problem Pin
pierpaolo paparo22-Aug-10 22:42
pierpaolo paparo22-Aug-10 22:42 
AnswerRe: The strategy Pattern: a recurring problem Pin
Luc Pattyn23-Aug-10 1:17
sitebuilderLuc Pattyn23-Aug-10 1:17 
GeneralRe: The strategy Pattern: a recurring problem Pin
pierpaolo paparo23-Aug-10 2:58
pierpaolo paparo23-Aug-10 2:58 
AnswerRe: The strategy Pattern: a recurring problem Pin
Luc Pattyn23-Aug-10 3:16
sitebuilderLuc Pattyn23-Aug-10 3:16 
pierpaolo paparo wrote:
How can my client change the Parameters (without doing any typecast) ?


What I was thinking would be along these lines:

interface IStrategy {
    int Execute(someParameterList);
}

class Algorithm {
    public int Execute(IStrategy strategy) {
        ...
        int result=strategy.Execute(someParameterList);
        ...
    }
}


MyStrategy strategy=new MyStrategy();
strategy.Property1=someValue1;
strategy.Property2=someValue2;
Algorithm.Execute(strategy);


obviously the algorithm cannot provide parameters to the strategy other than those set out in someParameterList, as it must treat all strategies equally. However the caller can influence its strategy by amending the code and/or providing constructor parameters or property values.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.


QuestionPassing values to external library Pin
Enobong Adahada22-Aug-10 21:57
Enobong Adahada22-Aug-10 21:57 
AnswerRe: Passing values to external library Pin
Calla22-Aug-10 22:03
Calla22-Aug-10 22:03 
GeneralRe: Passing values to external library Pin
Enobong Adahada22-Aug-10 22:55
Enobong Adahada22-Aug-10 22:55 
GeneralRe: Passing values to external library Pin
PIEBALDconsult23-Aug-10 16:37
mvePIEBALDconsult23-Aug-10 16:37 
QuestionRe: Passing values to external library Pin
Calla23-Aug-10 20:01
Calla23-Aug-10 20:01 
Questionremote standby or shutdown Pin
mannu8122-Aug-10 20:13
mannu8122-Aug-10 20:13 
AnswerMessage Closed Pin
22-Aug-10 20:53
stancrm22-Aug-10 20:53 
GeneralRe: remote standby or shutdown Pin
mannu8125-Aug-10 2:31
mannu8125-Aug-10 2:31 
AnswerRe: remote standby or shutdown Pin
phil.o22-Aug-10 21:41
professionalphil.o22-Aug-10 21:41 
AnswerRe: remote standby or shutdown [modified] Pin
Sunil G22-Aug-10 22:37
Sunil G22-Aug-10 22:37 
AnswerRe: remote standby or shutdown Pin
Luc Pattyn23-Aug-10 1:22
sitebuilderLuc Pattyn23-Aug-10 1:22 
GeneralRe: remote standby or shutdown Pin
Jesse Walker24-Aug-10 4:12
Jesse Walker24-Aug-10 4:12 
GeneralRe: remote standby or shutdown Pin
Luc Pattyn24-Aug-10 4:36
sitebuilderLuc Pattyn24-Aug-10 4:36 
QuestionCredRead Function. Does anyone know about it ?????????? Pin
one_in_one22-Aug-10 20:09
one_in_one22-Aug-10 20:09 
AnswerRe: CredRead Function. Does anyone know about it ?????????? Pin
OriginalGriff22-Aug-10 21:31
mveOriginalGriff22-Aug-10 21:31 
AnswerRe: CredRead Function. Does anyone know about it ?????????? Pin
Richard MacCutchan22-Aug-10 21:32
mveRichard MacCutchan22-Aug-10 21:32 
AnswerRe: CredRead Function. Does anyone know about it ?????????? Pin
Calla22-Aug-10 21:36
Calla22-Aug-10 21:36 

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.