Muhammad Waseem Profile picture
Feb 27 ā€¢ 8 tweets ā€¢ 2 min read
šŸ’” Do and Don't for string in C#

1. Always use
2. Don't use šŸ”

āœ‰ļøIf you like my tweets, please join 400+ Software Engineers to receive an actionable tip weekly in your inbox through my Newsletter.(lnkd.in/d69Va5CM)

#csharpĀ #dotnetĀ #dotnetcore
āœ…Use an overload of theĀ String.EqualsĀ method to test whether two strings are equal

āœ…Use theĀ String.CompareĀ andĀ String.CompareToĀ methods to sort strings, not to check for equality.
āœ…Use overloads that explicitly specify the string comparison rules for string operations. Typically, this involves calling a method overload that has a parameter of typeĀ StringComparison.
āœ…Use theĀ String.ToUpperInvariantĀ method instead of theĀ String.ToLowerInvariantĀ method when you normalize strings for comparison.
āœ…Use the non linguisticĀ StringComparisonOrdinalĀ orĀ StringComparison OrdinalIgnoreCaseĀ values instead of string operations based onĀ CultureInfo.InvariantCultureĀ when the comparison is linguistically irrelevant (symbolic, for example)
āœ…UseĀ StringComparison.OrdinalĀ orĀ StringComparison.OrdinalIgnoreCaseĀ for comparisons as your safe default for culture-agnostic string matching and better performance
āŒDon't use overloads that don't explicitly or implicitly specify the string comparison rules for string operations.

āŒDon't use string operations based onĀ StringComparison.InvariantCultureĀ in most cases.
āŒDon't use an overload of theĀ String.CompareĀ orĀ CompareToĀ method and test for a return value of zero to determine whether two strings are equal.

ā€¢ ā€¢ ā€¢

Missing some Tweet in this thread? You can try to force a refresh
怀

Keep Current with Muhammad Waseem

Muhammad Waseem Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @mwaseemzakir

Feb 26
Method Safety and Idempotency

1. HTTP Methods Introduction
2. Method safety with examples
3. Method Idempotency with examples
šŸ§µā¬

#csharp #dotnet #dotnetcore Image
GET is used to retrieve data, POST is used to save, PUT is used to update existing data edit is common example of it, PATCH is lighter version of PUT , it is used to update just a specific information instead of updating all data on server DELETE is used to remove records.
In CRUD operations

C stands for create : POST
R stands for read : GET
U stands for update : PUT/PATCH
D stands for delete : DELETE
Read 9 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(