What seems to actually get 'rendered' is:
<a href="Something/C#">C#</a><br />
Nope. If you hover over the link Firefox will tell you in the status bar that the link goes to "C#", but it is lying. Actually click the link and you'll end up at "C%23" (it'll appear right in the address bar).
What is the proper way to escape this so the link will stay "Something/C%23" ?
You had it right the first time. "Something/C%2523" is encoded too much.
I noticed a weird little thing here. If you use a function to build up the link. The extra %25 escaping is not needed.
Being in a function or not won't affect it. What will affect it, and might be confusing you here, is if you are using the address bar to type in javascript: URLs as a testing mechanism. javascript: URLs are still URLs and any %-encoding in them will be undone one step before the JS interpreter gets a look at the code. If you used JS string literal escaping you would not meet this problem:
javascript:alert(document.body.innerHTML='<a href="Something/C\x2523">C#</a>')