-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible optimization in interpolated string: inline interpolated constants #4678
Comments
That should optimise down to just a string constant, not a Interpolation String. Should this be more of an Analyser and Code-Fix? (Eg String-Format Diagnostics. Doesn't offer code-fixes yet)) |
@gafter Do you know if there's an existing issue on optimizing interpolated strings where you're basically just doing concatenation? (I couldn't find one) So that See aspnet/HttpAbstractions#460 (comment) for reference. |
@khellang @gafter Additionally automatically calling public static string InterpolatedBox(int i)
{
return $"? {i}";
} boxes as
vs adding
which doesn't box
As its known at compile time what is happening |
@khellang I don't know if there is an issue for it. |
See #6738 (comment) for why this is likely to never happen. |
if an expression hole has a constant string value and no alignment or format, treat it as a literal instead of an expression. This would erase string.Format calls for scenarios like "throw new ArgumentException($"{nameof(argument)} should be something else".
Migrated from TFS/DevDiv 1097932
The text was updated successfully, but these errors were encountered: