8

Working with Common .NET Types

This chapter is about some common types that are included with .NET. These include types for manipulating numbers, text, and collections; improving working with spans, indexes, and ranges; and in an optional online-only section, working with network resources.

This chapter covers the following topics:

  • Working with numbers
  • Working with text
  • Pattern matching with regular expressions
  • Storing multiple objects in collections
  • Working with spans, indexes, and ranges

Working with numbers

One of the most common types of data is numbers. The most common types in .NET for working with numbers are shown in Table 8.1:

Namespace

Example type(s)

Description

System

SByte, Int16, Int32, Int64, Int128

Integers; ...

Get C# 12 and .NET 8 – Modern Cross-Platform Development Fundamentals - Eighth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.