StyleCop,混乱 [英] StyleCop, Confusion

查看:60
本文介绍了StyleCop,混乱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

样式警察说功能/方法的名称应以大写字母开头(适当的大小写)

我给了TextBox控件名称 txtName .
在Keydown事件中,我正在做一些编码工作.

所以我的活动就像

Style cop says name of function/method should be start with Capital character(proper case)

I have given TextBox control name txtName.
On Keydown event I am doing some coding stuff.

So my event is like

private void txtName_KeyDown(object sender, KeyEventArgs e)
       {
//      Coding  
        }




StyleCop将其视为方法"并引发警告名称以大写字母开头


如果我将文本框名称设为 TextName
那么StyleCop会发出警告变量名称必须以小写字母开头

任何建议表示赞赏

:)




StyleCop consider it as Method and throw warning Mathod names begin with an upper case letter


if I put TextBox name like TextName
then StyleCop throw warning variable names must starts with a lower case letter

any suggestion is appreciated

:)

推荐答案

Khaniya写道:
Khaniya wrote:

文本框控件名称txtName

TextBox control name txtName


Khaniya写道:
Khaniya wrote:

我把诸如TextName之类的TextBox名称

I put TextBox name like TextName


Stylecop只是强制使用已作为编码标准加入其中的规则.
试试:

1.文本框名称为 txtName
2. textboxKeyDown事件为 TxtName_KeyDown
只要确保在绑定事件时使用正确的方法名称即可.

不必必须将事件名称作为控件名称开头.


Stylecop is just forcing the rules that has been put into it as a coding standard.
Try:

1. textbox name as txtName and
2. textboxKeyDown event as TxtName_KeyDown
Just make sure, while binding the event, you use proper method name.

It''s not necessary that you have to start your event name as your control name.


与上述答案一样,Stylecop只是强制执行您要运行的规则集.

您可以更改运行规则以忽略某些错误

http://blogs.msdn. com/b/sourceanalysis/archive/2008/05/25/enabling-or-disabling-source-analysis-rules.aspx [
As in the above answer, Stylecop is just enforcing the ruleset that you are running against.

You can change the rules that it will run to ignore certain errors

http://blogs.msdn.com/b/sourceanalysis/archive/2008/05/25/enabling-or-disabling-source-analysis-rules.aspx[^]

I''m sure there''s one you can change for this, I can''t remember which one it is though, have a look through your rules


StyleCop浪费了您的时间.按照您想要的方式进行操作,然后继续进行该项目.
StyleCop is wasting your time. Just do it the way you want to, and get on with the project.


这篇关于StyleCop,混乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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