C# Error CS0019, Operator '*' cannot be applied to operands of type 'double[]' and 'double' : <p>I have tried working on a vector addition code in C#, and part of it involves using math to determine X and Y values for a vector, and for some reason it gives me the error saying I cannot multiply an array value with a double precision floating point value. I have tried converting, but that has only created more errors. Here is my code: </p>

<pre><code>using System;
using System.Windows.Forms;

    namespace VectorAddEdit
    {
        public partial class Form1 : Form
        {
            double[] mag = new double[5];
            double[] ang = new double[5];
            int cnt = 0;
            public Form1()
            {
                InitializeComponent();
            }

            private void textBox1_TextChanged(object sender, EventArgs e)
            {

            }

            private void textBox2_TextChanged(object sender, EventArgs e)
            {

            }

            private void textBox4_TextChanged(object sender, EventArgs e)
            {

            }

            private void textBox5_TextChanged(object sender, EventArgs e)
            {

            }

            private void button1_Click(object sender, EventArgs e)
            {
                while (cnt &lt; 5)
                {
                    if (textBox1.Text == "" || textBox2.Text == "")
                    {
                        MessageBox.Show("You did not enter data into the correct boxes!");
                        System.Threading.Thread.Sleep(1000);
                        Application.Exit();
                    }

                    mag[cnt] = Convert.ToDouble(textBox1.Text);
                    ang[cnt] = Convert.ToDouble(textBox2.Text);

                    Console.ReadLine();

                    cnt++;
                }
            }

            private void button2_Click(object sender, EventArgs e)
            {
                double xsummag = 0;
                double ysummag = 0;
                double resultmag;
                double resultang;


                for (int i = 0; i &lt; cnt; i++)
                {
                    xsummag = mag * Math.Cos(ang * Math.PI / 180) + xsummag;
                    ysummag = mag * Math.Sin(ang * Math.PI / 180) + ysummag;
                }

                resultmag = Math.Sqrt(Math.Pow(xsummag, 2) + Math.Pow(ysummag, 2));
                resultang = Math.Atan(ysummag / xsummag) * 180 / Math.PI;

                if (xsummag &lt; 0 &amp;&amp; ysummag &gt; 0)
                    resultang = resultang + 180;

                else if (xsummag &lt; 0 &amp;&amp; ysummag &lt; 0)
                    resultang = resultang + 180;

                else if (xsummag &gt; 0 &amp;&amp; ysummag &lt; 0)
                    resultang = resultang + 360;

                textBox4.Text = resultmag.ToString();

                textBox5.Text = resultang.ToString();
            }

            private void button3_Click(object sender, EventArgs e)
            {
                System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"C:\Windows\Media\Alarm09.wav");

                player.Play();
                Application.DoEvents();
                System.Threading.Thread.Sleep(1000);

                Application.Exit();
            }
        }
    }
</code></pre>

<p>The error occurs on 2 lines where xsummag and ysummag are assigned. 
If anyone can help me resolve this error, I would greatly appreciate it. :)</p>
