Hi Guys,
I have been trying to return 2 elements from a list by a distinct value, however with the code I have at the moment i am not getting a distinct value returned, probably due to query being unable to return uniqueness with 2 elements of the list.<br>
The example of what I am trying to do is as follows.
I have a class test1 with members ele1,ele2,ele3
I have applied the following values
I follow this with the following query on the structure
This does not return the unique structures as I wanted, it returns all objects within myT, where as I was hoping to return just the 1st and 2nd objects(x) and ignore the 3rd as it is already found in the 1st object.
any help appreciated guys
I have been trying to return 2 elements from a list by a distinct value, however with the code I have at the moment i am not getting a distinct value returned, probably due to query being unable to return uniqueness with 2 elements of the list.<br>
The example of what I am trying to do is as follows.
I have a class test1 with members ele1,ele2,ele3
I have applied the following values
VB.NET:
Dim myT As New List(Of test1)
Dim x As New test1 With {.ele1 = "blah", .ele2 = "blah2", .ele3 = "blah3"}
myT.Add(x)
x = New test1 With {.ele1 = "nomatch", .ele2 = "nomatch2", .ele3 = "test"}
myT.Add(x)
x = New test1 With {.ele1 = "blah", .ele2 = "blah2", .ele3 = "blah3"}
myT.Add(x)
I follow this with the following query on the structure
VB.NET:
Dim fs2 = (From f In myT _
Select {f.ele1, f.ele2}).Distinct
This does not return the unique structures as I wanted, it returns all objects within myT, where as I was hoping to return just the 1st and 2nd objects(x) and ignore the 3rd as it is already found in the 1st object.
any help appreciated guys