Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 1) CS3007

Overloaded method 'method' differing only by unnamed array types is not CLS-compliant

This error occurs if you have an overloaded method that takes a jagged array and the only difference between the method signatures is the element type of the array. To avoid this error, consider using a rectangular array rather than a jagged array; use an additional parameter to disambiguate the function call; rename one or more of the overloaded methods; or, if CLS Compliance is not needed, remove the CLSCompliantAttribute attribute. For more information on CLS Compliance, see Language Independence and Language-Independent Components.

The following example generates CS3007:

// CS3007.cs
[assembly: System.CLSCompliant(true)]
public struct S
{
    public void F(int[][] array) { }
    public void F(byte[][] array) { }  // CS3007
    // Try this instead:
    // public void F1(int[][] array) {}
    // public void F2(byte[][] array) {}
    // or 
    // public void F(int[,] array) {}
    // public void F(byte[,] array) {}
}
Show:
© 2014 Microsoft