CSHARP_CI Telegram 1484
Не сравнивай строки через .ToLower()

Плохая практика:

bool equal = stringA.ToLower() == stringB.ToLower();


Медленно (каждый раз создаёт новые строки)
Лишние аллокации памяти

Правильный способ:


bool equal = string.Equals(stringA, stringB, StringComparison.OrdinalIgnoreCase);

Без лишних аллокаций
Намного быстрее
Чёткий контроль над правилами сравнения

📊 Бенчмарки:


.ToLower() → ~38 ns

.ToUpper() → ~50 ns

string.Equals(..., OrdinalIgnoreCase) → ~0.003 ns 🚀



tgoop.com/csharp_ci/1484
Create:
Last Update:

Не сравнивай строки через .ToLower()

Плохая практика:


bool equal = stringA.ToLower() == stringB.ToLower();


Медленно (каждый раз создаёт новые строки)
Лишние аллокации памяти

Правильный способ:


bool equal = string.Equals(stringA, stringB, StringComparison.OrdinalIgnoreCase);

Без лишних аллокаций
Намного быстрее
Чёткий контроль над правилами сравнения

📊 Бенчмарки:


.ToLower() → ~38 ns

.ToUpper() → ~50 ns

string.Equals(..., OrdinalIgnoreCase) → ~0.003 ns 🚀

BY C# (C Sharp) programming




Share with your friend now:
tgoop.com/csharp_ci/1484

View MORE
Open in Telegram


Telegram News

Date: |

Your posting frequency depends on the topic of your channel. If you have a news channel, it’s OK to publish new content every day (or even every hour). For other industries, stick with 2-3 large posts a week. Add up to 50 administrators Activate up to 20 bots The initiatives announced by Perekopsky include monitoring the content in groups. According to the executive, posts identified as lacking context or as containing false information will be flagged as a potential source of disinformation. The content is then forwarded to Telegram's fact-checking channels for analysis and subsequent publication of verified information.
from us


Telegram C# (C Sharp) programming
FROM American