Resharper:模棱两可的调用 [英] Resharper: Ambiguous Invocation
问题描述
使用Resharper,我会收到以下消息:
歧义调用解决方案ITicket.sln 项目ITicket ITicket \ frmMainTicket.cs:530模棱两可的调用:void DisableAllFields()(在类frmMainTicket中)void DisableAllFields() (在frmMainTicket类中)匹配
Ambiguous InvocationSolution ITicket.sln Project ITicket ITicket\frmMainTicket.cs:530 Ambiguous invocation: void DisableAllFields() (in class frmMainTicket) void DisableAllFields() (in class frmMainTicket) match
我是编码新手,可能需要一点帮助.如果我理解正确,那基本上是在说我正在调用方法,并且不确定应该使用哪种方法?我以前从未使用过Resharper.也许我对歧义调用是什么感到困惑,但是我对此进行了一些研究. 预先谢谢您.
I am new to coding and could use a little help. If I understand this correctly it is basically saying that I am calling a method and it is unsure what method I should use? I have never used Resharper before. Maybe I am confused on what Ambiguous Invocation is, I have done some research on it though. Thank you in advance.
从代码中:
private void SetViewForBugnetTicket()
{
DisableAllFields();
btnSendBugnetDev.Enabled = false;
}
方法:
private void DisableAllFields()
{
tbSubject.Enabled = false;
cmbCreatedBy.Enabled = false;
cmbDepartment.Enabled = false;
cmbCompany.Enabled = false;
dtpCreatedOn.Enabled = false;
dtpAssignedOn.Enabled = false;
dtpDueDate.Enabled = false;
cmbAssignedBy.Enabled = false;
cmbMainTech.Enabled = false;
cmbStatus.Enabled = false;
cmbPriority.Enabled = false;
cmbCategory.Enabled = false;
cmbTicketType.Enabled = false;
radBtnNoTraining.Enabled = false;
radBtnYesTraining.Enabled = false;
btnAddNoteDev.Enabled = false;
tbNoteAdd.Enabled = false;
rtbDescription.Enabled = false;
tsBtnSaveTicket.Enabled = false;
btnSetStatus.Enabled = false;
btnResolve.Enabled = false;
tbResolution.Enabled = false;
cmbResolution.Enabled = false;
btnBrowse.Enabled = false;
}
推荐答案
我们遇到了这个问题.它发生在带有VB.net的R#9.2 VS2013和VS2015中. 我们在声明为
We had this problem. It occurred in R# 9.2 VS2013 and VS2015 w/ VB.net. We had local variables in a method declared as
Dim Yield as Decimal
后来,完成了一项任务.
Later, an assignment was made.
Yield = CDbl(txtFoo.Text)
解决方法是使用带有[
和]
The fix is to qualify the token which is a reserved keyword with the characters [
and ]
Dim [Yield] as Decimal
[Yield] = CDbl(txtFoo.Text)
除了: 是的.实际上是CDbl.在此代码库中,双精度和十进制之间的混乱比比皆是.它可能需要每天进行WTF.
Aside: Yes. It was actually CDbl. The confusion between Double and Decimal abounds in this codebase. It probably needs to go on daily WTF.
这篇关于Resharper:模棱两可的调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!