Very simple string.Compare(str1,str2) // 6 overloads
string.Equals(str1,str2) // 2 overloads Charles Carroll <[EMAIL PROTECTED]> wrote: http://dotnetjunkies.com/WebLog/chris.taylor/archive/2004/05/18/13927.aspx has some good data on the subject for 1.1 On 10/13/05, Jim Brinkman wrote: > > Here's my code that a co worker suggested I change to use the > string.Equals() method to compare instead. > > > > if(dropDownListCheckInStatus.Items[x].Value.ToString() == > dataRow["CheckInStatusID"].ToString()) > > { > > // > > } > > > > I searched and found that all these methods work for comparison but what is > the best or more efficient? > > > > // String comparison > string mascot = "Bisons"; > if (mascot == "Bisons") // true > if (mascot.Equals("Bisons")) // true > if (mascot.ToUpper().Equals("BISONS")) // true > if (mascot.CompareTo("Bisons") == 0) // true Yahoo! Groups Links Arindam Chakraborty Software Developer, Mumbai, India --------------------------------- Yahoo! India Matrimony: Find your partner now. [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/saFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
