-
Notifications
You must be signed in to change notification settings - Fork 3
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
OSOE-606: Fixing new C# 11 analyzer violations #68
Conversation
@@ -47,7 +47,7 @@ public ZoneDescriptor(string zoneName = null, string elementName = null, bool wr | |||
var id = ZoneName.ToCamelCase(); | |||
var layoutClassName = string.IsNullOrEmpty(parent) | |||
? "layout" + ZoneName | |||
: FormattableString.Invariant($"layout{parent}__{id}"); | |||
: string.Create(CultureInfo.InvariantCulture, $"layout{parent}__{id}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be very verbose. Can't we have some shorter helper method in HL?
For example:
public static class StringCreator
{
public static string Invariant(this DefaultInterpolatedStringHandler value) =>
string.Create(CultureInfo.InvariantCulture, ref value);
}
Then this line would become:
: string.Create(CultureInfo.InvariantCulture, $"layout{parent}__{id}"); | |
: StringCreator.Invariant($"layout{parent}__{id}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or:
: string.Create(CultureInfo.InvariantCulture, $"layout{parent}__{id}"); | |
: InvariantString.New($"layout{parent}__{id}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked into this but didn't try DefaultInterpolatedStringHandler
(since you can't simply pass around FormattableString
, simple approaches won't work), thanks.
OSOE-606