.NET Framework Core Libraries

The .NET Framework core libraries provide a rich set of fundamental types, interfaces, and classes that can be used by all applications developed with the .NET Framework. These libraries, also known as the Base Class Library (BCL), form the foundation for building robust and scalable applications.

Key Components

The BCL is organized into namespaces, with the most fundamental types residing in the System namespace. Other important namespaces include:

The System Namespace

The System namespace is the root namespace for most .NET Framework types. It contains fundamental types such as:

Example: Working with Strings

Here's a simple example demonstrating string manipulation using classes from the System namespace:

using System;

public class StringExample
{
    public static void Main(string[] args)
    {
        string message = "Hello, .NET Framework!";
        string upperMessage = message.ToUpper();
        string lowerMessage = message.ToLower();
        int length = message.Length;

        Console.WriteLine($"Original: {message}");
        Console.WriteLine($"Uppercase: {upperMessage}");
        Console.WriteLine($"Lowercase: {lowerMessage}");
        Console.WriteLine($"Length: {length}");

        if (message.Contains(".NET"))
        {
            Console.WriteLine("The message contains '.NET'.");
        }
    }
}

Example: Using Collections

This example shows how to use a generic list from the System.Collections.Generic namespace:

using System;
using System.Collections.Generic;

public class ListExample
{
    public static void Main(string[] args)
    {
        List<string> fruits = new List<string>();
        fruits.Add("Apple");
        fruits.Add("Banana");
        fruits.Add("Orange");

        Console.WriteLine("Fruits in the list:");
        foreach (string fruit in fruits)
        {
            Console.WriteLine($"- {fruit}");
        }

        Console.WriteLine($"Total fruits: {fruits.Count}");
    }
}

Importance of BCL

The Base Class Library is crucial for .NET development because it:

Understanding and effectively utilizing the .NET Framework core libraries is essential for any .NET developer.