My first thought is that you need to do the equivalent of calling
.ToString()
on any values that aren't already
string
.
You could either do that when you generate the IL at the point of the (Ldloc) or change
IO.Print
to something like:
public sealed class IO
{
public static void Print(params[] object arguments)
{
Console.WriteLine(string.Concat(arguments));
}
}
You could take this a step further and generate the call to
string.Concat(...)
any time you needed to process such a string and then it would work for assigning this type of string into another string variable. You probably want something that indicates if you want the string "processed" or not. There ought to be cases when you want to copy the unprocessed string without doing the "interpolation".