FxCop Custom Rule - Inspecting winform control properties

寵の児 提交于 2019-12-10 19:38:15

问题


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.


回答1:


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!




回答2:


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.



来源:https://stackoverflow.com/questions/341017/fxcop-custom-rule-inspecting-winform-control-properties

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!