我建立一個系統,其中我有一些類相同這一個:歧義
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Class to handle operations at Status table
/// </summary>
public class Status
{
#region Vars and Class Objects
protected Dados d;
protected string sql;
protected Logs log;
protected Permissoes p;
protected List<string> Mensagens;
#endregion
#region Constructor e Destructor
public Status()
{
d = new Dados();
log = new Logs();
p = new Permissoes();
Mensagens = new List<string>();
}
~Status()
{
d = null;
p = null;
log = null;
sql = null;
}
#endregion
}
(類日誌和類Permissoes具有類似的代碼結構)。
在上面的代碼中,正在VS2010 IDE顯示以下錯誤,裏面的構造函數的所有聲明:
Error File Line Col Ambiguity between 'Status.d' and 'Status.d' Status.cs 22 9 Ambiguity between 'Status.log' and 'Status.log' Status.cs 23 9 Ambiguity between 'Status.p' and 'Status.p' Status.cs 24 9 Ambiguity between 'Status.Mensagens' and 'Status.Mensagens' Status.cs 25 9 Ambiguity between 'Status.d' and 'Status.d' Prioridades.cs 21 9 Ambiguity between 'Status.p' and 'Status.p' Prioridades.cs 22 9 Ambiguity between 'Status.log' and 'Status.log' Prioridades.cs 23 9 Ambiguity between 'Status.d' and 'Status.d' Prioridades.cs 28 3 Ambiguity between 'Status.p' and 'Status.p' Prioridades.cs 29 9 Ambiguity between 'Status.log' and 'Status.log' Prioridades.cs 30 9 Ambiguity between 'Status.sql' and 'Status.sql' Prioridades.cs 31 9 Ambiguity between 'Status.p' and 'Status.p' Prioridades.cs 45 18 Ambiguity between 'Status.sql' and 'Status.sql' Prioridades.cs 53 5 Ambiguity between 'Status.d' and 'Status.d' Prioridades.cs 54 5 Ambiguity between 'Status.log' and 'Status.log' Prioridades.cs 58 17 Ambiguity between 'Status.p' and 'Status.p' Prioridades.cs 78 18 Ambiguity between 'Status.sql' and 'Status.sql' Prioridades.cs 86 17 Ambiguity between 'Status.d' and 'Status.d' Prioridades.cs 87 17 Ambiguity between 'Status.log' and 'Status.log' Prioridades.cs 88 17 Ambiguity between 'Status.p' and 'Status.p' Prioridades.cs 106 18 Ambiguity between 'Status.sql' and 'Status.sql' Prioridades.cs 114 17 Ambiguity between 'Status.d' and 'Status.d' Prioridades.cs 115 17 Ambiguity between 'Status.log' and 'Status.log' Prioridades.cs 116 17 Ambiguity between 'Status.p' and 'Status.p' Prioridades.cs 136 18 Ambiguity between 'Status.sql' and 'Status.sql' Prioridades.cs 137 13 Ambiguity between 'Status.d' and 'Status.d' Prioridades.cs 138 17 Ambiguity between 'Status.p' and 'Status.p' Prioridades.cs 157 18 Ambiguity between 'Status.sql' and 'Status.sql' Prioridades.cs 158 13 Ambiguity between 'Status.d' and 'Status.d' Prioridades.cs 159 26 Ambiguity between 'Status.p' and 'Status.p' Prioridades.cs 177 18 Ambiguity between 'Status.sql' and 'Status.sql' Prioridades.cs 178 4 Ambiguity between 'Status.d' and 'Status.d' Prioridades.cs 179 17
奇怪的是:我用這個同樣的方法建立另一個系統,它就像一個魅力。我只是將這些文件複製粘貼到另一個網站,我正在修改這些類以創建另一個系統。
任何想法?它聞起來像蟲...
編輯:
剛剛發現了。發生了什麼:我複製了Prioridades類,將其重命名並在VS2010上使用了Refactoring。它將ALL REFERENCES重新命名爲「Prioridades」,並將其重新命名爲「Status」,其中包括原來的課程......並且都變得雜亂無章。
解決方案:使用重構時要小心。
對不起,這個,傢伙...
爲什麼你有終結者?這不是C++,你知道嗎? – Oded
你有重複的課嗎?他們都在同一個命名空間嗎?你有沒有清理版本? – Oded
爲什麼沒有命名空間? – Paparazzi