John  Burns

John Burns

  • NA
  • 120
  • 108.4k

why the parenthesis around the data type?

Dec 17 2010 1:41 PM
just wondering why this arguments data type has parenthesis around it? here is the code. the part in question is in red.

 public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int length = Talker.BlaBlaBla(textBox1.Text, (int) numericUpDown1.Value);
            MessageBox.Show("length is: " + length, "# of times");
        }


also, if its any help, here is the class code that goes with it.:

class Talker
    {
        public static int BlaBlaBla(string thingToSay, int numberOfTimes)
        {
            string finalString = "";
            for (int count = 1; count <= numberOfTimes; count++)
            {
                finalString = finalString + thingToSay + "\n";
            }
            MessageBox.Show(finalString, "text to say");
            return finalString.Length;
        }




Answers (10)