FxCop 自定义规则 - 检查 winform 控件属性
我正在寻找 FxCop 规则的示例,该规则检查创建的控件的属性。
有人见过吗? 或者知道如何响应 FxCop SDK 中设置的属性?
富有的。
I am looking for an example of a FxCop Rule that inspects the properties of controls created.
Has anyone seen one? Or know how to respond to a property set in the FxCop SDK?
Rich.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这绝对不难。 只需过滤从 Control 继承的类型,然后获取字段列表(如果我没记错的话)。
您最好在 http://str8.to/fxcop-forum 询问这个问题 - 他们他们非常活跃,我在那里得到了很大的支持。
祝你好运!
This is definitely not difficult. Just filter for types that inherit from Control and then get a list of fields (if I remember correctly).
You may be better off asking this at the http://str8.to/fxcop-forum - they are very much active and I've had pretty great support there.
Good luck!
我的解决方案是迭代为每个被检查的成员提供的指令列表。
如果其类型为 Microsoft.FxCop.SDK.Method,则 _set 前缀标识属性集。
我遇到的唯一问题是,这不允许我识别保留为设计器默认值的属性。
My solutionwas to iterate through the instruction list provided for each member been checked.
If its was of type Microsoft.FxCop.SDK.Method then a prefix of _set identified a property set.
The only issue i have is this doesn't allow me to identify properties that have been left at the designer default values.