Skip to content

C# ‐ Coding Standards, Principles, Practices

Full Stack edited this page May 18, 2025 · 1 revision

Practices

Remove Redundant State

  • Avoid storing inbound parameter objects as fields inside the implementation class. Instead, pass them as method parameters. This makes the class stateless and thread-safe.

Extract Common Logic

  • Move validation and transformation logic to reusable static methods or helper classes if they are shared across rules.

Reduce Logging Noise

  • Log only errors or important milestones, not every step, unless needed for debugging.

Use Expression-bodied Members

  • For simple property getters.

Minimize Exception Handling

  • Let exceptions bubble up unless you need to add context or handle specific cases.
Clone this wiki locally