The attribute tells the compiler to see if the flag is set, so that if it's not, any call to that method will not be compiled, just as if the method call never existed in the code. You could easily see that by using a reflector tool such as ILSpy.
So in fact it's not that the attribute changes the behavior of the method, but the compiler which knows to look for that attribute and change its behavior accordingly.
The attributed method (MyMethod
in your case) is still compiled and can be accessed via reflection.