Tag: 名称碰撞

名称空间和类名称冲突

我有一个叫做Functions的类,在命名空间中,让我们来说SomeNameSpace 。 在Functions类中,我有一个名为GetCurrentValue的函数,我正在使用该函数创build一个Excel公式以显示在公式栏中。 我想公式方程以=SomeNameSpace.Functions.GetCurrentValue开始,但是当我尝试这个 using System.IO; using System; namespace SomeNameSpace{ public class Functions{ public object GetCurrentValue (arg1, arg2…){ //GetCurrentValue method implementation } } } using System.IO; using System; using SomeNameSpace; namespace AnotherNamespace{ public static bool SetFormula (string newFormula){ //newFormula value is "GetCurrentValue" string sTemp = "=SomeNameSpace.Functions."; string Formula = sTemp + newFormula; return true; } […]