Error trying to add numbers to an array of int32

1

I'm trying to store an array of ints to use periostealmente, but I came across a syntax error in the part. { 4, 7, 8, 9, 10 }

    private Int32[] m_FluxosPlataformas = null;
    public Int32[] FluxosPlataformas
    {
        get
        {
            if (m_FluxosPlataformas == null)
            {
                m_FluxosPlataformas =  { 4, 7, 8, 9, 10 } ; 
            }
            return m_FluxosPlataformas;
        }
    }
    
asked by anonymous 16.02.2016 / 13:23

1 answer

8

The array is a reference type and needs to be initialized.

Replace code:

m_FluxosPlataformas =  { 4, 7, 8, 9, 10 } ; 

By:

m_FluxosPlataformas = new Int32[] { 4, 7, 8, 9, 10 };
    
16.02.2016 / 13:32