Hi,I have a text file in which there are many s.no.I have passed these s.no in draw(variable),its variable type is string.I want only distinct s.no how to do it.
TIA
I want distinct values from 1 column
Thanks
First after readin text …use generate datatable and get a datatable out of it
Then dt.AsEnumerable.Select(function(x) x(0).ToString).Distinct.ToArray
can be used to get all distinct values as array
it shows lamba expression cannot be converted into string because string cannot be converted into delegate type
@Cuberoot try to add simpler kinds of data, Hope it helps you solve your issue.
string data = @"2..2.2.1 00 10 11
2..2.2.1 00 10 10
2..2.2.1 00 10 11
2..2.2.1 00 10 11";
string[] lines = data.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
IEnumerable<string> distinctNumbers = lines.Distinct();
foreach (string number in distinctNumbers)
{
Console.WriteLine(number);
}