关于CLS的一个问题
《Microsoft .NET框架程序设计》(修订版)第1章1.7节给了个例子说明CLS:using System;
[assembly:CLSCompliant(true)]
public class App
{
public UInt32 Abc() { return 0; }
...
}
说因为App.Abc()的返回值类型与CLS不兼容,所以编译器会报错。我在VS2005上试验了一下,却并没有报任何错误。请问这是为什么呢?谢谢! --------------------编程问答-------------------- 可能只是警告,不是编译错误 --------------------编程问答-------------------- .net
[assembly:CLSCompliant(true)]
下面的声明会生成 CLS 遵从性警告,因为 CLS 中没有指定 UInt32 类型。
--------------------编程问答-------------------- 谢谢!果然是有一个警告:
Warning 1 Return type of 'App.Abc()' is not CLS-compliant
补充:.NET技术 , C#