Optimization Tips for C# Code

CsharpProgrammingServer Side Programming

The following are the tips −

Prefer List

Use List whenever necessary. Working with ArrayList for the same work can make the working of code slower. This is specially if you are storing multiple types of objects within the same list.

Use multiplication-shift operation

Prefer multiplication-shift operation instead of division operator, since the usage of division operator slows the code.

Less code takes less memory

Try to get work done using operator to concise the code and make it work in a single line.

Use operators like && that would allow you to mention all the conditions in a single line.

Published on 14-Aug-2018 16:10:50