C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » C# Syntax »

String comparison


Posted Date: 05 Nov 2008    Resource Type: Code Snippets    Category: C# Syntax
Author: Abhijeet KumarMember Level: Gold    
Rating: 1 out of 5Points: 5



Strings has always been my favourite topic and given the shance i can keep talking about them for hours.

In this string comparison has been my favourite, because every develope at one time or another needs to perform String comparison and most of the times does it the wrong way.

During my code reviews this the item which have seen maximum times,


if(textbox1.Text.Trim().ToLower() == "ABC")
{
//Do Something
}


I can bet maximum number of people make this mistake without realizing that they have just created an extra string object and added to the workload of GC.

The better approach for doing this is use inbuild compare method.


string.Compare(string1,string2,false);



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
String Comparison  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: C#:Cross Language Assembly Implementation
Previous Resource: Protected Members
Return to Discussion Resource Index
Post New Resource
Category: C# Syntax


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use