public void Method() { var x = new AttributedClass(); #pragma warning disable 612,618 x.Method(); #pragma warning restore 612,618 }