In wf4, you can bind variables and constants to InArguments or OutArguments in 2 ways,
using the explicit syntax:
Variable<string> nameOfPerson = new Variable<string>();
new Assign {
To = new OutArgument<string>(nameOfPerson),
Value = new InArgument<string>("Name")
}
or you can use the implicit syntax
new Assign {
To = nameOfPerson,
Value = "Name"
}
Are there any disadvantages using the second syntax, such as maybe performance?
UPDATE
Apparently,
new Assign {
To = nameOfPerson,
Value="name"
}
does not work, but this does work
new Assign {
To = new OutArgument<string>(nameOfPerson),
Value = new InArgument<string>("name")
}
for the Value property, you can use implicit:
var anotherVariable = new Variable<string();
new Assign {
To = new OutArgument<string>(nameOfPerson),
Value = anotherVariable
}
It’s confusing when you can use implicit and when not
Not really, in the end the same code executes. The only extra code is the implicit cast from Variable to InArgument but that is just a constructor call so no extra overhead.