1
我有一個數組和相同類型的對象的ObservableCollection,我想將它們連接在一起。每當我試着連接它們,儘管我只是在ObservableCollection中得到原始數字。我可以將ObservableCollection連接到包含相同類型對象的數組嗎?
public class MyTest {
public int id { get; set; }
public string Name { get; set; }
public bool Registered { get; set; }
}
ObservableCollection<MyTest> test = new ObservableCollection<MyTest>()
{
new MyTest(){
id = 1,
Name = "Graham",
Registered = true
},
new MyTest(){
id = 2,
Name = "Teresa",
Registered = false
}
};
MyTest[] myTest = {
new MyTest(){
id = 3,
Name = "Keith",
Registered = false
},
new MyTest(){
id = 4,
Name = "Emilie",
Registered = false
}
};
test.Concat(myTest);
如何加入這兩個在一起有什麼建議?