違反 CLS 規則從非 CLSComplaint 類繼承
using System;
[assembly:CLSCompliant(true)]
namespace CLSDoc
{
[CLSCompliant(false)]
public class Animal
{
public int age = 0;
}
//Warning CS3009 'Dog': base type 'Animal' is not CLS-compliant
public class Dog : Animal
{
}
}