Okay, I put in the 4 spaces, and I am now getting 22. No, I don't think the problem has anything to do with the framework or VS version. For one thing, I'm testing on the exact same versions you are and I cannot replicate the problem. For another, this is such an important part of the Framework that if it were as buggy as that I'm sure I would have heard about it by now.
We must be missing something here, I'm sure of it. Can you do me a favour and copy the code I've pasted below directly into a new test Console app, and run it
I know it looks virtually identical, but I've changed the names just in case there's a naming conflict somewhere (although that doesn't seem likely). Another thing that worries me is that perhaps one of your characters is from a slightly different character set or something.
A final possibility is that you're misunderstanding the de****. Just make sure you're only checking the value after the line concerned has been passed, so the yellow highlighting is on the line below.
string testString = " public MceaString getCHORA()";
int testStringPosition = testString.IndexOf("getC");
Console.WriteLine(testStringPosition);
testStringPosition = testString.IndexOf("getCH");
Console.WriteLine(testStringPosition);
|