c# - 如何正确地将 Dictionary,Object

我正在尝试调用一个 UserControl 公共(public)方法,该方法需要引用具有以下定义的 Dictionary 对象:

var dict = new Dictionary <Tuple<string, string>, Mappings.Level0>()

我的调用语句: uc.MyMthod(dict) 由于以下错误而无法编译:

Argument 1: cannot convert from System.Collections.Generic.Dictionary<ListBoxConnector.ucMappings.Tuple<string,string>,Mappings.Level0> to System.Collections.Generic.Dictionary<System.Tuple<string,string>,Mappings.Level0>

最佳答案

尝试使用 ListBoxConnector.ucMappings元组代替:

var dict = new Dictionary<ListBoxConnector.ucMappings.Tuple<string, string>, 
    Mappings.Level0>();

关于c# - 如何正确地将 Dictionary<Tuple<string,string>,Object> 作为参数传递给方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27736924/

相关文章:

java - 出现错误: No enclosing instance of type **** is

c++ - '' *2之前的解析错误

c++ - header 多重重新定义

android - Android代码抛出错误

php - PHP中 undefined index 错误

c++ - 代码编译错误

java - 无法编译Java代码

java - 未知的Java类错误

c# - C#中的编译时错误

c++ - 模板化 BST 方法的返回值问题