private void Ws_GetMessageDatasCompleted(object sender, MobileService.GetMessageDatasCompletedEventArgs e) { //myClassList.Clear(); var ttt = e.Result; foreach (MobileService.Message item in e.Result) { Message _Message = new Message(); _Message.MessageDate = item.MessageTime; _Message.MessageData = item.messagedata; MyClassList.Add(_Message); } }
public void test2() { IList <MyClass> list3 = new List <MyClass>(); list3.Add(new MyClass(12)); foreach (var x in list3) { AssertSame(12, x.MyInt); } var myClassList = new MyClassList(); myClassList.Add(new MyClass(12)); foreach (var x in myClassList) { AssertSame(12, x.MyInt); } }
static void Main(string[] args) { MyClassList l = new MyClassList() { new MyClass() { Type = "Bob", Id = 1 }, new MyClass() { Type = "Jones", Id = 2 } }; MyClassList l2 = new MyClassList() { new MyClass() { Type = "Jones", Id = 2 }, new MyClass() { Type = "Bob", Id = 1 } }; MyClassList l3 = new MyClassList() { new MyClass() { Type = "Jones", Id = 2 } }; Console.WriteLine("{0} {1} {2}", l.GetHashCode(), l2.GetHashCode(), l3.GetHashCode()); l3.Add(new MyClass() { Type = "Bob", Id = 1 }); Console.WriteLine("{0}", l3.GetHashCode()); }