C# String interpolation in NSLog cause compile warning on iOS

// Compile warning NW3: Format string should be a literal
NSLog($"a={1+1}");

Could this warning be avoided?

Yes, by not misusing NSLog ;). NSLog requires a constant string, because otherwise you will run into bad trouble if the final a string contains a %. consider:

var X = "50% off";
NSLog($"buy now, {X}") // oops.

Thanks marc!

So the best practise should be:

var x = "50% off";
NSLog("%@", $"buy now, {x}");

yes, correct.