Search Results

Search found 3 results on 1 pages for '100r'.

Page 1/1 | 1 

  • Join two list comparing their elements properties

    - by 100r
    public class Person() { int ID; string Name; DateTime ChangeDate } var list1 = new List<Person> { new Person { ID= 1, Name = "Peter", ChangeDate= "2011-10-21" }, new Person { ID= 2, Name = "John", ChangeDate= "2011-10-22" }, new Person { ID= 3, Name = "Mike", ChangeDate= "2011-10-23" }, new Person { ID= 4, Name = "Dave", ChangeDate= "2011-10-24" } }; var list2 = new List<Person> { new Person { ID= 1, Name = "Pete", ChangeDate= "2011-10-21" }, new Person { ID= 2, Name = "Johny", ChangeDate= "2011-10-20" }, new Person { ID= 3, Name = "Mikey", ChangeDate= "2011-10-24" }, new Person { ID= 5, Name = "Larry", ChangeDate= "2011-10-27" } }; As output I would like to have list1 + list2 = Person { ID= 1, Name = "Peter", ChangeDate= "2011-10-21" }, Person { ID= 2, Name = "John", ChangeDate= "2011-10-22" }, Person { ID= 3, Name = "Mikey", ChangeDate= "2011-10-24" }, Person { ID= 4, Name = "Dave", ChangeDate= "2011-10-24" } Person { ID= 5, Name = "Larry", ChangeDate= "2011-10-27" } And the Algorithm is like this. Join two list. If elements of lists have same ID, compare them by ChangeDate and take the ond with bigger date. If ChangeDate are equeal take any of them but not both. Maybe its easier to concat both lists and than to filter them with lambda. I tried, but always came out with some ugly code :/ Anyone have any idea?

    Read the article

  • Select all items of union but not the last one!

    - by 100r
    I have few texboxes, dropdown lists, etc.. They have their css classes. I want to select all elements of specific class(es) but NOT the last element from group of all classes. <asp:TextBox ID="TextBox1" runat="server" CssClass="class1" ></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server" CssClass="class2" ></asp:TextBox> <asp:TextBox ID="TextBox3" runat="server" CssClass="class2" ></asp:TextBox> I want to select only TextBox1 and TextBox2, not TextBox3! selector should be something like this $("(.class1,.class1):not(:last)") or something like $(".class1,.class1").filter(":not(:last)") but of course none of it is working :) any sugestions? tnx in advance!

    Read the article

  • How to reliably recieve message from AWS that my instance was rebooted / terminated / stopped?

    - by Andrew Smith
    I have Nagios, and I want it to stop monitoring instances when they are stopped from the console. The requirements are: The message passed from AWS is 100R% reliable, e.g. when Nagios is down, and the message cannot be delivered, it will be re-delivered promptly when Nagios is up The message will pass quickly There is no need to scan status of all instances via EC2 API all the time, but only once a while Many thanks!

    Read the article

1