DEV Community

Абдумомин
Абдумомин

Posted on

Compare()

Compare(); - bu metod ikkita satrni solishtiradi:

0 bo'ladi. agar satrlar teng bolsa,
manfiy qiymat bo'ladi, agar birinchi satr ikkinchisidan kichik bo'lsa,
musbat qiymat bo'ladi, agar birinchi satr ikkinchisidan katta bo'lsa.

string text1 = "olma";
string text2 = "banan";
int result = string.Compare(text1, text2);
Console.WriteLine(result);

Bu misolda, olma banan dan kichik, shuning uchun metod manfiy qiymat qaytaradi/.

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more