为什么过时导致的错误? [英] Why Obsolete causes error?

查看:120
本文介绍了为什么过时导致的错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的:

[Obsolete("Use AnotherMethod() insted.", false)]

第二个参数是但Visual Studio中显示的警告当作错误从编译每一个过时的方法调用preventing项目。如何让VS标记这些调用的警告不是错误?

2nd parameter is false but Visual Studio shows Warning as Error for every obsolete method call preventing project from compilation. How to make VS mark these calls as Warning not Error?

推荐答案

在过时的方法定义:

#pragma warning disable 0618
        [Obsolete("test",false)]
        private void myMethod()

然后去项目属性,在建,在SUP preSS预警类型类型0618,现在它会忽略特定的方法和项目将编译

then go to project properties, under build, in suppress warning type type 0618, Now it will ignore that particular method and project will compile

这篇关于为什么过时导致的错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