views:

175

answers:

1

Sometimes when I'm writing XLANG/s code in an expression shape, it would be more readable if I could just use a temporary variable within the scope of that one code block. I hate to clutter up the entire orchestration with a variable declaration. Is there a way to declare a variable within an expression shape?

+3  A: 

So, it appears that the correct way to do this is to use a scope shape and to put the expression shape inside it. You can set the scope shape's transaction type to "None" if you don't need any special transaction handling. The scope shape can have variables associated with it (or messages or correlation sets), and they are visible only to the shapes within it.

If you check out the XLANG/s code that's generated when you use a scope shape you'll see it uses a scope keyword. It turns out that you can put the same code within your expression! So you'd do something like this:

scope
  {
  System.String tempString;

  body
  {
    tempString = someCalculation;
    // etc.
  }
}
Jeremy Stein
+1 ... good to know.
Filburt