小编sha*_*atl的帖子

获取FxCop来抑制整个类型的警告?

如何抑制整个类型的FxCop警告?

namespace ConsoleApplication1
{     
    public static class Serializer<T>
    {
        public static string Serialize(T obj)
        {
            return string.Empty;
        }

        public static T Deserialize(string str)
        {
            return default(T);
        }
    }
Run Code Online (Sandbox Code Playgroud)

我尝试过这个,但它对我不起作用:

[assembly: SuppressMessage("Microsoft.Design",
    "CA1000:DoNotDeclareStaticMembersOnGenericTypes", Scope = "Type",
    Target = "ConsoleApplication1.Serializer'1")]
Run Code Online (Sandbox Code Playgroud)

.net c# code-analysis fxcop suppressmessage

11
推荐指数
1
解决办法
4002
查看次数

标签 统计

.net ×1

c# ×1

code-analysis ×1

fxcop ×1

suppressmessage ×1