I have a string property, a name and a version string (such as "1.0.0") containing an object Aepditl < / P>
provided a list & lt; AppDetail & gt; In which there are duplicates of the same name but different version string, how do I create a list with the specific names and the highest version? / Pre> I want the list of exclusive items to contain only the second item, because it has the highest version. To compare versions I need to create an ICMP which creates the version object and then to use the version. The compatrate (version) method but this is not useful, because only the iQaal compactor accepts, not the ICMPrier. Any thoughts? Thank you It makes sense You do not need it either to apply, though. You can create a query that selects the appropriate item, first grouped by all the names, and then only selecting the highest version number from each group: Note that this creates a new list instead of updating the old list. In addition, you can replace the original type with a List.Distinct () accept After knowing that
IEqualityComparer exists
Various names are with the names = appDetailList .GroupBy (x = & Gt; x.Name). Select (x = & gt; New App Dabble {name = x, version = x.max (x = & gt; new version (x version)) ToString ()}) .Ollist ();
version , instead of a string.
Comments
Post a Comment