I
I
Iq512017-10-04 15:32:56
C++ / C#
Iq51, 2017-10-04 15:32:56

How to implement a method with a command (C#)?

There is a Buff class with methods Enable() Update() Setup() ReEnable() Abort().
And there is an Action class that contains List buffs.
How to implement a method for an Action of the following type: Action.BuffsOperation( Update ), in which for each buff from the list we call the corresponding Update() method, etc.?
I know about the Command pattern, but maybe there is something simpler for this, for example with delegates?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
twobomb, 2017-10-04
@twobomb

Make an enum with arguments for BuffsOperation, in a BuffsOperation switch and iterate over the sheet calling the corresponding method does not suit you?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question