Delphi Framework Class Library

The Library is a Delphi interface representation of the .NET Framework class library which is tightly integrate with the Delphi Host Class Library. This library enables you to accomplish a range of common programming tasks, including tasks such as string management, data collection, data access, database connectivity, cryptography, network communications, file access and many more. In addition to these common tasks, the class library includes type interfaces that support a variety of specialized development scenarios. It also contains interfaces that provide access to system functionality.


The following table represents the classification of the Delphi Framework Class Library Namespaces:


This package contains interfaces that can be used to represent the elements of a source code document and that support the generation and compilation of source code in supported programming languages.


This package contains interfaces that define various standard, specialized, and generic collection objects.


This package contains interfaces shared among the various namespaces to prevent self circular reference error when compiling your Delphi application.


This package contains interfaces that implement the run-time and design-time behavior of components and controls.


This package contains interfaces for handling configuration data, such as data in machine or application configuration files.


This package contains interfaces that support compilation and code generation of source code written in the C# language, and types that support interoperation betwen the dynamic language runtime (DLR) and C#.


This package contains interfaces that support deployment of ClickOnce applications.


This package contains interfaces that provide access to Active Directory.


The CNClrLib.Dynamic Linq package provides interfaces that support Dynamic Language Runtime.


This package contains interfaces and classes to convert .net generic list or nullable types to it equivalent in Delphi.


This package contains interfaces that are used to provide authentication and authorization for applications.


This package contains interfaces that support queries that use Language-Integrated Query (LINQ). This includes types that represent queries as objects in expression trees.


This package contains interfaces for playing sound files and accessing sounds provided by the system.


This package contains interfaces that enable you to connect to, monitor, and administer message queues on the network and to send, receive, or peek messages.


This package contains numeric interfaces that complement the numeric primitives, such as Byte, Double, and Int32 that are defined by the .NET Framework.


This package contains interfaces that enable developers to create, store, and manage an application's culture-specific resources.


This package contains the interfaces necessary to build Windows Communication Foundation (WCF) service and client applications.


This package contains interfaces that enable you to implement, install, and control Windows service applications and extend design-time support for Windows service applications.


This package contain interfaces that support speech recognition.


This package contains interfaces that are specific to the integration of the Microsoft .NET Framework common language runtime (CLR) into Microsoft SQL Server, and the SQL Server database engine process execution environment.


This package contains fundamental interfaces that define commonly-used value and reference data types, events and event handlers, interfaces, attributes, and processing exceptions.


This package contains interfaces for character encoding and string manipulation. It also enables you to process text using regular expressions.


This package contains interface that enable multithreaded programming. The package provides types that simplify the work of writing concurrent and asynchronous code.


This package provides the Timer component, which allows you to raise an event on a specified interval.


This package contains interfaces that support transactions with multiple, distributed participants, multiple phase notifications, and durable enlistments.


This package provides interface that handle events raised by the operating system, that manipulate the system registry, and that represent file and operating system handles.


This package contains interface that support parsing and processing the Extensible Application Markup Language (XAML).


This package contains interface for processing XML. It contains interfaces that support serialization of XML documents or streams, XSD schemas, XQuery 1.0 and XPath 2.0, and LINQ to XML.


This package contains interfaces for accessing and managing data from diverse sources. These form the ADO.NET architecture and ADO.NET data providers. For example, providers are available for SQL Server, Oracle, ODBC, and OleDB. It contains interfaces for ADO.NET Entity Data Model (EDM) and WCF Data Services.


This package contains interfaces that define the COM+ services architecture, which provides an infrastructure for enterprise applications. It supports Compensating Resource Manager (CRM), a COM+ service that enables non-transactional objects to be included in Microsoft Distributed Transaction Coordinator (DTC) transactions.


This package contains interfaces that support printing, that provide access to the properties of print system objects and enable rapid copying of their property settings to another object of the same type, and that support the interconversion of managed .net System.PrintTicket objects and unmanaged GDI DEVMODE structures.


This package contains classes that support compilation and code generation using the Visual Basic language. The package also contain types that provide services to the Visual Basic compiler and types that include support for the Visual Basic application model, the My package, lambda expressions, and code conversion.


This package contains interfaces for the .NET Framework security system and permissions and provides interfaces that control access to and audit securable objects, allow authentication, provide crytographic services, control access to operations and resources based on policy, and support rights management of application-created content.


