Hi again folks! Another question around mapping/tr...
# dotnet
p
Hi again folks! Another question around mapping/transformation of outputs to inputs: How can I accomplish an
Output.Format()
if my format string is not a string interpolation inline in code, but instead a composite format string (containing
{0}
placeholders) that is fetched from an external source (such as an environment variable)?
If there is just one
Input
I suppose I could call
String.Format()
inside an
.Apply()
on that input.
But in my case there are multiple
Input
that each correspond to a placeholder in the composite format string.
w
Right - the answer is effectively always
.Apply
. And if you have multiple inputs
.All().Apply()
. Other things (like
Output.Format
) are effectively all just sugar for common cases - but if your case falls outside of those - you want
.Apply
and maybe
.All
.
👍 1
p
Thanks @white-balloon-205! It’s all slowly beginning to make sense.
t
Copy code
var a = Output.Create("a");
var b = Output.Create("b");
var c = "{0}+{1}";
var d = Output.All<string>(a, b).Apply(vs => string.Format(c, vs.ToArray()));
1
Doesn’t look great but should work
p
Makes perfect sense @tall-librarian-49374 - thanks!