Take unique records from text file using LINQLinq distinct & maxHow to select only the records with the highest date in LINQCreate a list from two object lists with linqAny chance to get unique records using Linq (C#)?Using LINQ to remove elements from a List<T>Sorting & Unique Records in LinqUnique list of items using LINQHow can I do SELECT UNIQUE with LINQ?How to display unique records from a has_many through relationship?Select multiple records based on list of Id's with linqdeserialize json sting to genric list ( Error converting value to type 'System.Collections.Generic.List`1 Path '', line 1, position 70
Can anybody tell me who this Pokemon is?
6502: is BCD *fundamentally* the same performance as non-BCD?
What was the intention with the Commodore 128?
What are some tips and tricks for finding the cheapest flight when luggage and other fees are not revealed until far into the booking process?
If a person claims to know anything could it be disproven by saying 'prove that we are not in a simulation'?
Short comic about alien explorers visiting an abandoned world with giant statues that turn out to be alive but move very slowly
What exactly happened to the 18 crew members who were reported as "missing" in "Q Who"?
What is the question mark?
Visa on arrival to exit airport in Russia
Scam? Phone call from "Department of Social Security" asking me to call back
What should I do with the stock I own if I anticipate there will be a recession?
Is there any official ruling on how characters go from 0th to 1st level in a class?
Why does "auf der Strecke bleiben" mean "to fall by the wayside"?
Does Reckless Attack work with Multiattack when wild shaped?
How do I pass a "list of lists" as the argument to a function of the form F[x,y]?
Why do we use low resistance cables to minimize power losses?
What is the spellcasting ability of a Barbarian Totem Warrior?
Did Michelle Obama have a staff of 23; and Melania have a staff of 4?
Is this bar slide trick shown on Cheers real or a visual effect?
What is the purpose/function of this power inductor in parallel?
What would cause a nuclear power plant to break down after 2000 years, but not sooner?
Is there a word for returning to unpreparedness?
Why does auto deduce this variable as double and not float?
Good way to stop electrolyte tabs from turning into powder?
Take unique records from text file using LINQ
Linq distinct & maxHow to select only the records with the highest date in LINQCreate a list from two object lists with linqAny chance to get unique records using Linq (C#)?Using LINQ to remove elements from a List<T>Sorting & Unique Records in LinqUnique list of items using LINQHow can I do SELECT UNIQUE with LINQ?How to display unique records from a has_many through relationship?Select multiple records based on list of Id's with linqdeserialize json sting to genric list ( Error converting value to type 'System.Collections.Generic.List`1 Path '', line 1, position 70
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have set up ICollection<User>
list:
public ICollection<User> MyUsers get; set;
public IList<User> GetUserList(string path)
MyUsers = File.ReadAllLines(path)
.Where(linia => linia.Length > 1)
.Select(line => Parse(line))
.ToList();
return new List<User>(MyUsers);
private static User Parse(string line)
');
return new User
ReadTime = column [0],
idUser = column [1],
LastName = column [2],
FirstName = column [3],
City = column[4]
;
My source text file looks as below:
2019-03-03|1|LN1|FN1|Berlin
2019-03-03|2|LN2|FN2|Rome
2019-03-03|3|LN3|FN3|Wien
2019-03-03|4|LN4|FN4|Londyn
....
2019-03-27|1|LN1|FN1|Berlin
2019-03-27|2|LN2|FN2|Rome
2019-03-27|3|LN3|FN3|Wien
2019-03-27|4|LN4|FN4|Londyn
When I run this, I'm getting list with the same records, only ReadTime
is diffrent.
How can I set up unique MyUsers
list, where column ReadTime
will be taken last date?
c# linq timestamp unique icollection
add a comment |
I have set up ICollection<User>
list:
public ICollection<User> MyUsers get; set;
public IList<User> GetUserList(string path)
MyUsers = File.ReadAllLines(path)
.Where(linia => linia.Length > 1)
.Select(line => Parse(line))
.ToList();
return new List<User>(MyUsers);
private static User Parse(string line)
');
return new User
ReadTime = column [0],
idUser = column [1],
LastName = column [2],
FirstName = column [3],
City = column[4]
;
My source text file looks as below:
2019-03-03|1|LN1|FN1|Berlin
2019-03-03|2|LN2|FN2|Rome
2019-03-03|3|LN3|FN3|Wien
2019-03-03|4|LN4|FN4|Londyn
....
2019-03-27|1|LN1|FN1|Berlin
2019-03-27|2|LN2|FN2|Rome
2019-03-27|3|LN3|FN3|Wien
2019-03-27|4|LN4|FN4|Londyn
When I run this, I'm getting list with the same records, only ReadTime
is diffrent.
How can I set up unique MyUsers
list, where column ReadTime
will be taken last date?
c# linq timestamp unique icollection
look at this stackoverflow.com/questions/16076805/linq-distinct-max
– apomene
Mar 27 at 12:22
add a comment |
I have set up ICollection<User>
list:
public ICollection<User> MyUsers get; set;
public IList<User> GetUserList(string path)
MyUsers = File.ReadAllLines(path)
.Where(linia => linia.Length > 1)
.Select(line => Parse(line))
.ToList();
return new List<User>(MyUsers);
private static User Parse(string line)
');
return new User
ReadTime = column [0],
idUser = column [1],
LastName = column [2],
FirstName = column [3],
City = column[4]
;
My source text file looks as below:
2019-03-03|1|LN1|FN1|Berlin
2019-03-03|2|LN2|FN2|Rome
2019-03-03|3|LN3|FN3|Wien
2019-03-03|4|LN4|FN4|Londyn
....
2019-03-27|1|LN1|FN1|Berlin
2019-03-27|2|LN2|FN2|Rome
2019-03-27|3|LN3|FN3|Wien
2019-03-27|4|LN4|FN4|Londyn
When I run this, I'm getting list with the same records, only ReadTime
is diffrent.
How can I set up unique MyUsers
list, where column ReadTime
will be taken last date?
c# linq timestamp unique icollection
I have set up ICollection<User>
list:
public ICollection<User> MyUsers get; set;
public IList<User> GetUserList(string path)
MyUsers = File.ReadAllLines(path)
.Where(linia => linia.Length > 1)
.Select(line => Parse(line))
.ToList();
return new List<User>(MyUsers);
private static User Parse(string line)
');
return new User
ReadTime = column [0],
idUser = column [1],
LastName = column [2],
FirstName = column [3],
City = column[4]
;
My source text file looks as below:
2019-03-03|1|LN1|FN1|Berlin
2019-03-03|2|LN2|FN2|Rome
2019-03-03|3|LN3|FN3|Wien
2019-03-03|4|LN4|FN4|Londyn
....
2019-03-27|1|LN1|FN1|Berlin
2019-03-27|2|LN2|FN2|Rome
2019-03-27|3|LN3|FN3|Wien
2019-03-27|4|LN4|FN4|Londyn
When I run this, I'm getting list with the same records, only ReadTime
is diffrent.
How can I set up unique MyUsers
list, where column ReadTime
will be taken last date?
c# linq timestamp unique icollection
c# linq timestamp unique icollection
edited Mar 27 at 12:33
Michał Turczyn
19.8k13 gold badges24 silver badges42 bronze badges
19.8k13 gold badges24 silver badges42 bronze badges
asked Mar 27 at 12:19
4est4est
1,1504 gold badges16 silver badges34 bronze badges
1,1504 gold badges16 silver badges34 bronze badges
look at this stackoverflow.com/questions/16076805/linq-distinct-max
– apomene
Mar 27 at 12:22
add a comment |
look at this stackoverflow.com/questions/16076805/linq-distinct-max
– apomene
Mar 27 at 12:22
look at this stackoverflow.com/questions/16076805/linq-distinct-max
– apomene
Mar 27 at 12:22
look at this stackoverflow.com/questions/16076805/linq-distinct-max
– apomene
Mar 27 at 12:22
add a comment |
3 Answers
3
active
oldest
votes
You could try with simple GroupBy
method:
MyUsers = File.ReadAllLines(path)
.Where(linia => linia.Length > 1)
.Select(line => Parse(line))
.GroupBy(
u => u.idUser,
(key, grp) => new User()
ReadTime = grp.Select(u => u.ReadTime).Max(),
idUser = key,
LastName = grp.Select(u => u.LastName).FirstOrDefault(),
FirstName = grp.Select(u => u.FirstName).FirstOrDefault(),
City = grp.Select(u => u.City).FirstOrDefault(),
)
.ToList();
where can I use my "Parse" into your code?
– 4est
Mar 27 at 12:43
@4est Just place the code after usingParse
mathod
– Michał Turczyn
Mar 27 at 12:47
can you please show me it (with my Parse) ?
– 4est
Mar 27 at 13:21
@4est See update
– Michał Turczyn
Mar 27 at 13:29
you have twiceToList()
, please remove first.....but I have tested and working great, thanks!
– 4est
Mar 27 at 13:38
|
show 4 more comments
You can use MoreLINQ-NuGet-package, there is useful DistinctBy-function:
MyUsers = File.ReadAllLines(path)
.Where(linia => linia.Length > 1)
.Select(line => Parse(line))
.OrderByDescending(r => r.ReadTime)
.DistinctBy(r => new r.City, r.FirstName, r.idUser, r.LastName )
.ToList();
MoreLinq - this is NuGet pack?
– 4est
Mar 27 at 12:40
Yes, you can find it from Nuget
– Risto M
Mar 27 at 12:41
thanks, working great
– 4est
Mar 27 at 12:55
Great, then upvote and accept :)
– Risto M
Mar 27 at 12:56
2
need to test other answers first :)
– 4est
Mar 27 at 12:57
add a comment |
We can GroupBy
and find Max
date for each group:
IEnumerable<string> result = File
.ReadLines(path)
.Where(line => !string.IsNullOrWhiteSpace(line)) // to be on the safe side
.Select(line =>
int p = line.IndexOf(')
.GroupBy(item => item.key, item => item.date)
.Select(chunk => string.Join("|", chunk.Key, chunk.Max(item => item)));
Having filtered out duplicates we can then parse into a collection:
MyUsers = result
.Select(line => Parse(line))
.ToList();
your code is working as well, thanks!
– 4est
Mar 27 at 13:25
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377038%2ftake-unique-records-from-text-file-using-linq%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could try with simple GroupBy
method:
MyUsers = File.ReadAllLines(path)
.Where(linia => linia.Length > 1)
.Select(line => Parse(line))
.GroupBy(
u => u.idUser,
(key, grp) => new User()
ReadTime = grp.Select(u => u.ReadTime).Max(),
idUser = key,
LastName = grp.Select(u => u.LastName).FirstOrDefault(),
FirstName = grp.Select(u => u.FirstName).FirstOrDefault(),
City = grp.Select(u => u.City).FirstOrDefault(),
)
.ToList();
where can I use my "Parse" into your code?
– 4est
Mar 27 at 12:43
@4est Just place the code after usingParse
mathod
– Michał Turczyn
Mar 27 at 12:47
can you please show me it (with my Parse) ?
– 4est
Mar 27 at 13:21
@4est See update
– Michał Turczyn
Mar 27 at 13:29
you have twiceToList()
, please remove first.....but I have tested and working great, thanks!
– 4est
Mar 27 at 13:38
|
show 4 more comments
You could try with simple GroupBy
method:
MyUsers = File.ReadAllLines(path)
.Where(linia => linia.Length > 1)
.Select(line => Parse(line))
.GroupBy(
u => u.idUser,
(key, grp) => new User()
ReadTime = grp.Select(u => u.ReadTime).Max(),
idUser = key,
LastName = grp.Select(u => u.LastName).FirstOrDefault(),
FirstName = grp.Select(u => u.FirstName).FirstOrDefault(),
City = grp.Select(u => u.City).FirstOrDefault(),
)
.ToList();
where can I use my "Parse" into your code?
– 4est
Mar 27 at 12:43
@4est Just place the code after usingParse
mathod
– Michał Turczyn
Mar 27 at 12:47
can you please show me it (with my Parse) ?
– 4est
Mar 27 at 13:21
@4est See update
– Michał Turczyn
Mar 27 at 13:29
you have twiceToList()
, please remove first.....but I have tested and working great, thanks!
– 4est
Mar 27 at 13:38
|
show 4 more comments
You could try with simple GroupBy
method:
MyUsers = File.ReadAllLines(path)
.Where(linia => linia.Length > 1)
.Select(line => Parse(line))
.GroupBy(
u => u.idUser,
(key, grp) => new User()
ReadTime = grp.Select(u => u.ReadTime).Max(),
idUser = key,
LastName = grp.Select(u => u.LastName).FirstOrDefault(),
FirstName = grp.Select(u => u.FirstName).FirstOrDefault(),
City = grp.Select(u => u.City).FirstOrDefault(),
)
.ToList();
You could try with simple GroupBy
method:
MyUsers = File.ReadAllLines(path)
.Where(linia => linia.Length > 1)
.Select(line => Parse(line))
.GroupBy(
u => u.idUser,
(key, grp) => new User()
ReadTime = grp.Select(u => u.ReadTime).Max(),
idUser = key,
LastName = grp.Select(u => u.LastName).FirstOrDefault(),
FirstName = grp.Select(u => u.FirstName).FirstOrDefault(),
City = grp.Select(u => u.City).FirstOrDefault(),
)
.ToList();
edited Mar 27 at 14:25
answered Mar 27 at 12:32
Michał TurczynMichał Turczyn
19.8k13 gold badges24 silver badges42 bronze badges
19.8k13 gold badges24 silver badges42 bronze badges
where can I use my "Parse" into your code?
– 4est
Mar 27 at 12:43
@4est Just place the code after usingParse
mathod
– Michał Turczyn
Mar 27 at 12:47
can you please show me it (with my Parse) ?
– 4est
Mar 27 at 13:21
@4est See update
– Michał Turczyn
Mar 27 at 13:29
you have twiceToList()
, please remove first.....but I have tested and working great, thanks!
– 4est
Mar 27 at 13:38
|
show 4 more comments
where can I use my "Parse" into your code?
– 4est
Mar 27 at 12:43
@4est Just place the code after usingParse
mathod
– Michał Turczyn
Mar 27 at 12:47
can you please show me it (with my Parse) ?
– 4est
Mar 27 at 13:21
@4est See update
– Michał Turczyn
Mar 27 at 13:29
you have twiceToList()
, please remove first.....but I have tested and working great, thanks!
– 4est
Mar 27 at 13:38
where can I use my "Parse" into your code?
– 4est
Mar 27 at 12:43
where can I use my "Parse" into your code?
– 4est
Mar 27 at 12:43
@4est Just place the code after using
Parse
mathod– Michał Turczyn
Mar 27 at 12:47
@4est Just place the code after using
Parse
mathod– Michał Turczyn
Mar 27 at 12:47
can you please show me it (with my Parse) ?
– 4est
Mar 27 at 13:21
can you please show me it (with my Parse) ?
– 4est
Mar 27 at 13:21
@4est See update
– Michał Turczyn
Mar 27 at 13:29
@4est See update
– Michał Turczyn
Mar 27 at 13:29
you have twice
ToList()
, please remove first.....but I have tested and working great, thanks!– 4est
Mar 27 at 13:38
you have twice
ToList()
, please remove first.....but I have tested and working great, thanks!– 4est
Mar 27 at 13:38
|
show 4 more comments
You can use MoreLINQ-NuGet-package, there is useful DistinctBy-function:
MyUsers = File.ReadAllLines(path)
.Where(linia => linia.Length > 1)
.Select(line => Parse(line))
.OrderByDescending(r => r.ReadTime)
.DistinctBy(r => new r.City, r.FirstName, r.idUser, r.LastName )
.ToList();
MoreLinq - this is NuGet pack?
– 4est
Mar 27 at 12:40
Yes, you can find it from Nuget
– Risto M
Mar 27 at 12:41
thanks, working great
– 4est
Mar 27 at 12:55
Great, then upvote and accept :)
– Risto M
Mar 27 at 12:56
2
need to test other answers first :)
– 4est
Mar 27 at 12:57
add a comment |
You can use MoreLINQ-NuGet-package, there is useful DistinctBy-function:
MyUsers = File.ReadAllLines(path)
.Where(linia => linia.Length > 1)
.Select(line => Parse(line))
.OrderByDescending(r => r.ReadTime)
.DistinctBy(r => new r.City, r.FirstName, r.idUser, r.LastName )
.ToList();
MoreLinq - this is NuGet pack?
– 4est
Mar 27 at 12:40
Yes, you can find it from Nuget
– Risto M
Mar 27 at 12:41
thanks, working great
– 4est
Mar 27 at 12:55
Great, then upvote and accept :)
– Risto M
Mar 27 at 12:56
2
need to test other answers first :)
– 4est
Mar 27 at 12:57
add a comment |
You can use MoreLINQ-NuGet-package, there is useful DistinctBy-function:
MyUsers = File.ReadAllLines(path)
.Where(linia => linia.Length > 1)
.Select(line => Parse(line))
.OrderByDescending(r => r.ReadTime)
.DistinctBy(r => new r.City, r.FirstName, r.idUser, r.LastName )
.ToList();
You can use MoreLINQ-NuGet-package, there is useful DistinctBy-function:
MyUsers = File.ReadAllLines(path)
.Where(linia => linia.Length > 1)
.Select(line => Parse(line))
.OrderByDescending(r => r.ReadTime)
.DistinctBy(r => new r.City, r.FirstName, r.idUser, r.LastName )
.ToList();
edited Mar 27 at 12:41
answered Mar 27 at 12:36
Risto MRisto M
2,1796 silver badges21 bronze badges
2,1796 silver badges21 bronze badges
MoreLinq - this is NuGet pack?
– 4est
Mar 27 at 12:40
Yes, you can find it from Nuget
– Risto M
Mar 27 at 12:41
thanks, working great
– 4est
Mar 27 at 12:55
Great, then upvote and accept :)
– Risto M
Mar 27 at 12:56
2
need to test other answers first :)
– 4est
Mar 27 at 12:57
add a comment |
MoreLinq - this is NuGet pack?
– 4est
Mar 27 at 12:40
Yes, you can find it from Nuget
– Risto M
Mar 27 at 12:41
thanks, working great
– 4est
Mar 27 at 12:55
Great, then upvote and accept :)
– Risto M
Mar 27 at 12:56
2
need to test other answers first :)
– 4est
Mar 27 at 12:57
MoreLinq - this is NuGet pack?
– 4est
Mar 27 at 12:40
MoreLinq - this is NuGet pack?
– 4est
Mar 27 at 12:40
Yes, you can find it from Nuget
– Risto M
Mar 27 at 12:41
Yes, you can find it from Nuget
– Risto M
Mar 27 at 12:41
thanks, working great
– 4est
Mar 27 at 12:55
thanks, working great
– 4est
Mar 27 at 12:55
Great, then upvote and accept :)
– Risto M
Mar 27 at 12:56
Great, then upvote and accept :)
– Risto M
Mar 27 at 12:56
2
2
need to test other answers first :)
– 4est
Mar 27 at 12:57
need to test other answers first :)
– 4est
Mar 27 at 12:57
add a comment |
We can GroupBy
and find Max
date for each group:
IEnumerable<string> result = File
.ReadLines(path)
.Where(line => !string.IsNullOrWhiteSpace(line)) // to be on the safe side
.Select(line =>
int p = line.IndexOf(')
.GroupBy(item => item.key, item => item.date)
.Select(chunk => string.Join("|", chunk.Key, chunk.Max(item => item)));
Having filtered out duplicates we can then parse into a collection:
MyUsers = result
.Select(line => Parse(line))
.ToList();
your code is working as well, thanks!
– 4est
Mar 27 at 13:25
add a comment |
We can GroupBy
and find Max
date for each group:
IEnumerable<string> result = File
.ReadLines(path)
.Where(line => !string.IsNullOrWhiteSpace(line)) // to be on the safe side
.Select(line =>
int p = line.IndexOf(')
.GroupBy(item => item.key, item => item.date)
.Select(chunk => string.Join("|", chunk.Key, chunk.Max(item => item)));
Having filtered out duplicates we can then parse into a collection:
MyUsers = result
.Select(line => Parse(line))
.ToList();
your code is working as well, thanks!
– 4est
Mar 27 at 13:25
add a comment |
We can GroupBy
and find Max
date for each group:
IEnumerable<string> result = File
.ReadLines(path)
.Where(line => !string.IsNullOrWhiteSpace(line)) // to be on the safe side
.Select(line =>
int p = line.IndexOf(')
.GroupBy(item => item.key, item => item.date)
.Select(chunk => string.Join("|", chunk.Key, chunk.Max(item => item)));
Having filtered out duplicates we can then parse into a collection:
MyUsers = result
.Select(line => Parse(line))
.ToList();
We can GroupBy
and find Max
date for each group:
IEnumerable<string> result = File
.ReadLines(path)
.Where(line => !string.IsNullOrWhiteSpace(line)) // to be on the safe side
.Select(line =>
int p = line.IndexOf(')
.GroupBy(item => item.key, item => item.date)
.Select(chunk => string.Join("|", chunk.Key, chunk.Max(item => item)));
Having filtered out duplicates we can then parse into a collection:
MyUsers = result
.Select(line => Parse(line))
.ToList();
edited Mar 27 at 13:33
answered Mar 27 at 12:42
Dmitry BychenkoDmitry Bychenko
121k14 gold badges115 silver badges149 bronze badges
121k14 gold badges115 silver badges149 bronze badges
your code is working as well, thanks!
– 4est
Mar 27 at 13:25
add a comment |
your code is working as well, thanks!
– 4est
Mar 27 at 13:25
your code is working as well, thanks!
– 4est
Mar 27 at 13:25
your code is working as well, thanks!
– 4est
Mar 27 at 13:25
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377038%2ftake-unique-records-from-text-file-using-linq%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
look at this stackoverflow.com/questions/16076805/linq-distinct-max
– apomene
Mar 27 at 12:22