csharp
is a Google Prettifier language code, so you'd spell it like:
<!-- language: lang-csharp -->
or
<!-- language: lang-cs -->
Note the lang-
prefix. Without the prefix you can specify a Stack Exchange tag name, and then you'd use c#
, so there is no bug here. The c# tag is configured to use lang-cs
already, see the bottom of the tag wiki:
Code Language (used for syntax highlighting): lang-cs
As it happens, csharp
is also a tag; it is a synonym for the [tag:c#]
tag, so the same language association is in effect.
You may have missed this on the editing help page, but it is clearly documented there:
You can use either one of the supported prettify language codes, like lang-cpp
or lang-sql
, or you can specify a tag, and the syntax highlighting language associated with this tag will be used.
I changed your answer source to use <!-- language: c# -->
and the highlighting is working just fine still. Perhaps you tried this in the editing preview and didn't wait for the timeout to pass before highlighting is applied?