public void setDataSource <T>() where T : GameObject { var gameObjects = loader.load(romdata); dgvGameObjects.DataSource = gameObjects.GetList().ConvertAll(x => x as T); }