I don't want my List to be of fixed type. Rather I want the creation of List to be dependent on the type of variable. This code doesn't work:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Generic;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
string something = "Apple";
Type type = something.GetType();
List<type> list = null;
Console.ReadKey();
}
}
}
Can anybody tell me what changes I need to make in order to make it work right? I want the creation of list
to be dependent on the type of variable something
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…