Arrarylist second highest value

In this blog we will know how to find second highest value in an array list.

 

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Collections;

namespace Arrarylist

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void Form1_Load(object sender, EventArgs e)

        {

            ArrayList list = new ArrayList();

            list.Add(1);

            list.Add(2);

            list.Add(3);

            list.Add(8);

            list.Add(9);

            list.Sort();

            MessageBox.Show(list[3].ToString());

           

 

        }

    }

}