VS2008 C#错误“.ctor”语言不支持

时间:2010-05-04 11:30:58

标签: c# c++-cli

C#代码:

class Program
{
    static void Main(string[] args)
    { 
        TFWrapper tf;
        String lexDir = ".......";
        String lic = "........";
        String key = ".........";
        ArrayList cats = new ArrayList();
        Boolean useConj = false;
        String lang = "english";
        String encoding = "auto";
        tf = new TFWrapper(lexDir, lic, key, cats, useConj, lang, encoding);
    }
}  

调用托管C ++方法:

TFWrapper::TFWrapper(String^ mlexDir, String^ mlic, String^ mkey, ArrayList catList, Boolean^ m_useConj, String^ m_lang, String^ m_encoding);  

C#

的最后一行语言错误不支持获取'.ctor'

2 个答案:

答案 0 :(得分:6)

只是预感,但我认为你需要改变

ArrayList catList, Boolean^ m_useConj

ArrayList^ catList, Boolean m_useConj

因为Boolean是值类型而ArrayList是引用类型。

答案 1 :(得分:0)

尝试在C#中调用它:

tf = new TFWrapper(lexDir, lic, key, cats, useConj, lang, encoding);

此外,在您的C ++声明中,ArrayList catList不应该是ArrayList^ catlist