English 中文(简体)
FxCop规则不与null值
原标题:
  • 时间:2009-04-14 14:03:07
  •  标签:

我想写一个规则fxcop这样做:

如果某个类是相对于零错误。

你认为这可能吗?

我写代码下行ti语句的一部分我能找到我在寻找的类型但不知道如何找到价值。

知道我有这段代码,但不知道去哪里然后. .

public override ProblemCollection Check(Microsoft.Cci.Member member)
        {
            Method m = member as Method;

            if (m != null)
            {   
                foreach (Statement s in m.Body.Statements)
                {
                    Block b = s as Block;
                    if (b != null)
                    {
                        foreach (Statement s1 in b.Statements)
                        {
                          ?
                        }
                    }
                }
            }

            return this.Problems;
        }
问题回答

如果你有< a href = " http://www.red-gate.com/products/reflector/ " rel =“nofollow”noreferrer title =“反射”>反射器< / >,你可以用灵感来自Microsoft.FxCop.Rules.Performance的代码。TestForEmptyStringsUsingStringLength——它类似于规则你想写。





相关问题
热门标签