Standard Libraries (CLI)

{{Short description|Standard libraries of C#, the .NET Framework and Core, and related projects}}

{{redirect-distinguish|XML Library|LibXML}}

{{Use mdy dates|date=January 2019}}

{{Use American English|date=January 2019}}

thumb

The Standard Libraries are a set of libraries included in the Common Language Infrastructure (CLI) in order to encapsulate many common functions, such as file reading and writing, XML document manipulation, exception handling, application globalization, network communication, threading, and reflection, which makes the programmer's job easier. It is much larger in scope than standard libraries for most other languages, including C++, and is comparable in scope and coverage to the standard libraries of Java.

The Standard Libraries are the Base Class Library (BCL), Runtime Infrastructure Library (both part of the kernel profile), Network Library, Reflection Library, XML Library (which with the first two listed libraries form the compact profile), Extended Array Library, Parallel Library, Floating Point Library and Vararg Library.

The Framework Class Library (FCL) is the original implementation of the Standard Libraries as the .NET Framework, which includes it, is the first implementation of the CLI.

Profiles

The main standard libraries are organized into two Standard Profiles, the Kernel Profile, and the Compact Profile.{{Cite tech report

|chapter-url= http://ecma-international.org/publications/standards/Ecma-335.htm

|chapter = IV.3 The Standard Profiles

|title = Standard ECMA-335 – Common Language Infrastructure (CLI)

|edition = 6th

|publisher = Ecma International

|date = June 2012

|page = 437

}} The following standard libraries do not belong to any profile: the Extended Array Library, the Extended Numerics Library, the Parallel Library and the Vararg Library.

=Kernel Profile=

The Kernel Profile is a subset of the Compact Profile. The Kernel Profile contains the Base Class Library (BCL) and Runtime Infrastructure Library.{{Cite tech report

|chapter-url= http://ecma-international.org/publications/standards/Ecma-335.htm

|chapter = IV.3.1 The Kernel Profile

|title = Standard ECMA-335 – Common Language Infrastructure (CLI)

|edition = 6th

|publisher = Ecma International

|date = June 2012

|page = 437

}}

=Compact Profile=

The Compact Profile contains those libraries in the Kernel Profile as well as the Network Library, the Reflection Library and the XML Library.{{Cite tech report

|chapter-url= http://ecma-international.org/publications/standards/Ecma-335.htm

|chapter = IV.3.2 The Compact Profile

|title = Standard ECMA-335 – Common Language Infrastructure (CLI)

|edition = 6th

|publisher = Ecma International

|date = June 2012

|page = 437

}}

Libraries

=Base Class Library=

{{See also|List of data types of the Standard Libraries#Base Class Library||label 1=Data types of the Base Class Library}}

The Base Class Library is a simple runtime library for modern programming languages. It serves as the Standard for the runtime library for the language C# as well as one of the CLI Standard Libraries. It provides types to represent the built-in data types of the CLI, simple file access, custom attributes, security attributes, string manipulation, formatting, streams, collections, among other things.{{Cite tech report

|chapter-url= http://ecma-international.org/publications/standards/Ecma-335.htm

|chapter = IV.5.3 Base Class Library (BCL)

|title = Standard ECMA-335 – Common Language Infrastructure (CLI)

|edition = 6th

|publisher = Ecma International

|date = June 2012

|page = 440

}} It defines types in the following namespaces:

class="wikitable"

! Name !! Description

{{code|System}}Defines the Object class which all reference type objects derive from (including value-type objects) and the ValueType class which all value type objects derive from. It also defines the base data types like integers, floating point numbers, character, strings, Boolean, enumeration and more. Support for the environment and platform and a command-line interface is provided along with base classes for exceptions and attributes. It defines arrays and delegates, mathematical functions and many other types.
{{code|System.Collections}}Defines many common container types used in programming, such as dictionaries, hashtables, lists, queues and stacks.
{{code|System.Collections.Generic}}Defines generic types of the container types in the System.Collections namespace.
{{code|System.Diagnostics}}Defines types that provide the ability to diagnose applications. It includes event logging, performance counters, tracing and interaction with system processes.
{{code|System.Globalization}}Defines types that define culture-related information, including language, country/region, calendars in use, format patterns for dates, currency and numbers and sort order for strings.
{{code|System.IO}}Defines type that enable reading from and writing to different streams, such as files or other data streams. Also provides a connection to the file system.
{{code|System.Security}}Defines types that represent the security system and permissions.
{{code|System.Security.Permissions}}Defines types that control access to operations and resources based on policy.
{{code|System.Text}}Defines types that support various character encodings, regular expressions and a more efficient mechanism for manipulating strings.
{{code|System.Threading}}Defines types that enable multithreaded programming.

File:UML dotnet streams.svg

=Runtime Infrastructure Library=

{{See also|List of data types of the Standard Libraries#Runtime Infrastructure Library|label 1=Data types of the Runtime Infrastructure Library}}

The Runtime Infrastructure Library provides the services needed by a compiler to target the CLI and the facilities needed to dynamically load types from a stream in a specified file format.{{Cite tech report

|chapter-url= http://ecma-international.org/publications/standards/Ecma-335.htm

|chapter = IV.5.2 Runtime infrastructure library

|title = Standard ECMA-335 – Common Language Infrastructure (CLI)

|edition = 6th

|publisher = Ecma International

|date = June 2012

|page = 440

}} It defines types in the following namespaces:

class="wikitable"

! Name !! Description

{{code|System}}Defines types for the application domain, pointers, handles and more.
{{code|System.Reflection}}Defines types that provide a managed view of loaded types, methods and fields, and that can dynamically create and invoke types. These types are relevant to the program runtime.
{{code|System.Runtime.CompilerServices}}Defines types that provide functionality for compiler writers who use managed code to specify attributes in metadata that affect the run-time behavior of the Virtual Execution System.
{{code|System.Runtime.InteropServices}}Defines types that support Platform Invocation Services (P/Invoke).

=Network Library=

{{See also|List of data types of the Standard Libraries#Network Library|label 1=Data types of the Network Library}}

The Network Library provides simple networking services including direct access to network ports as well as HTTP support.{{Cite tech report

|chapter-url= http://ecma-international.org/publications/standards/Ecma-335.htm

|chapter = IV.5.4 Network library

|title = Standard ECMA-335 – Common Language Infrastructure (CLI)

|edition = 6th

|publisher = Ecma International

|date = June 2012

|page = 440

}} It defines types in the following namespaces:

class="wikitable"

! Name !! Description

{{code|System}}Defines types that provide an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI.
{{code|System.Collections.Specialized}}Defines specialized and strongly-typed collections; for example, a linked list dictionary, a bit vector, and collections that contain only strings.
{{code|System.Net}}Defines types that provide a simple programming interface for a number of network protocols.
{{code|System.Net.Sockets}}Defines type that provide a managed implementation of the Windows Sockets (Winsock) interface for developers who need to tightly control access to the network.

=Reflection Library=

{{See also|List of data types of the Standard Libraries#Reflection Library|label 1=Data types of the Reflection Library}}

The Reflection Library provides the ability to examine the structure of types, create instances of types and invoke methods on types, all based on a description of the type.{{Cite tech report

|chapter-url= http://ecma-international.org/publications/standards/Ecma-335.htm

|chapter = IV.5.5 Reflection library

|title = Standard ECMA-335 – Common Language Infrastructure (CLI)

|edition = 6th

|publisher = Ecma International

|date = June 2012

|page = 440

}} It defines types in the following namespaces:

class="wikitable"

! Name !! Description

{{code|System}}Defines the void type, a return value type for a method that does not return a value.
{{code|System.Globalization}}Defines type that provide information about a specific culture (called a locale for unmanaged code development). The information includes the names for the culture, the writing system, the calendar used and formatting for dates and sort strings.
{{code|System.Reflection}}Defines types that provide a managed view of loaded types, methods and fields, and that can dynamically create and invoke types.
{{code|System.Security.Permissions}}Defines types that control access to operations and resources based on policy. These types are relevant to the reflection.

=XML Library=

{{See also|List of data types of the Standard Libraries#XML Library|label 1=Data types of the XML Library}}

The XML Library provides a simple "pull-style" parser for XML. It is designed for resource-constrained devices, yet provides a simple user model.{{Cite tech report

|chapter-url= http://ecma-international.org/publications/standards/Ecma-335.htm

|chapter = IV.5.6 XML library

|title = Standard ECMA-335 – Common Language Infrastructure (CLI)

|edition = 6th

|publisher = Ecma International

|date = June 2012

|page = 440

}} It defines types in the following namespace.

class="wikitable"

! Name !! Description

{{code|System.Xml}}Defines types for processing XML.

=Extended Array Library=

{{See also|List of data types of the Standard Libraries#Extended Array Library|label 1=Data types of the Extended Array Library}}

The Extended Array Library provides support for non-vector arrays. That is, arrays that have more than one dimension or

arrays that have non-zero lower bounds.{{Cite tech report

|chapter-url= http://ecma-international.org/publications/standards/Ecma-335.htm

|chapter = IV.5.8 Extended array library

|title = Standard ECMA-335 – Common Language Infrastructure (CLI)

|edition = 6th

|publisher = Ecma International

|date = June 2012

|page = 441

}} The Extended Array Library doesn't add any extra types, but it does extend the array-handling mechanism.{{Cite book

|last1 = King

|first1 = Jason

|last2 = Easton

|first2 = Mark

|year = 2004

|chapter = Chapter 4: The NET Framework Dissected

|editor1-last = Gilmore

|editor1-first = Jason

|title = Cross-Platform .NET Development: Using Mono, Portable.NET, and Microsoft .NET

|publisher = Apress

|page = 110

|isbn = 1-59059-330-8

|lccn = 2004018339

}}

=Extended Numerics Library=

{{See also|List of data types of the Standard Libraries#Extended Numerics Library|label 1=Data types of the Extended Numerics Library}}

The Extended Numerics Library provides support for floating-point (System{{Not a typo|.}}Single, System{{Not a typo|.}}Double) and extended-precision (System{{Not a typo|.}}Decimal) data types. Like the Base Class Library, this library is directly referenced by the C# standard.{{Cite tech report

|chapter-url= http://ecma-international.org/publications/standards/Ecma-335.htm

|chapter = IV.5.7 Extended numerics library

|title = Standard ECMA-335 – Common Language Infrastructure (CLI)

|edition = 6th

|publisher = Ecma International

|date = June 2012

|page = 441

}}

=Parallel Library=

{{See also|List of data types of the Standard Libraries#Parallel Library|label 1=Data types of the Parallel Library}}

The Parallel Library provides easy parallelism for non-expert programmers, so that multithreaded CPUs can be exploited.{{Cite tech report

|chapter-url= http://ecma-international.org/publications/standards/Ecma-335.htm

|chapter = IV.5.10 Parallel library

|title = Standard ECMA-335 – Common Language Infrastructure (CLI)

|edition = 6th

|publisher = Ecma International

|date = June 2012

|page = 441

}}

=Vararg Library=

{{See also|List of data types of the Standard Libraries#Vararg Library|label 1=Data types of the Vararg Library}}

The Vararg Library provides support for dealing with variable-length argument lists.{{Cite tech report

|chapter-url= http://ecma-international.org/publications/standards/Ecma-335.htm

|chapter = IV.5.9 Vararg library

|title = Standard ECMA-335 – Common Language Infrastructure (CLI)

|edition = 6th

|publisher = Ecma International

|date = June 2012

|page = 441

}}

See also

References

{{Reflist}}