Access modifiers to which CLS rules apply
suggest changeusing System;
[assembly:CLSCompliant(true)]
namespace CLSDoc
{
public class Cat
{
internal UInt16 _age = 0;
private UInt16 _daysTillVaccination = 0;
//Warning CS3003 Type of 'Cat.DaysTillVaccination' is not CLS-compliant
protected UInt16 DaysTillVaccination
{
get { return _daysTillVaccination; }
}
//Warning CS3003 Type of 'Cat.Age' is not CLS-compliant
public UInt16 Age
{ get { return _age; } }
//valid behaviour by CLS-compliant rules
public int IncreaseAge()
{
int increasedAge = (int)_age + 1;
return increasedAge;
}
}
}
The rules for CLS compliance apply only to public and protected members.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents