Click here to Skip to main content
16,011,711 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
please explain the follwing bool function. I cannot comprehend it as i have little knowlege of programming. Please explain in simple and easy way.
Thanks
C#
private bool CompareStrings(string string1, string string2)
    {
      return String.Compare(string1, string2, true, System.Globalization.CultureInfo.InvariantCulture) == 0 ? true : false;
    }
Posted

Look here:
String.Compare[^]
?: Operator[^]

Please buy a book and read the basics before starting programming. Or read online on MSDN or any site that suits you. You are asking too many basic questions - flooding with such questions out here is not good.
 
Share this answer
 
touseef4pk wrote:
System.Globalization.CultureInfo.InvariantCulture


This part looks like you will be comparing two strngs and seeing if they are the same when the diffences from a country to country basis is applied.
(Eg date formats, or .'s over ,s' for 1000 separators.)

Returning True if the same and False if not.
 
Share this answer
 
This function is comparing 2 strings and returning boolean value.

String.Compare returns 0 if both strings are equal, -1 if 1st string is less than 2nd and 1 if 1st is greater than 2nd.

P.S.: If you have little programming knowledge then why not increase it by reading a book. :)

DD says... to be fair, he at least provided code, and in a tag, so be not too harsh, some of the questioners here are more cryptic than my CCC's.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900