✅ Explicit call ToString() when interpolating on primitive (value) types
Is it necessary to call ToString() when interpolating string using primitive (int, float, etc.) or in general value types? Would it avoid boxing allocation?
Example:
int someInt = 4;MyStructWithImplementedInterfaceIFormatable myStruct;Console.Write($"My number is: {someInt.ToString()} and struct: {myStruct.ToString()}");
int someInt = 4;MyStructWithImplementedInterfaceIFormatable myStruct;Console.Write($"My number is: {someInt.ToString()} and struct: {myStruct.ToString()}");