I'm a beginner in C# so I have a question, I have a lot of names in my database my question is how can I make script that shows the data of names with no doubles in LINQ? Here an example:
string[] names = {hello, hello, stack, stack, overflow, overflow};
I have no idea how to do this can someone create a simple script that shows it how to do. I can solve the rest myself.
Here you go:
string[] names = {"hello", "hello", "stack", "stack", "overflow", "overflow"};
var distinctNames = names.Distinct();
foreach(String distinctName in distinctNames)
Console.WriteLine(distinctName);
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