-
Notifications
You must be signed in to change notification settings - Fork 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
Discussion: \$ character escape for names #838
Comments
@alrz Will it have the added benefit to produce a constant as opposed to |
How do you finish this type of interpolation? Where's the end boundary? e.g.:
Also related: #701, dotnet/roslyn#10972 |
@yaakov-h Actually, if you have both |
@eyalsk A string literal is a constant already and this addition would not change that. Note: there are other proposals to make string interolated strings a constant if all of interpolations are constant and there is no format specifier which is unrelated here. |
This will make Visual Studio's refactoring job much harder. The benefit of |
@orthoxerox how about another syntax node just like interpolations? |
@alrz I know that a string literal is a constant, not sure whether I was clear but I'm asking whether this version of interpolated string would end up being a constant as opposed to a string.Format call.
Same as the following:
Now, I'm asking whether your version would have the added benefit to be the following:
Or is it just the same and the only thing it adds is "readability"? |
@eyalsk The point is to keep identifiers in sync in case of renaming etc. But the final string is the same. |
@alrz Ah okay, thanks. :) |
More like you need |
@Thaina It does not address verbosity caused by nameof+string interpolation mentioned in the OP. |
Currently, when you want to build up a string from multiple identifier names you'd end up with this:
Which is a lot less readable compared to the equivalent raw string `"logged: Class.Member".
I want to suggest to use
\$
and\$@
character escapes (currently an error) for that,This should work for non-verbatim string interpolated strings as well.
Note: If you want to use a raw string after
.
you would have to escape it i.e.\.
.Rel: #522
The text was updated successfully, but these errors were encountered: