How to (C#)

In the How to section of the C# Guide, you can find quick answers to common questions. In some cases, articles may be listed in multiple sections. We wanted to make them easy to find for multiple search paths.

General C# concepts

There are several tips and tricks that are common C# developer practices:

Class, record, and struct members

You create classes, records, and structs to implement your program. These techniques are commonly used when writing classes, records, or structs.

Working with collections

These articles help you work with collections of data.

Working with strings

Strings are the fundamental data type used to display or manipulate text. These articles demonstrate common practices with strings.

Convert between types

You may need to convert an object to a different type.

Equality and ordering comparisons

You may create types that define their own rules for equality or define a natural ordering among objects of that type.

Exception handling

.NET programs report that methods did not successfully complete their work by throwing exceptions. In these articles you'll learn to work with exceptions.

Delegates and events

Delegates and events provide a capability for strategies that involve loosely coupled blocks of code.

Events provide a mechanism to publish or subscribe to notifications.

LINQ practices

LINQ enables you to write code to query any data source that supports the LINQ query expression pattern. These articles help you understand the pattern and work with different data sources.

Multiple threads and async processing

Modern programs often use asynchronous operations. These articles will help you learn to use these techniques.

Command line args to your program

Typically, C# programs have command line arguments. These articles teach you to access and process those command line arguments.