0

Why am I getting this building error "Malformed contract section in method..." on the following code?

List<int> MatrizesCorrelacao;

public string lsMatrizes
    {
        get
        {
            if (TudoDataUnica == true)
            {
                return "0";
            }

            Contract.Ensures(Regex.IsMatch(Contract.Result<string>(), @"^(-1)|(\d+(,\d+)*)$"));

            return TransformList<int>ToString(MatrizesCorrelacao);
        }
        set
        {
            MatrizesCorrelacao = TransformStringToList<int>(value);
        }
    }

1 Answers1

0

Like with most of the Contract calls, your Contract.Ensures has to be at the top of the method.