Skip to content

Parameter name case for SetParametersAsync #26738

Discussion options

You must be logged in to vote

Yes, parameter names are case-insensitive everywhere in Blazor. I know it would be nice for perf if they were actually case sensitive, but this is what we chose back in 3.0 and need to stick with it now.

I strongly recommend you don't call ToLowerInvariant(). That will destroy any perf gains you're making. It will have to make a new copy of the string entirely and walk across all the characters in it, and you will end up with a non-interned string.

Instead I'd do something like:

        private void BetterBlazorImplementation__WriteSingleParameter(string name, object value)
        {
            switch (name[0])
            {
                case "m":
                case "M":

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@SteveSandersonMS
Comment options

@stefanloerwald
Comment options

Answer selected by SteveSandersonMS
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@stefanloerwald
Comment options

@SteveSandersonMS
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants