I have started to use Interpolated Strings (new feature of C# 6) and it is really useful and gracefully. But according to my needs I have to pass format of string to a method as a parameter. Something like next:
MyMethod(string format) In the past, I used it in the next way:
MyMethod("AAA{0:00}") Now I tried this code:
MyMethod($"AAA{i:00}") But this doesn't work, because i is created inside of the method and is out of scope in this context.
Is it possible to use any trick for passing interpolated strings as a parameter to a method?