private staffData[] ReadFile() //array for the data
        {
            try
            {
                string[]    arrayLines = File.ReadAllLines(path);          //read the file, put it to a 1D array
                staffData[] staffSheet = new staffData[arrayLines.Length]; //need for another 1D array, it helps to make difference in the text based on comma ","

                for (int i = 0; i < arrayLines.Length; i++)                //now the file will be read and based on this structure
                {
                    string[]  info  = arrayLines[i].Split(new[] { ',' });  //split lines with comma
                    staffData staff = new staffData();                     //3 different data
                    staff.Surname   = info[0];
                    staff.Firstname = info[1];
                    staff.ExtenCode = info[2];

                    staffSheet[i] = staff;
                }

                return(staffSheet);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message); //if something goes wrong, a message appears what is the problem
                return(null);
            }
        }
        private void cmdAdd_Click(object sender, EventArgs e) //Add button, it has timed function too, after the user added, the boxes will be cleared
        {
            var checkIfValid = toValidateData();              //validation method

            if (checkIfValid == true)
            {
                staffData[] addStaff            = ReadFile();
                var         notCorrectExtension = checkExtenCodeDuplicated(addStaff, txtExt.Text);
                if (notCorrectExtension == false)
                {
                    var temporaryData = new staffData[addStaff.Length + 1];

                    for (int i = 0; i < addStaff.Length; i++)
                    {
                        temporaryData[i] = addStaff[i];
                    }
                    temporaryData[addStaff.Length] = new staffData
                    {
                        Surname   = txtSurname.Text,
                        Firstname = txtFirstname.Text,
                        ExtenCode = txtExt.Text
                    };

                    addStaff = temporaryData;

                    bubbleSort(addStaff);

                    toSaveStaffData(addStaff);

                    lvConsole.Clear();
                    txtSurname.Text     = "";
                    txtFirstname.Text   = "";
                    txtExt.Text         = "";
                    lblUpdated.Visible  = true;
                    tmrUpdated.Interval = 3000;
                    tmrUpdated.Enabled  = true;
                }
                else
                {
                    MessageBox.Show("This extension code is in use");
                }
            }
        }