This package contains interfaces that support basic GDI+ graphics functionality and advanced two-dimensional and vector graphics functionality, advanced imaging functionality, and print-related and typographical services. The package also contains interfaces that extend design-time user-interface logic and drawing.


This package contains interface used in Windows Presentation Foundation (WPF) applications, Windows forms and web applications, including animation clients, user interface controls, data binding, and type conversion.


This package contains interfaces that provide access to management information and management events about the system, devices, and applications instrumented to the Windows Management Instrumentation (WMI) infrastructure. These namespaces also contain types necessary for instrumenting applications.


This package contains interfaces that support input and output, including the ability to read and write data to streams either synchronously or asynchronously, to compress data in streams, to create and use isolated stores, to map files to an application's logical address space, to store multiple data objects in a single container, to communicate using anonymous or named pipes, to implement custom logging, and to handle the flow of data to and from serial ports.


This package contains interface that enable browser/server communication which include types that support ASP.NET forms authentication, application services, data caching on the server, ASP.NET application configuration, dynamic data, HTTP handlers, JSON serialization, incorporating AJAX functionality into ASP.NET, ASP.NET security, and web services.


This package contains interfaces that enable you to interact with system processes, event logs, and performance counters. It contains interfaces to support contracts, to extend design-time support for application monitoring and instrumentation, to log event data using the Event Tracing for Windows (ETW) tracing subsystem, to read to and write from event logs and collect performance data, and to read and write debug symbol information.


This package allows application developers to easily access the computer's location by using a single API. Location information may come from multiple providers, such as GPS, Wi-Fi triangulation, and cell phone tower triangulation. The CNClrLib.Device interfaces provide a single API to encapsulate the multiple location providers on a computer and support seamless prioritization and transitioning between them.


This package contains interfaces that support an application's interaction with the common language runtime, and types that enable features such as application data caching, advanced exception handling, application activation within application domains, COM interop, distributed applications, serialization and deserialization, and versioning. Additional namespaces enable compiler writers to specify attributes that affect the run-time behavior of the common language runtime, define a contract for reliability between a set of code and other code that takes a dependency on it, and implement a persistence provider for Windows Communication Foundation (WCF).


This package contains interfaces that provide a simple programming interface for a number of network protocols, programmatically access and update configuration settings for the CNClrLib .Net namespaces, define cache policies for web resources, compose and send e-mail, represent Multipurpose Internet Mail Exchange (MIME) headers, access network traffic data and network address information, and access peer-to-peer networking functionality. It also provide a managed implementation of the Windows Sockets (Winsock) interface and provide access to network streams for secure communications between hosts.

Source Code Examples

Example 1

How to create and fill a DataSet from the Northwind database.

program NorthwindDataSet;

