Not necessarily.
Through bone idle laziness, I have done some tinkering with 9 and 10 speed SRAM rear mechs and they are definitely incompatible. I checked with both gripshift and STI shifters.
Once I had the correct mech to hand I took some measurements off two mechs, both X9; one a 9 speed and the other a 10, and the length of the body is different.
Of course if I had done this before fitting the mech, I could have saved myself the effort, but it was a Sunday, I was bored, the bike needed building and the 10 speed mech was all I had to hand. :roll: