A question about `Input<T>` and `Output<T...
# dotnet
p
A question about
Input<T>
and
Output<T>
as they pertain to a C# program. If resource A takes an
Input<string>
and I want to construct that string using a pattern including one or more
Output<string>
from resource B, how should I do that? I assume the following is too naïve:
Copy code
resourceA.SomeInput = $"{resourceB.FirstOutput}...{resourceB.SecondOutput}";
Is there some string formatter implementation of
Output<T>
perhaps?
Hm, I think maybe I found something by looking around in Object Browser a bit.
Looks like I could do:
Copy code
resourceA.SomeInput = Output.Format($"{resourceB.FirstOutput}...{resourceB.SecondOutput}");
Because the string interpolation will be cast automatically by the compiler to a
System.FormattableString
. Very elegant! 👍
w
That’s right. See this section of the docs for more details: https://www.pulumi.com/docs/intro/concepts/programming-model/#outputs-and-strings