How to return Distinct values from List in c#.net
I have below methods , I am not able to return list , please correct me below methods , how write correct methodpublic List<string> GetOwners()
{
//string[] owners = { "dqvu@chevron.com", "prja@chevron.com", "prja@chevron.com" };
// return owners.Distinct().ToArray();
List<string> b = new List<string>();
List<string> DistinctNames;
using (OracleConnection con = new OracleConnection(connectionString()))
{
con.Open();
string OrclStr = "SELECT OWNER_ID || '@chevron.com' as owners FROM DOCSADM.SAS_GROUP_OWNER";
OracleCommand cmd = new OracleCommand(OrclStr, con);
cmd.CommandType = CommandType.Text;
OracleDataReader r = cmd.ExecuteReader();
while (r.Read())
{
b.Add(Convert.ToString(r["owners"]));
DistinctNames = b.Distinct().ToList();
}
}
return DistinctNames;
}