.NET API Collections
Explore the comprehensive collection of APIs available within the .NET framework. This section provides detailed documentation for various namespaces and classes, enabling you to build robust and efficient applications.
Core .NET Namespaces
- SystemBase types, arrays, etc.
- System.CollectionsInterfaces and classes defining collection objects.
- System.Collections.GenericInterfaces and classes that define generic collection types.
- System.IOTypes for reading and writing files and data streams.
- System.NetProvides a programming model for network applications.
- System.ThreadingSupport for multithreaded applications.
System Namespace
The System
namespace is the root namespace for most .NET types. It contains fundamental classes and base types that all programs use, such as the Object
class, basic data types (Int32
, String
, etc.), exceptions, and core system services.
Key Classes:
Object
: The ultimate base class of all classes in the .NET Framework.String
: Represents text as a sequence of characters.Int32
,Double
,Boolean
: Primitive data types.Exception
: Base class for all exceptions.
System.Collections Namespace
This namespace contains interfaces and classes that define collection objects, which are user-defined collections of related objects. These are non-generic collections.
Key Interfaces:
ICollection
: Implements the basic contract for collections.IEnumerable
: Implements the enumerator, which supports a simple iteration over a non-generic collection.IList
: Represents a non-generic collection of objects that can be individually accessed by index.
Key Classes:
ArrayList
: A dynamic array that can grow as needed.Hashtable
: A collection of key/value pairs.Queue
: Represents a first-in, first-out (FIFO) collection of objects.Stack
: Represents a last-in, first-out (LIFO) collection of objects.
Common Types:
System.Collections.Generic Namespace
This namespace provides interfaces and classes that define generic collection types, which allow developers to create strongly typed collections. This improves type safety and performance.
Key Interfaces:
IEnumerable<T>
: Represents a generic collection that can be enumerated.ICollection<T>
: Represents a strongly typed collection of objects.IList<T>
: Represents a generic collection of objects that can be individually accessed by index.IDictionary<TKey, TValue>
: Represents a generic collection of key/value pairs.
Key Classes:
List<T>
: A strongly typed list of objects that can be accessed by index.Dictionary<TKey, TValue>
: A generic collection of key/value pairs.Queue<T>
: Represents a generic first-in, first-out (FIFO) collection of objects.Stack<T>
: Represents a generic last-in, first-out (LIFO) collection of objects.HashSet<T>
: A set implementation that uses hashing.
System.IO Namespace
The System.IO
namespace contains types that allow you to read and write files and data streams, and to interact with the file system.
Key Classes:
File
: Provides static methods for creating, copying, deleting, moving, and opening files.Directory
: Provides static methods for creating, moving, and enumerating through directories and subdirectories.Stream
: An abstract base class for all streams.StreamReader
: Reads characters from a stream in a particular encoding.StreamWriter
: Writes characters to a stream in a particular encoding.
Common Types:
System.Net Namespace
This namespace provides a programming model for network applications. It includes types for working with network protocols, resolving host names, and sending and receiving data over the network.
Key Classes:
IPAddress
: Represents an Internet Protocol (IP) address.Dns
: Provides services for resolving Domain Name System (DNS) host names.TcpClient
: Provides client connections for the TCP protocol.HttpWebRequest
: Makes it possible to use Uniform Resource Locators (URLs) to send data to or accept data from a resource that is identified by the URL.
Common Types:
System.Threading Namespace
The System.Threading
namespace provides classes and interfaces that support multithreaded programming.
Key Classes:
Thread
: Represents a thread of execution in a process.Mutex
: Represents a thread-safe way to wait for a resource that is provided by another thread.Monitor
: Provides static methods for synchronizing the execution of threads.CancellationTokenSource
: Represents the token that can be used to request cancellation.