简体   繁体   中英

Why does “a”=“a” return False

The expression "a"="a" returns False . What the heck is going on?

观察清单

Edit : Sorry, I'm working in VB.NET, not C#

Update : When I copy the expression into Notepad++, it shows "?a"="a" . Can it have something to do with encoding?

That expression is not legal C#.

You aren't getting an error because the FuncEval (the ability to execute code in the watch or immediate windows) uses a different parser with various issues.

These issues may eventually be fixed by replacing this parser with Roslyn.


EDIT

I suspect that the VB.Net parser used by FuncEval doesn't intern strings.

\n

If you run this expression outside of FuncEval (eg, LINQPad), it returns true.


Second EDIT

You have an unprintable character in the first string.

Notepad++ shows it as a ? because your text file is using an encoding that doesn't support the character.
To find out what it actually is, paste it into this site .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM