how to use Distinct in LinqJS?

2

(In order to Enlarge images Please Right Click and Open images in New Tab).

The Distinct() function is little different than one in C#. In LinqJS, you would pass in the predicate to the Distinct() function while in C#, you would call Distinct() after another method.

C#.Net Code

var  data = myArray.Select(x => x.Name).Distinct();

LinqJS Code

// Get non-duplicate objects.
var data = Enumerable.From(myArray).Distinct(function (x) { return x.Name; }).Select(function (a) { return a; }).ToArray();

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s