Question : Retrieve a list of unique values from a list object

Hello,
The following code returns a datatable that is in the following format
Subprogram                       MetricName
ETH                                            A
ETH                                            B
PCH                                            A
PCH                                           B
PCH                                           C
I now need to find some way to extract the unique metricname, to be used in other code to generate another list.  Do I use LINQ for this.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
Public Shared Function GetMetricList(ByVal metriclist As List(Of Metrics)) As DataTable
        Dim dset As New DataSet("MyDataSet")
        Dim ResultTable As New DataTable
        Dim CnSql As SqlConnection = BadsDB.GetConnection
        Dim cmdA As SqlCommand
        cmdA = New SqlCommand("[up_GetSelectedMetrics]", CnSql)
        cmdA.CommandType = CommandType.StoredProcedure
        cmdA.CommandTimeout = 7200
        Dim dTable As New DataTable
        Try
            CnSql.Open()
            For Each m As Metrics In metriclist
                With cmdA
                    .Parameters.Clear()
                    .Parameters.AddWithValue("@TSC", m.Technology.ToString)
                End With
                Dim dAdp As New SqlDataAdapter(cmdA)
                dAdp.Fill(dTable)
                dAdp.Dispose()
            Next

        Catch excA As SqlException
            MsgBox(excA.Message, excA.GetType.ToString)
        Finally
            CnSql.Close()
        End Try

        Return dTable

Answer : Retrieve a list of unique values from a list object

Random Solutions  
 
programming4us programming4us