{$R *.res}


  Console: _Console;

  procedure ConnectToData(connectionString: string);
    connection: _SqlConnection;
    adapter: _SqlDataAdapter;
    command: _SqlCommand;
    dataSet: _DataSet;
    productsAdapter: _SqlDataAdapter;
    productsCommand: _SqlCommand;
    childColumn: _DataColumn;
    relation: _DataRelation;
    //Create a SqlConnection to the Northwind database.
    connection := CoSqlConnection.CreateInstance(connectionString);

    //Create a SqlDataAdapter for the Suppliers table.
    adapter := CoSqlDataAdapter.CreateInstance;

    // A table mapping names the DataTable.
    adapter.TableMappings.Add_2('Table', 'Suppliers');

    // Open the connection.
    Console.WriteLine_14('The SqlConnection is open.');

    // Create a SqlCommand to retrieve Suppliers data.
    command := CoSqlCommand.CreateInstance(
        'SELECT SupplierID, CompanyName FROM dbo.Suppliers;',
    command.CommandType := CommandType_Text;

    // Set the SqlDataAdapter's SelectCommand.
    adapter.SelectCommand := command;

    // Fill the DataSet.
    dataSet := CoDataSet.CreateInstance('Suppliers');

    // Create a second Adapter and Command to get
    // the Products table, a child table of Suppliers.
    productsAdapter := CoSqlDataAdapter.CreateInstance;
    productsAdapter.TableMappings.Add_2('Table', 'Products');

    productsCommand := CoSqlCommand.CreateInstance(
        'SELECT ProductID, SupplierID FROM dbo.Products;',
    productsAdapter.SelectCommand := productsCommand;

    // Fill the DataSet.

    // Close the connection.
    Console.WriteLine_14('The SqlConnection is closed.');

    // Create a DataRelation to link the two tables
    // based on the SupplierID.
    parentColumn := dataSet.Tables.Item_1['Suppliers'].Columns.Item_1['SupplierID'];
    childColumn := dataSet.Tables.Item_1['Products'].Columns.Item_1['SupplierID'];
    relation := CoDataRelation.CreateInstance('SuppliersProducts', parentColumn, childColumn);

    Console.WriteLine_15('The {0} DataRelation has been created.', relation.RelationName);

  function GetConnectionString: string;
    // To avoid storing the connection string in your code,
    // you can retrieve it from a configuration file.
    Result := 'Data Source=(local);Initial Catalog=Northwind;' +
              'Integrated Security=SSPI';

  connectionString: string;
    Console := CoConsole.CreateInstance;
    connectionString := GetConnectionString;
    on E: Exception do

Example 2

How to use Enumerable methods such as First, FirstOrDefault, Last, LastOrDefault, Single, SingleOrDefault, ElementAt, ElementAtOrDefault, Count, Contains, Sum, Min, Max.

program LinqWithEnumerableInterface;

{$R *.res}


  Console: _Console;
  IntList: _GenericList;
  intType: _Type;
  Enumerable: _Enumerable;
  ListEnumerable: _GenericIEnumerable;
  I: Integer;
  Console := CoConsole.CreateInstance;
  //Integer Type
  intType := TClrAssembly.GetType('System.Int32');

  //Integer Collections
  IntList := CoGenericList.CreateInstance(intType);

  Console.WriteLine_14('Elements in the List:');
  for I := 0 to IntList.Count - 1 do

  //Get GenericIEnumerable from the GenericList
  ListEnumerable := IntList.AsGenericIEnumerable;
  Enumerable := CoEnumerable.CreateInstance;

  Console.WriteLine_14('Enumerable Interface Methods: ');

  Console.WriteLine_15('First:              {0}', Enumerable.First(intType, ListEnumerable));
  Console.WriteLine_15('FirstOrDefault:     {0}', Enumerable.FirstOrDefault(intType, ListEnumerable));
  Console.WriteLine_15('Last:               {0}', Enumerable.Last(intType, ListEnumerable));
  Console.WriteLine_15('LastOrDefault:      {0}', Enumerable.LastOrDefault(intType, ListEnumerable));

    Console.WriteLine_15('Single:             {0}', Enumerable.Single(intType, ListEnumerable));
    on E: Exception do
      Console.WriteLine_15('Single:           {0}', E.Message);

    Console.WriteLine_15('SingleOrDefault:    {0}', Enumerable.SingleOrDefault(intType, ListEnumerable));
    on E: Exception do
      Console.WriteLine_15('SingleOrDefault:  {0}', E.Message);

  Console.WriteLine_15('ElementAt:          {0}', Enumerable.ElementAt(intType, ListEnumerable, 4));
  Console.WriteLine_15('ElementAtOrDefault: {0}', Enumerable.ElementAtOrDefault(intType, ListEnumerable, 5));
  Console.WriteLine_15('Count:              {0}', Enumerable.Count(intType, ListEnumerable));
  Console.WriteLine_15('Contains:           {0}', Enumerable.Contains(intType, ListEnumerable, 30));
  Console.WriteLine_15('Contains:           {0}', Enumerable.Contains(intType, ListEnumerable, 34));
  Console.WriteLine_15('Sum:                {0}', Enumerable.Sum(ListEnumerable));
  Console.WriteLine_15('Min:                {0}', Enumerable.Min(ListEnumerable));
  Console.WriteLine_15('Min with Int32 Type:{0}', Enumerable.Min_1(intType, ListEnumerable));
  Console.WriteLine_15('Max:                {0}', Enumerable.Max(ListEnumerable));
  Console.WriteLine_15('Max with Int32 Type:{0}', Enumerable.Max_1(intType, ListEnumerable));
  Console.WriteLine_15('Average:            {0}', Enumerable.Average(ListEnumerable));