我需要在Silverlight 3应用程序中基本创建一个值矩阵。有没有相当于DataTable的东西,我可以存储一个值矩阵?
谢谢,
答案 0 :(得分:2)
由于我不确定它的使用......一个简单的多维数组可以工作吗?
int[,] myArray = new int[4,2];
myArray[2,1] = 25;
答案 1 :(得分:0)
为此目的使用List集合,
private List<Employee> populatedlistEmployee()
{
listEmployee = new List<Employee>();
listEmployee.Add(new Employee() { ID = 1, FirstName = "Khalid", LastName = "Rafique", City = "ISB", FatherName = "Muhammad Rafique", PhoneNo = "092-333-5494532", Status = true });
listEmployee.Add(new Employee() { ID = 2, FirstName = "Awais", LastName = "Ahmed", City = "isb", FatherName = "Ahmed", PhoneNo = "--", Status = false });
listEmployee.Add(new Employee() { ID = 3, FirstName = "Ali", LastName = "hasan", City = "Rwp", FatherName = "Hasan ahmed", PhoneNo = "--", Status = false });
listEmployee.Add(new Employee() { ID = 4, FirstName = "Hasan", LastName = "khan", City = "Lha", FatherName = "Ali ahmed", PhoneNo = "--", Status = false });
listEmployee.Add(new Employee() { ID = 5, FirstName = "Ahmed", LastName = "ali", City = "Pwe", FatherName = "Hasan khan", PhoneNo = "--", Status = false });
listEmployee.Add(new Employee() { ID = 6, FirstName = "Bill", LastName = "gate", City = "new jersey", FatherName = "--", PhoneNo = "--", Status = true });
return listEmployee;
}
然后将其称为
dataGrid1.ItemsSource = populatedlistEmployee();