我在monotouch(命名空间System.Collections.Generic)中使用了一个通用的Stack类型。 在一个单独的NUnit的项目,即仅参照从MonoTouch的封装组件,我延长我的MonoTouch的阶级和重新实例堆栈:单击不能将类型System.Collections.Generic.Stack隐式转换为相同类型
using System.Collections.Generic;
namespace Tests
{
public class MyExtendedClass : MyExtendableClass
{
public MyExtendedClass()
{
m_myStackVariable = new Stack<string>();
使我有以下错误信息:
Cannot implicitly convert type
System.Collections.Generic.Stack<string>
toSystem.Collections.Generic.Stack<string>
当我尝试“去基地”的堆栈类型时,它显示我的mscorlib在它的System.Collections.Generic命名空间的程序集浏览器中,不像堆栈中的System.dll一样支持堆栈类型<>浏览器。
任何人都知道这里发生了什么?在同一个命名空间中,有两种类型在这些项目中有相同的名称吗?这里给我的感觉是什么?
嗨!我已经从nunit项目中删除了默认的系统引用,并添加了monotouch库(monotouch.dll,mscorlib.dll,System.Core.dll,System.dll,System.xml.dll - 全部来自monotouch包)。我以为我找到了解决方法,但现在我不断收到错误:“System.MissingFieldException:Field'MyNamespace.MyExtendableClass.m_myStackVariable'not found”。你有同样的错误吗? – TenaciousG 2011-03-17 20:56:30