Is the “textual order” across partial classes formally defined?

Here’s another snippet from the C# spec which, taken with your snippet, appears to settle that this is undefined behaviour:

10.2.6 Members

[…] The ordering of members within a type is rarely significant to
C# code, but may be significant when interfacing with other languages
and environments. In these cases, the ordering of members within a
type declared in multiple parts is undefined.

To be fair, it does say rarely significant, not insignificant :).

Leave a Comment