编译器警告(等级 1)CS1682
更新:2007 年 11 月
错误消息
对类型“type”的引用声明它嵌套在“nested type”中,但是未能找到它
当您导入的引用与其他引用或者您编写的代码不一致时,会发生此错误。发生此错误通常是因为编写了在元数据中引用类的代码,而此后或是删除了该类或是修改了类的定义。
示例
// CS1682.cs
// compile with: /target:library /keyfile:mykey.snk
public class A {
public class N1 {}
}
// CS1682_b.cs
// compile with: /target:library /reference:CS1682.dll
using System;
public class Ref {
public static A A1() {
return new A();
}
public static A.N1 N1() {
return new A.N1();
}
}
// CS1682_c.cs
// compile with: /target:library /keyfile:mykey.snk /out:CS1682.dll
public class A {
public void M1() {}
}
下面的示例生成 CS1682。
// CS1682_d.cs
// compile with: /reference:CS1682.dll /reference:CS1682_b.dll /W:1
// CS1682 expected
class Tester {
static void Main()
{
Ref.A1().M1();
}
}