I've got some winforms partial classes marked [Obsolete]. Unlike when applying this to methods, I get no warning after building. Is this because it's set on a partial class? I can't set it in the designer too, because that code can/will be regenerated. Anything I can do about it with attributes? I don't want to throw an exception or something similar.

Edited 2 Years Ago by pritaeas

You normally should at least get a warning if some code from obsolete code is used. Is the main partial form part missing?

I can't set it in the designer too, because that code can/will be regenerated.

If the class is obsolete, why would you be changing it such that the generated code is updated? Last I checked, generated code was only updated when you changed the form from the designer.

Is the main partial form part missing?

Nothing is missing.

why would you be changing it

Not me, others here that may not look closely at the code. I just want a compiler warning in the error list.

Edited 2 Years Ago by pritaeas

I would do a little re-design there. Whilst const ought to be flagged by Obsolete, I would redesign and make a public property that returns your const. Mark the property as obsolete and it should flag it.

Yeah, I know I should, but I doubt it's worth it in this case. Am hoping nobody is going to touch the code in the meantime. Just wanted confirmation, so thanks.

This question has already been answered. Start a new discussion instead.