Link to home
Start Free TrialLog in
Avatar of rmmarsh
rmmarshFlag for United States of America

asked on

Error CS0308: The non-generic type `System.Array' cannot be used with the type arguments

I am getting the following error on the two lines of code:

Error CS0308: The non-generic type `System.Array' cannot be used with the type arguments

How do I fix this?
public Array<double> primitiveConst_, a_, b_, c_;
public Array<bool> monotonicityAdjustments_;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You could use List instead of Array:
public List<double> primitiveConst_, a_, b_, c_;
public List<bool> monotonicityAdjustments_;

primitiveConst_ = new List<double>() { 1, 2, 3 };
a_ = new List<double>() { 4, 5, 6 };
monotonicityAdjustments_ = new List<bool>() { false, false, true };

Open in new window

Regards.
Avatar of rmmarsh

ASKER

I guess I should have given the code for the whole class... here it is.  I don't understand why I'm getting the error, so if one of you could also explain that, I would appreciate it.
public class CoefficientHolder 
   {
      public CoefficientHolder(int n)
      {
         n_ = n ;
         primitiveConst_ = new Array<double>(n - 1);
         a_ = new Array<double>(n - 1);
         b_ = new Array<double>(n - 1);
         c_ = new Array<double>(n - 1);
         monotonicityAdjustments_ = new Array<bool>(n); 
      }
      
      public virtual void Dispose() {}
      public int n_;
      public Array<double> primitiveConst_, a_, b_, c_;
      public Array<bool> monotonicityAdjustments_;
   };

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I don't understand why I'm getting the error
I showed you why. You have to drop the angle brackets. There is no generic version of the Array class. You can assign an array of any type to the variable that is declared as type Array.
Avatar of rmmarsh

ASKER

Thanks...