Is there a way in code to disable certain warnings in C# alike #pragma warning(cmd: warningsNo) in c++?
Yes. See the MSDN for the complete reference.
Almost precisely the same directive.