I have a C# List of sting which can be x rows long. a small example will be shown below. I would like to know how i would to now how i can get small distinct list so that A doesn't appear multiple time. this list is coming for code. so it random.
list = {a,b,a,f,a,null,a,e,a,e}
Try LINQ .... To be more specific... Given that your list is actually string[] you could do this...
string[] list = {"a","b","a","f","a",null,"a","e","a","e"};
var distinctList = list.Distinct();
foreach (var str in distinctList)//Distinct list of values
{
Console.Write(str);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With