Hi venkatg,
Refer below sample.
Namespaces
C#
using System.Data;
using System.Linq;
VB.Net
Imports System.Data
Imports System.Linq
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.Add("Rarity");
dt.Columns.Add("IsDeleted");
dt.Columns.Add("Id");
dt.Rows.Add(1392, 0, 16839);
dt.Rows.Add(1392, 1, 16840);
dt.Rows.Add(1392, 0, 16841);
dt.Rows.Add(1393, 1, 16842);
dt.Rows.Add(1393, 1, 16843);
dt.Rows.Add(1393, 1, 16844);
var zeroRarity = dt.AsEnumerable()
.Where(x => x["IsDeleted"].ToString() == "0")
.Select(x => x["Rarity"]).Distinct();
var result = dt.AsEnumerable()
.Where(x => !zeroRarity.Contains(x["Rarity"])).ToList();
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim dt As DataTable = New DataTable()
dt.Columns.Add("Rarity")
dt.Columns.Add("IsDeleted")
dt.Columns.Add("Id")
dt.Rows.Add(1392, 0, 16839)
dt.Rows.Add(1392, 1, 16840)
dt.Rows.Add(1392, 0, 16841)
dt.Rows.Add(1393, 1, 16842)
dt.Rows.Add(1393, 1, 16843)
dt.Rows.Add(1393, 1, 16844)
Dim zeroRarity = dt.AsEnumerable() _
.Where(Function(x) x("IsDeleted").ToString() = "0") _
.Select(Function(x) x("Rarity")).Distinct()
Dim result = dt.AsEnumerable() _
.Where(Function(x) Not zeroRarity.Contains(x("Rarity"))).ToList()
End Sub