Please explain C# syntax regarding array of delegates

Following  code  is correct . I  typed  it from  example  given in one of C#  book  but I  don't understand  suntax which I  have  written  again  after  completion of code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DelegateApp
{
    public class ClsMethods
    {
        public static double multiply(int x) => x * 2.0;
        public static double square(int x) => x * x;
    }
    public partial class Form1 : Form
    {
        public delegate double Operation(int x);
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Operation[] opp =
            {
                ClsMethods.multiply,
                ClsMethods.square
            };

            for (int i = 0; i < opp.Length; i++)
            {
                double d = opp[i](2);
                double dd = opp[i](5);
            }
        }
    }
}

Open in new window



 Operation[] opp =
            {
                ClsMethods.multiply,
                ClsMethods.square
            };

I  am  from  C++  background.I  understand  delegate concept also. but I  don't  understand  how  this  array is declared
It  should  have  been  like  follows
Operation[] opp = new Operation()
opp[0] = ClsMethods.multiply;
opp[1] = ClsMethods.square;

Open in new window


Please  anyone can explain
ADITYA RAOSoftware DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
Basically it is a short cut way to create and append items into an array.
Check this link about arrays in C#
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/arrays/single-dimensional-arrays

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Nitin SontakkeDeveloperCommented:
I like the word 'syntactic sugar', which is what this is been called. Because ultimately compiler never let this reach to machine in this form. And there quite a few in C#.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.