.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Linq query to get the distinct values in a string array

Posted By: Deco     Posted Date: January 20, 2012    Points:5   Category :C#
Please get me the C# code with Linq to get the distinct values in a string array

Responses
Author: Syed Shakeer Hussain             
Posted Date: January 23, 2012     Points: 20   

Hi,
Use the below code to get Distinct Values from String Array
           String [] strdata={"Shakeer","Shakeer","Hussain"};

IEnumerable<string> Strquery = strdata.Distinct();

foreach (string s in Strquery)
{
Console.WriteLine(s);
}




Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend