问题描述
样式警察说功能/方法的名称应以大写字母开头(适当的大小写)
我给了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
:)
推荐答案
文本框控件名称txtName
TextBox control name txtName
我把诸如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,混乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!