Need to find code?
Use search.
Ctrl + F works especially well when what you're looking for includes text.
Follow for more advanced engineering techniques.
#DevTips#Programming#Coding
How to avoid an infinite loop:
Make sure the loop eventually stops.
If the condition stays true forever, the loop has no strong reason to disagree.
#DevTips#Programming#Coding
Need to know whether a collection contains an item?
Use Contains.
It returns true when the collection contains the item.
Software engineering is full of hidden knowledge like this.
#DevTips#Programming#Coding
Need to remove data from a database?
Use DELETE.
Common examples:
DELETE removes rows
WHERE specifies which rows
No WHERE means all rows
Transactions help protect changes
ROLLBACK helps when something goes wrong
#SQL#DevTips
How to Improve Code Quality
Common techniques:
- Remove unused code
- Use better names
- Reduce duplication
- Simplify logic
- Fix bugs
Code quality often improves after these changes.
What is your favorite refactoring technique?
#devtips#dotnet#charp#codequality
How to Prevent NullReferenceException
A NullReferenceException occurs when an object is null.
Possible solutions:
Check for null
Avoid null values
Initialize objects
Use nullable reference types
Handle exceptions
#dotnet#dotnettips#csharp#null