Hi in the following programm I'd like to use list[0] to affect the
value of "v" but I'd rather not use the unsafe keyword.

using System;
using System.Collections.Generic;
using System.Text;

namespace test_lista_referencji
{
    class Program
    {
        static void Main(string[] args)
        {
            object v = 1;
            List<object> lista = new List<object>();
            lista.Add((object)v);

            lista[0] = 2;

            Console.WriteLine((int)v); // gives 1 and I'd like it to
be 2
            Console.WriteLine((int)lista[0]); // 2

            Console.ReadKey();
        }
    }
}

Reply via email to