Non-CLS-Compliant Types in C#

How do I handle public members that work with non-CLS (Common Language Specification) object types?

You want to avoid public methods or properties that take or return types that aren’t CLS-compliant. For example, unsigned integers. However, if you can’t avoid these members, mark them with the CLSCompliant(false) attribute.

The compiler only honors the CLSCompliant attribute for public members in public types. Additionally, a type or member can’t be marked as CLS-compliant unless the assembly is also attributed as CLSCompliant(true).


public class SimpleClass {
    public void DoWork(uint someNumber) {

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s