|For a string, a == b is always a value comparison, but ... it starts with a reference comparison!
1) operator == calls string.Equals.
2) The first thing that Equals does is this:
if ((Object)a==(Object)b) return true;
Which is a reference comparison, as you'd expect. A good percentage of the time, this will make the process faster.
3) It then checks for null in either side, and returns false if either is null.
4) It then compares the lengths - any difference is a return false.
5) It then calls another method which repeats those two tests (if it's the debug build) and throws an exception via Contract.Requires
6) It then uses unsafe code with pointers to do a value comparison (but quickly, using 12 bytes at a time for AMD processors, and 10 for Intel - don't ask)
So technically, "a == b" is a value comparison, but it has a few additional tests to speed things up, including a reference comparison.
But you really aren't supposed to know that, the traditional answer is "value comparison for strings". It may be that they wanted you to expand on "value type" and maybe explain why it's not a reference comparison?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!