C# (.NET) Standard Library: Complete Overview

Online Python Trainer for Beginners

Learn Python easily without overwhelming theory. Solve practical tasks with automatic checking, get hints in Russian, and write code directly in your browser — no installation required.

Start Course

C# (.NET) Standard Library: Complete Overview



The .NET Standard Library (Base Class Library, BCL) is the fundamental foundation for C# development. It provides thousands of ready-made classes, interfaces, structures, and enumerations that cover virtually all aspects of programming: from working with numbers and strings to network interaction and database access. In this overview, we will look at the key namespaces and their capabilities.



System Namespace: The Foundation



The System namespace contains the basic data types used in all C# applications. These include:



  • Primitive types: Boolean, Byte, Int32, Double, Char, String, and others. Each has methods for conversion, comparison, and formatting.
  • Math class: provides constants (π, e) and static methods for trigonometric, logarithmic, and statistical calculations.
  • Convert class: allows safe type conversion (e.g., string to number).
  • Console class: manages input/output in a console application.


using System;

int a = 42;double b = Math.Sqrt(a);string text = Convert.ToString(a);Console.WriteLine($"The square root of {text} is {b}");


System.Collections and System.Collections.Generic: Working with Collections



These namespaces contain classes for storing and managing groups of objects. Modern applications should use the generic versions from System.Collections.Generic, as they provide type safety and higher performance.



  • List<T> — dynamic array.
  • Dictionary<TKey, TValue> — key-value collection.
  • Queue<T> and Stack<T> — queue and stack implementations.
  • HashSet<T> — set of unique elements.


using System.Collections.Generic;

var numbers = new List<int> { 1, 2, 3, 4, 5 };numbers.Add(6);numbers.Remove(3);

var map = new Dictionary<string, int>{ { "one", 1 }, { "two", 2 }};

if (map.ContainsKey("one")) Console.WriteLine(map["one"]);


System.Linq: Language Integrated Query



LINQ (Language Integrated Query) allows you to query collections, databases, XML, and other data sources using a unified syntax. The main extension methods are defined in the System.Linq namespace:



  • Where — filtering.
  • Select — projection.
  • OrderBy / ThenBy — sorting.
  • GroupBy — grouping.
  • Aggregate, Sum, Count — aggregate operations.


using System.Linq;

int[] scores = { 85, 92, 78, 95, 88 };var highScores = scores .Where(s => s >= 90) .OrderByDescending(s => s) .Select(s => $"Score: {s}");

foreach (var item in highScores) Console.WriteLine(item);


System.IO: Working with the File System and Streams



The System.IO namespace provides classes for reading/writing files, working with directories, and managing data streams. Main classes:



  • File and FileInfo — static and instance methods for working with files.
  • Directory and DirectoryInfo — folder management.
  • StreamReader / StreamWriter — reading and writing text files.

Recommendations