Performance and Memory

Always enable Option Strict On. Late binding and implicit conversions are slow.

Prefer AndAlso/OrElse (short-circuit) and TryParse over exception-driven logic.

Use StringBuilder for string building in loops. Use String.Join and interpolation wisely.

Choose the right collection: List(Of T) over ArrayList, Dictionary for lookups, HashSet for membership tests. Pre-size capacity (New List(Of T)(1000)).

Avoid boxing (value types stored as Object). Use generics.

Cache expensive results. Avoid repeated LINQ enumeration (.ToList() once). Be careful with Count() on IEnumerable inside loops.

Use Async I/O for scalability. Use Parallel/PLINQ for CPU-bound work.

Dispose resources promptly (Using). Unsubscribe events. Avoid large Shared caches.

Database: parameterized queries (plan reuse), only select the needed columns, use indexes, AsNoTracking in EF, batch operations, connection pooling (automatic).

WinForms: SuspendLayout/ResumeLayout, DataGridView virtual mode for big data, BeginUpdate/EndUpdate for ListBox/ListView/TreeView, double buffering for custom drawing.

Consider disabling integer overflow checks only for proven hot paths (<RemoveIntegerChecks>).

Measure first: VS Profiler, Stopwatch, BenchmarkDotNet.