Knowledgebase

C# Language Essentials for .NET Print

  • microsofttechnology, microsoft, errors, guide, howto, solution, zillionkinghost, hosting
  • 0

Practical language use.

WHAT TO USE FOR DATA CARRIERS

Records, which provide value equality and concise declaration.

WHAT TO ENABLE

Nullable reference types.

WHY

It makes absence explicit in the type system, addressing the commonest runtime error.

WHAT TO USE FOR COLLECTIONS

The standard collections, chosen by the operations you perform.

WHAT THE QUERY FACILITIES PROVIDE

Filtering, projecting and aggregating collections declaratively.

WHAT TO BE CAREFUL WITH

Deferred execution, where a query runs when enumerated rather than when defined.

WHAT THAT CAUSES

Queries executing more than once, or against changed data.

WHAT TO DO ABOUT IT

Materialise explicitly when you need the results.

WHAT THE ASYNCHRONOUS MODEL PROVIDES

Non-blocking operations, written sequentially.

WHAT TO NEVER DO

Block on an asynchronous operation.

WHY

It causes deadlocks and exhausts threads under load.

WHAT TO USE FOR MONEY

The decimal type, never floating point.

WHAT TO USE FOR DISPOSABLE RESOURCES

The construct guaranteeing cleanup.

WHAT TO PREFER

Immutability where practical, and explicit over implicit.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot