By default,
the parameter result appears as the first output action parameter.
The extended forms of the [Action] attribute give the user control over the action
names, order of parameters, and the possibility of adding placeholder parameters.
The idea is that in cases when you need to give more detail, you can use a form of
the [Action] attribute that lets you define the action vocabulary more explicitly.
286 Modeling Library Reference
???Don??™t care??? parameters. Sometimes (especially when composition is involved,
but also for certain test harnessing requirements) you want to include a placeholder
parameter in an action??™s signature. In this case, you would indicate the placeholder
with an underscore, , in the signature.
[Action("Foo(_, x)")] static void
MyFoo(int x) { _ }
The action label takes two parameters, but the first parameter is ignored.
Reordering of arguments. Overriding the default action label lets you specify a
different order of arguments for the action label than is provided by the method
being attributed. For example,
[Action("Foo(y, x)")]
static void MyFoo(int x, int y) { /* ... */ }
In this example the order of x and y are swapped. Note that all of the input parameters
of the method must be mentioned in the action label. No output parameter may be
mentioned in the input action label.
Similarly, the order of outputs may be customized:
[Action(Start="Foo_Start(x, s)",
Finish="Foo_Finish(s, result)")]
static bool Foo(int x, byref string s, out int val) { /* .
Pages:
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374