Making some sort of n00b mistake here - "The name 'var' does not exist in the current context" : So I'm a beginner with c# experimenting with the Microsoft.Office.Interop.Excel reference, and I've ran into an issue. Here's my main form:

 

    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;
    using Microsoft.Office.Interop.Excel;
    
    
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        { 
            public Form1()
            {
                InitializeComponent();
            }
    
            public void Form1_Load(object sender, EventArgs e)
            {
                var BankAccounts = new List<Account>
    {
        new Account
        {
            ID = 345,
            Balance = 541.27
        },
        new Account
        {
            ID = 123,
            Balance = -127.44
        }
    };
            }
    
            public void button1_Click(object sender, EventArgs e)
            {
                ThisAddIn.DisplayInExcel(BankAccounts, (Account, cell) =>
                // This multiline lambda expression sets custom processing rules  
                // for the bankAccounts.
                {
                    cell.Value = Account.ID;
                    cell.Offset[0, 1].Value = Account.Balance;
                    if (Account.Balance < 0)
                    {
                        cell.Interior.Color = 255;
                        cell.Offset[0, 1].Interior.Color = 255;
                    }
                });
    
            }
            }
        }
Returns the error: 

> The name 'BankAccounts' does not exist in the current context

I can't understand how this is happening, could someone please help me fix this and perhaps explain what's caused it?

Thanks a lot!
