This is one of those weird ones that feels like I must be seeing things, but here is some code I am debugging:
private byte[] myCode = null;
...
public bool Tampered
{
get
{
return Bytes == null;
}
set
{
if (value)
{
if (Bytes != null)
{
ProcessBytes(); /* BREAKPOINT HERE */
myCode = null;
}
}
}
}
I run my code, which executes someObject.Tampered = true; and breaks on the breakpoint. At this point, the debugger shows mycode == bytes[3]. All is well. I step over ProcessBytes. All is still well.
Then, I step over myCode = null; and the debugger shows myCode == bytes[0].
What's going on? Have I just somehow fundamentally broken something? myCode isn't a property, so it shouldn't be doing anything odd. Is there some quirk of arrays in C# that I've somehow previously not known about?