Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 12345 |  Welcome, Guest!   Register  Login
 Home > Forums > C# > Compare Array String using C#.net ...
Naraayanan

Compare Array String using C#.net

Replies: 2 | Posted by: Naraayanan on 6/12/2012 | Category: C# Forums | Views: 1182 | Status: [Member] | Points: 10  


Hi,
How to compare two array string using C#.net?
Eg:

 string[] com1 = { "COM6", "COM7" };

string[] com2 = { "COM6", "COM7","COM8" };


Here com1 and com2 are Array string.
Result:
COM8.
How to achieve this?

Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Naraayanan
Naraayanan  
Posted on: 6/12/2012 2:11:35 AM
Level: Starter | Status: [Member] | Points: 25

Hi friends,
I solve my problem. This is a solution.
 foreach (string com in com2 )

{
if (!com1.Contains(com))
{
MessageBox.Show(com);
}
}



Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

Naraayanan, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Ajay.Kalol
Ajay.Kalol  
Posted on: 6/12/2012 2:14:00 AM
Level: Starter | Status: [Member] | Points: 25

 string[] com1 = { "COM6", "COM7" };


string[] com2 = { "COM6", "COM7", "COM8" };

for (int i = 0; i < com1.Length; i++)
{
for (int j = 0; j < com2.Length; j++)
{
if (com1.ToString() == com2[j].ToString())
{
// Do yours code
}
}
}


http://ajaypatelfromsanthal.blogspot.in

Naraayanan, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

Found interesting? Add this to:


 Latest Posts

Write New Post | More ...

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/18/2013 11:33:44 PM