Prev: GroupBy
Next: ngen
From: Tony Johansson on
Hi!

Here I have a simple program that is not CLSCompliant because of two things
1. Two methods with same name but differ in case.
2. The program return an uint which should not be CLSCompliant

As you can see I have declared the CLSCompliantAttribute as an assembly
attribut but the compilers is happy
and give not a single warning about this.
Can somebody explain this ?

using System;
using System.Collections.Generic;
using System.Text;

[assembly: CLSCompliantAttribute(true)]

namespace ConsoleApplication8
{
class Program
{
uint tal = 2;

public uint Foo()
{
return tal;
}

public uint FOO()
{
return tal;
}

static void Main(string[] args)
{
Program prog = new Program();
}
}
}

//Tony


From: Patrice on
Hello,

Just add the "public" modifier. Else the class is private and the CLS
compliance is not checked...

--
Patrice



From: Heandel on
From what I've seen in previous experiences, the compiler simply "trusts"
you and doesn't perform any kind of check.

Heandel

From: Peter Duniho on
Patrice wrote:
> Hello,
>
> Just add the "public" modifier. Else the class is private and the CLS
> compliance is not checked...

Minor nit: the class is "internal" by default, not "private".
From: Arne Vajhøj on
On 17-02-2010 13:07, Peter Duniho wrote:
> Patrice wrote:
>> Just add the "public" modifier. Else the class is private and the CLS
>> compliance is not checked...
>
> Minor nit: the class is "internal" by default, not "private".

private is not even valid in the context.

Arne
 |  Next  |  Last
Pages: 1 2
Prev: GroupBy
Next: ngen