UsePropertiesWhereAppropriate vs PropertiesShouldNotReturnArrays

Hi, I'm converting some code to match FxCop rules but I've one problem with 2 looping rules.
Here is the code :

public decimal[] GetValues ()
{
    return m_values;
}

public void SetValues (decimal[] value)
{
    Debug.Assert(value != null && value.Length > 0);
    m_values = value;
}

Warning message is :
Cause: A public or protected method has a name that begins with "Get," takes no parameters, and returns a value that is not an array.

but THIS IS AN ARRAY

what is the solution
I can't use property because I'll get a warning that I use an array


Answer this question

UsePropertiesWhereAppropriate vs PropertiesShouldNotReturnArrays

  • brandon beacher

    hum new version (build 50628 on 1.32) didn't solved the problem :(
  • Siddhartha Rao

    Can you please post the smallest compilable code example that demonstrates the problem I must be missing something. When I compile your snippet into my own class, I don't see the issue in 1.32.



  • jonam

    What version of FxCop are you using Your pattern doesn't fire this violation for me on 1.32.

  • Mukul

    I'm using build : 50609.1 with runtime version 1.1.4322.2032.
    I've installed the MSI installer coming from http://www.gotdotnet.com/team/fxcop/

    Should I install the second version : FxCop for .Net Codename Whidbey Beta 2

  • UsePropertiesWhereAppropriate vs PropertiesShouldNotReturnArrays