Sunteți pe pagina 1din 1460

.

Net Runtime Library for


Delphi
.Net Runtime Library for Delphi

Table of Contents
1. What's New ............................................................................................................................... 4
2. Getting Started.......................................................................................................................... 6
2.1 Overview ............................................................................................................................. 8
2.2 System Requirements ....................................................................................................... 11
2.3 Installation Guide .............................................................................................................. 12
3. How to:.................................................................................................................................... 12
3.1 Host .Net CLR .................................................................................................................... 12
3.2 Use Application Domains .................................................................................................. 14
Describes how to programmatically create an application domain. ......................... 15
Describes how to programmatically unload an application domain. ........................ 15
Provides an introduction to configuring an application domain. .............................. 15
Describes how to retrieve setup information from an application domain. ............. 15
Describes how to load an assembly into an application domain............................... 15
Describes how to retrieve information about an assembly. ....................................... 15
Explains how you can receive a notification that an exception has been thrown,
before the common language runtime has begun searching for exception
handlers.............................................................................................................................. 15
Provides guidance on using the AppDomain.AssemblyResolve event to resolve
assembly load failures. ..................................................................................................... 15
Represents an application domain. Provides methods for creating and controlling
application domains. ........................................................................................................ 15

Describes how to create dynamic assemblies. ............................................................. 15


Describes how to use the Reflection class to obtain information about an
assembly. ........................................................................................................................... 15
3.2.1 How to: Create an Application Domain ..................................................................... 16
3.2.2 How to: Unload an Application Domain .................................................................... 17
3.2.3 How to: Configure an Application Domain ................................................................ 20
3.2.4 Retrieving Setup Information from an Application Domain ...................................... 23
3.2.5 How to: Load Assemblies into an Application Domain .............................................. 28
3.2.6 How to: Obtain Type and Member Information from an Assembly .......................... 29
3.2.7 How to: Receive First-Chance Exception Notifications .............................................. 44
3.2.8 Resolving Assembly Loads ......................................................................................... 53

1
.Net Runtime Library for Delphi

3.3 Create Instance of .Net Objects ........................................................................................ 56


3.4 Handling and Raise Events ................................................................................................ 80
3.4.1 Raise and Consume Events ........................................................................................ 85
3.5 Use Base Interface .......................................................................................................... 105
3.6 Use ClrObject Interface ................................................................................................... 107
3.7 Use Array Interfaces........................................................................................................ 143
3.8 Access Static Classes or Static Class Members ............................................................... 163
3.9 Use AsXXXX methods ...................................................................................................... 164
3.10 Use Collections Interfaces............................................................................................. 165
3.10.1 Non-generic Collections ......................................................................................... 167
3.10.2 Generic Collections ................................................................................................ 192
3.11 Use Linq and Dynamic Linq Interfaces .......................................................................... 226
3.12 Convert Between Types ................................................................................................ 259
Custom Conversions with the ChangeType Method............................................... 266
3.13 Place .Net Controls on VCL Form .................................................................................. 267
3.14 Format Types ................................................................................................................ 277
3.15 Perform Common I/O Tasks.......................................................................................... 286
3.15.1 How to: Copy Directories ....................................................................................... 288
3.15.2 How to: Enumerate Directories and Files .............................................................. 290
3.15.3 How to: Read and Write to a Newly Created Data File ......................................... 297
3.15.4 How to: Open and Append to a Log File ................................................................ 301
3.15.5 How to: Write Text to a File ................................................................................... 304
3.15.6 How to: Read Text from a File ............................................................................... 307
3.15.7 How to: Read Characters from a String ................................................................. 310
3.15.8 How to: Write Characters to a String ..................................................................... 312
3.15.9 How to: Compress and Extract Files ...................................................................... 315
3.15.10 Composing Streams ............................................................................................. 326
3.16 Globalization ................................................................................................................. 331
3.17 Use WideString instead of String in DispInterfaces ...................................................... 353
4. Dynamic Programming ......................................................................................................... 358
4.1 Reflection ........................................................................................................................ 358
4.1.1 Viewing Type Information........................................................................................ 360
4.1.2 How to: Examine and Instantiate Generic Types with Reflection ........................... 371
4.1.3 Accessing Custom Attributes ................................................................................... 387

2
.Net Runtime Library for Delphi

4.1.4 How to: Hook Up a Delegate Using Reflection ........................................................ 389


4.1.5 Reflection Using ClrObject ....................................................................................... 406
4.2 Emitting Dynamic Methods and Assemblies .................................................................. 406
4.2.1 How to: Define a Generic Type with Reflection Emit .............................................. 407
4.3 Dynamic Source Code Generation and Compilation ...................................................... 432
4.3.1 Using the CodeDOM ................................................................................................ 432
4.3.2 Generating Source Code and Compiling a Program from a CodeDOM Graph ........ 439
4.3.3 How to: Create a Class Using CodeDOM.................................................................. 444
5. Utilities .................................................................................................................................. 481
5.1 Import .Net Assemblies................................................................................................... 481
5.2 Import WSDL/XML Webservices ..................................................................................... 493
6. Constructor Classes ............................................................................................................... 503
6.1 CoClasses......................................................................................................................... 505
6.1.1 CreateInstance ......................................................................................................... 508
6.1.2 Wrap ........................................................................................................................ 512
7. Symbol Reference ................................................................................................................. 514
7.1 CrystalNet Class Libraries ................................................................................................ 514
7.1.1 Host Class Library ..................................................................................................... 515
7.1.2 Delphi Framework Class Library............................................................................. 1367

3
.Net Runtime Library for Delphi

1. What's New
This article summarizes key new features and improvements in this version of the .NET Runtime
Library for Delphi. This library was built on the previous version by adding many new fixes and
several new features while remaining a very stable product. The new feature included are:

 The CrystalNet Common Langauage Runtime Library implements all c# mscorlib types.
These types are represented as dispatch interfaces. In the previous version only the
classes without the interfaces of the mscorlib types were implemented. The library uses
the interfaces in the mscorlib_tlb.pas file. This caused so many issues and to resolve
them all the types in mscorlib were implemented in the Runtime Library.
 Ability to load .Net assemblies and create instances of the .net types of objects using a
new reflection class wrappers such as TClrAppDomain, TClrAssembly and TClrActivator
defined in Runtime Host unit.
 Ability to load and build Web Services as assemblies using a new class called TClrWSDL.
Using reflection classes or interfaces you can create instances of the imported
webservices, access it fields, properties and invoke it methods.
 A TClrObject class which is a wrapper of the _ClrObject interface has been included in
the Runtime Host unit which provides a flexible general purpose data type. The class
can hold Delphi data type values in the form of OleVariant and .Net Objects. This class
has properties and methods which allows a developer to access the fields, properties ,
methods and events of the .net object which this class holds.
 A TClrArray class which is a wrapper of the _Array interface has been included in the
Runtime Host unit which is used to store array of Delphi variant or .net objects types.
 Type Conversion has been added to this release to help convert one type of data to
another type. There are wraps and unwraps methods for each interfaces which help to
convert from .net data types to CrystalNet common Language Runtime types and vice
versa respectively.
 Introduced Dynamic Linq feature in this release. This unit has interfaces which contains
methods to dynamically generate LINQ queries.
 More .Net Types have been added to the .Net Runtime Library. These types are
represented as dispatched interfaces in the Delphi part of the runtime library. There are
2 classifications of these interfaces in the library. These are:

1. CNClrLib.Core.Intf which contains interfaces that represent the types defined in


Microsoft Common Object Runtime Library (Mscorlib).
2. The Delphi Framework Class Library which represent all the types defined in the
.Net Framework Class Library. The following table represents the classification of
the Delphi Framework Class Library and their corresponding .Net Framework
class library namespace.
Delphi Framework Class .Net Framework Class Library
Library

CNClrLib.CodeDom System.CodeDom Namespaces

CNClrLib.Collections System.Collections Namespaces

CNClrLib.ComponentModel System.ComponentModel Namespaces

4
.Net Runtime Library for Delphi

Delphi Framework Class .Net Framework Class Library


Library

CNClrLib.Configuration System.Configuration Namespaces

CNClrLib.CSharp Microsoft.CSharp Namespaces

CNClrLib.Data System.Data Namespaces

CNClrLib.Deployment System.Deployment Namespaces

CNClrLib.Device System.Device Namespace

CNClrLib.Diagnostics System.Diagnostics Namespaces

CNClrLib.DirectoryServices System.DirectoryServices Namespaces

CNClrLib.Drawing System.Drawing Namespaces

CNClrLib.Dynamic System.Dynamic Namespace

CNClrLib.DynamicLinq CNCorLibrary.CorDynamicLinq

CNClrLib.EnterpriseServices System.EnterpriseServices Namespaces

CNClrLib.IdentityModel System.IdentityModel Namespaces

CNClrLib.Linq System.Linq Namespaces

CNClrLib.Management System.Management Namespaces

CNClrLib.Media System.Media Namespace

CNClrLib.Messaging System.Messaging Namespaces

CNClrLib.Net System.Net Namespaces

CNClrLib.Numerics System.Numerics Namespace

CNClrLib.Printing System.Printing Namespaces

CNClrLib.Resources System.Resources Namespaces

CNClrLib.Runtime System.Runtime Namespaces

CNClrLib.Security System.Security Namespaces

CNClrLib.ServiceModel System.ServiceModel Namespaces

CNClrLib.ServiceProcess System.ServiceProcess Namespaces

CNClrLib.Speech System.Speech Namespaces

CNClrLib.SqlServer Microsoft.SqlServer Namespace

CNClrLib.System System Namespace

CNClrLib.Text System.Text Namespaces

CNClrLib.Threading System.Threading Namespaces

5
.Net Runtime Library for Delphi

Delphi Framework Class .Net Framework Class Library


Library

CNClrLib.Timers System.Timers Namespace

CNClrLib.Transactions System.Transactions Namespaces

CNClrLib.VisualBasic Microsoft.VisualBasic Namespaces

CNClrLib.Web System.Web Namespaces

CNClrLib.Win32 Microsoft.Win32 Namespaces

CNClrLib.Windows System.Windows Namespaces

CNClrLib.Xaml System.Xaml Namespaces

CNClrLib.Xml System.Xml Namespaces


For more information about the above .net framework class library namespaces, see .Net
Framwork Class Library .

This article does not provide comprehensive information about each new feature. For general
information about the Runtime Library for Delphi, see Getting Started with the .Net Runtime
Library for Delphi.
For supported platforms, see System Requirements. For download links and installation, see
Installtion Guide .

2. Getting Started
Many years ago, in the middle of 90's, Microsoft introduced a new revolutionary programming
technology called COM (Component Object Model). It is used to enable inter-process
communication and dynamic object creation in a large range of programming languages.COM
is a platform-independent, distributed, object-oriented system for creating binary software
components that can interact. Most new windows OS features were implemented using COM.
Most programming languages support COM but most of them are not COM-based.

Now Microsoft has introduced a new revolutionary technology which is more powerful than
COM called .Net. New programming languages such as C#, VB.Net, Visual C++ etc were created
using the .Net technology. More and more new .Net components become available on the
market.

Here is a list of some Win32applications that host .Net runtime:

 Borland Delphi 8
 Microsoft Visual Studio
 C# and VB.Net compilers in .Net framework csc.exe and vbc.exe).
 Microsoft SQL Server 2005 host .Net framework to execute stored procedures written in
.Net.

6
.Net Runtime Library for Delphi

 Microsoft Internet information services (IIS) in part that host ASP.Net, including
aspnet_isapi.dll.
 Microsoft Internet Explorer 6.0 in part that host .Net controls.

So it is time to support .Net from other Win32/Win64 languages such as Delphi.

.NET Runtime Library for Delphi


The .Net Runtime Library for Delphi is the best library to work with .Net framework from Delphi.
It is designed to provide a way to interact with applications written in anyone of the .Net
langauges: C#, Visual Basic.Net, Delphi.Net, JScript.Net and others. It includes a large class
library known as Delphi Framework Class Library (DFCL). The DFCL is a dispatched interface
representation of the .Net Framework Class Library (FCL). Programs written for .NET Framework
execute in a software environment known as Common Language Runtime (CLR), an application
virtual machine that provides services such as security, memory management, and exception
handling.

The DFCL provides:

 User Interface.
 Data Access.
 Database Connectivity.
 Cryptography.
 Numeric Algorithm.
 Network Communications.
 and many more.

Programmers can produce software by combining pascal source codes with .Net framework and
other .Net libraries.

The .Net Runtime Library for Delphi can:

 Create .Net objects from assemblies not registered for COM and loading .Net
assemblies from partial or full assembly name, location and streams
 Create and use .Net objects that are not COM visible.
 Create .Net objects using parameterized or non-parameterized constructors.
 Call Static and non-Static properties/methods/fields of .Net object.
 Handle .Net exceptions and get all .Net exception properties including exception type
name, StackTrace etc.
 Get information about loaded instance of .Net framework such as memory usage and
size of heap by generation.
 Work with .Net events.
 and many more.

The Runtime Library will not turn your Delphi into .Net language. All the .Net Framework Class
Library is available in the runtime library as dispatched interfaces.
Related Topics

7
.Net Runtime Library for Delphi

Title Description

Overview of the .Net Runtime Library Provides detailed information for developers who build delphi
for Delphi Framework.

.Net Runtime Library for Delphi System Lists the hardware and software requirements for running the .
Requirements

Installing the .Net Runtime Library for Provides information about installing the .NET Runtime Library
Delphi

2.1 Overview
The .NET Framework is a new computing platform that simplifies application development in
the highly distributed environment of the Internet. The .NET Framework is designed to fulfill the
following objectives:

 To provide a consistent object-oriented programming environment whether object


code is stored and executed locally, executed locally but Internet-distributed, or
executed remotely.
 To provide a code-execution environment that minimizes software deployment and
versioning conflicts.
 To provide a code-execution environment that guarantees safe execution of code,
including code created by an unknown or semi-trusted third party.
 To provide a code-execution environment that eliminates the performance problems of
scripted or interpreted environments.
 To make the developer experience consistent across widely varying types of
applications, such as Windows-based applications and Web-based applications.
 To build all communication on industry standards to ensure that code based on the
.NET Framework can integrate with any other code.

The .NET Framework has two main components: the common language runtime and the .NET
Framework class library. The common language runtime is the foundation of the .NET
Framework. You can think of the runtime as an agent that manages code at execution time,
providing core services such as memory management, thread management, and remoting,
while also enforcing strict type safety and other forms of code accuracy that ensure security and
robustness. In fact, the concept of code management is a fundamental principle of the runtime.
Code that targets the runtime is known as managed code, while code that does not target the
runtime is known as unmanaged code. The class library, the other main component of the .NET
Framework, is a comprehensive, object-oriented collection of reusable types that you can use to
develop applications ranging from traditional command-line or graphical user interface (GUI)
applications to applications based on the latest innovations provided by ASP.NET, such as Web
Forms and XML Web services.
The .NET Framework can be hosted by unmanaged components that load the common
language runtime into their processes and initiate the execution of managed code, thereby
creating a software environment that can exploit both managed and unmanaged features. The

8
.Net Runtime Library for Delphi

.NET Framework not only provides several runtime hosts, but also supports the development of
third-party runtime hosts.

For example, ASP.NET hosts the runtime to provide a scalable, server-side environment for
managed code. ASP.NET works directly with the runtime to enable ASP.NET applications and
XML Web services, both of which are discussed later in this topic.

Internet Explorer is an example of an unmanaged application that hosts the runtime (in the
form of a MIME type extension). Using Internet Explorer to host the runtime enables you to
embed managed components or Windows Forms controls in HTML documents. Hosting the
runtime in this way makes managed mobile code (similar to Microsoft® ActiveX® controls)
possible, but with significant improvements that only managed code can offer, such as semi-
trusted execution and secure isolated file storage.

The following illustration shows the relationship of the common language runtime and the class
library to your applications and to the overall system. The illustration also shows how managed
code operates within a larger architecture.

.NET Framework in context

The following sections describe the main components and features of the .NET Framework in
greater detail.

9
.Net Runtime Library for Delphi

Features of the Common Language Runtime


The common language runtime manages memory, thread execution, code execution, code
safety verification, compilation, and other system services. These features are intrinsic to the
managed code that runs on the common language runtime.

With regards to security, managed components are awarded varying degrees of trust,
depending on a number of factors that include their origin (such as the Internet, enterprise
network, or local computer). This means that a managed component might or might not be
able to perform file-access operations, registry-access operations, or other sensitive functions,
even if it is being used in the same active application.

The runtime enforces code access security. For example, users can trust that an executable
embedded in a Web page can play an animation on screen or sing a song, but cannot access
their personal data, file system, or network. The security features of the runtime thus enable
legitimate Internet-deployed software to be exceptionally feature rich.

The runtime also enforces code robustness by implementing a strict type-and-code-verification


infrastructure called the common type system (CTS). The CTS ensures that all managed code is
self-describing. The various Microsoft and third-party language compilers generate managed
code that conforms to the CTS. This means that managed code can consume other managed
types and instances, while strictly enforcing type fidelity and type safety.

In addition, the managed environment of the runtime eliminates many common software
issues. For example, the runtime automatically handles object layout and manages references to
objects, releasing them when they are no longer being used. This automatic memory
management resolves the two most common application errors, memory leaks and invalid
memory references.

The runtime also accelerates developer productivity. For example, programmers can write
applications in their development language of choice, yet take full advantage of the runtime,
the class library, and components written in other languages by other developers. Any compiler
vendor who chooses to target the runtime can do so. Language compilers that target the .NET
Framework make the features of the .NET Framework available to existing code written in that
language, greatly easing the migration process for existing applications.

While the runtime is designed for the software of the future, it also supports software of today
and yesterday. Interoperability between managed and unmanaged code enables developers to
continue to use necessary COM components and DLLs.

The runtime is designed to enhance performance. Although the common language runtime
provides many standard runtime services, managed code is never interpreted. A feature called
just-in-time (JIT) compiling enables all managed code to run in the native machine language of
the system on which it is executing. Meanwhile, the memory manager removes the possibilities
of fragmented memory and increases memory locality-of-reference to further increase
performance.

10
.Net Runtime Library for Delphi

Finally, the runtime can be hosted by high-performance, server-side applications, such as


Microsoft® SQL ServerT and Internet Information Services (IIS). This infrastructure enables you
to use managed code to write your business logic, while still enjoying the superior performance
of the industry's best enterprise servers that support runtime hosting.

CrystalNet Class Library


The CrystalNet Class Library is a collection of prewritten classes and interfaces which is used to
start and host the .Net Common Language Runtime as well as interfaces which are wrappers of
the .Net Framework Class Library, any of which can be specified and used by a programmer
when developing an application program. The programmer specifies which classes are being
used and furnishes data that instantiate s each class as an object that can be called when the
program is executed. Access to and use of a class library greatly simplifies the job of the
programmer since standard, pretested code is available that the programmer doesn't have to
write.

See Also

 .NET Runtime Library for Delphi System Requirements


 Installing the .NET Runtime Library for Delphi
 Delphi Framework Class Library

2.2 System Requirements


This section provides the requirements, platforms and operating system for the .Net Runtime
Library for Delphi.

For download information and links, see Installing the .Net Runtime Library for Delphi.

Platforms

 .Net Framework 4.5.2 or higher version.


 The .NET Runtime Library for Delphi requires a privileges in order to install. If you do
not have administrator rights to the computer on which you would like to
install the .NET Runtime Library for Delphi, contact your network administrator.

Supported Delphi Versions

 Embarcadero Delphi 2009


 Embarcadero Delphi 2010
 Embarcadero Delphi XE Or Higher Versions

Supported client operating systems

 Microsoft® Windows

11
.Net Runtime Library for Delphi

2.3 Installation Guide


.NET is an integral part of many applications running on Windows and provides common functionality for those
applications to run. For delphi developers, the .NET Runtime Library provides a comprehensive and consistent
programming for building integrated Delphi and .Net applications that have visually stunning user experiences and
seamless and secure communication.

Description
To install the Runtime Library on Windows, download the runtime library installation files (32bit
or 64bit) from the download page.

Note
This documentation also includes code examples that you can copy directly from topics and
paste into your own projects.

3. How to:
This section describes how to use the Delphi Framework Library.

3.1 Host .Net CLR


Before any managed code can be executed, the host must load and initialize the common
language runtime. If your delphi applications utilises the .Net runtime library for delphi, the
Common Language Runtime (CLR) will be started automatically by implicitly creating an
instance of the TClrHost class. To manually start the CLR, call ClrHostManager function or
explicitly create an instance of TClrHost object or call the static function GetDefault of the
TClrHost class. The CLR host class are defined in the CNClrLib.Host namespace . The runtime
host loads the runtime into a process, creates application domains within the process, and loads
and executes user code within those application domains. The purpose of this class is to start
the .net runtime library for delphi which in turn starts the .Net framework CLR and execute
managed codes from delphi. Application domains provide greater reliability by isolating
assemblies from one another. Assemblies can be unloaded from the process by unloading
application domains. The application domain is called TClrAppDomain which is a wrapper of the
AppDomain interface. This class is also defined in the CNClrLib.Host namespace .

Example

Pascal

program CreateCLRHostDemo;

{$APPTYPE CONSOLE}

{$R *.res}

12
.Net Runtime Library for Delphi

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

CNClrLib.Enums;

var

Console: _Console;

ClrHost: TClrHost;

begin

try

//Calling any of the following lines of code will start the .net
runtime host.

//NB: The CLRHost instance is created once and any attempt to


recreate the instance explicitly

// will cause an error.

//1.

//Calling this method will create an instance of the TClrHost


class implicitly

//and start the runtime host if the host object has not been
created already.

Console := CoConsole.CreateInstance;

//2.

//Calling this global function in the CNClrLib.Host namespace


will use the default

//TClrHost instance created. If the instance has not been


created already, the function

//automatically create a new instance of the TClrHost class.

ClrHost := ClrHostManager;

//3.

//To Explicitly Create an instance of the host class, either


call the static

13
.Net Runtime Library for Delphi

//method GetDefault or the Create constructor of the TClrHost


Class.

//a. Using GetDefault

ClrHost := TClrHost.GetDefault;

//b. Using Create Constructor

ClrHost := TClrHost.Create;

except

on E: Exception do

Writeln(E.ClassName, ': ', E.Message);

end;

end.

3.2 Use Application Domains


Application domains provide a flexible and secure method of isolating running applications.Application domains are
usually created and manipulated by run-time hosts. Occasionally, you may want your application to programmatically
interact with your application domains, for example, to unload a component without having to stop your application
from running.Application domains aid security, separating applications from each other and each other's data. A single
process can run several application domains, with the same level of isolation that would exist in separate processes.
Running multiple applications within a single process increases server scalability.
In the following code example, you create a new application domain and then load and execute a previously built
assembly, HelloWorld.exe, that is stored on drive C.
Delphi

var

newDomain: TClrAppDomain;

begin

// Create the application domain.

newDomain := TClrAppDomain.CreateDomain('NewApplicationDomain');

// Load and execute an .Net assembly:

newDomain.ExecuteAssembly('c:\HelloWorld.exe');

// Unload the application domain:

TClrAppDomain.Unload(newDomain);

end.

14
.Net Runtime Library for Delphi

Application Domains Overview


Application domains have the following properties:
 An assembly must be loaded into an application domain before it can be executed.
 Faults in one application domain cannot affect other code running in another application domain.
 Individual applications can be stopped and code unloaded without stopping the entire process. You cannot
unload individual assemblies or types, only entire application domains.
In This Section

How to: Create an Application Domain


Describes how to programmatically create an application domain.

How to: Unload an Application Domain


Describes how to programmatically unload an application domain.

How to: Configure an Application Domain


Provides an introduction to configuring an application domain.

Retrieving Setup Information from an Application Domain


Describes how to retrieve setup information from an application domain.

How to: Load Assemblies into an Application Domain


Describes how to load an assembly into an application domain.

How to: Obtain Type and Member Information from an


Assembly
Describes how to retrieve information about an assembly.

How to: Receive First-Chance Exception Notifications


Explains how you can receive a notification that an exception has been thrown, before the common language
runtime has begun searching for exception handlers.

Resolving Assembly Loads


Provides guidance on using the AppDomain.AssemblyResolve event to resolve assembly load failures.
Reference

AppDomain/TClrAppDomain
Represents an application domain. Provides methods for creating and controlling application domains.
Related Sections

Emitting Dynamic Methods and Assemblies


Describes how to create dynamic assemblies.

Reflection Overview
Describes how to use the Reflection class to obtain information about an assembly.

15
.Net Runtime Library for Delphi

3.2.1 How to: Create an Application Domain


The common language runtime host creates application domains automatically when they are needed. However, you
can create your own application domains and load into them those assemblies that you want to manage personally.
You can also create application domains from which you execute code. You create a new application domain using one
of the overloaded CreateDomain methods in the AppDomain interface TClrAppDomain class. You can give the
application domain a name and reference it by that name.
The following example creates a new application domain, assigns it the name MyDomain, and then prints the name of
the host domain and the newly created child application domain to the console.
Example

Delphi
program AppDomain1;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

var

Console: _Console;

domain: TClrAppDomain;

begin

try
Console := CoConsole.CreateInstance;

try
Console.WriteLine_14('Creating new
AppDomain.');

16
.Net Runtime Library for Delphi

domain :=
TClrAppDomain.CreateDomain('MyDomain');

Console.WriteLine_14('Host domain: ' +


TClrAppDomain.GetCurrentDomain.FriendlyName);

Console.WriteLine_14('child domain: ' +


domain.FriendlyName);

Console.ReadKey;

finally
Console := nil;

end;

except
on E: Exception do

Writeln(E.ClassName, ': ', E.Message);

end;

end.

3.2.2 How to: Unload an Application Domain


When you have finished using an application domain, unload it using the TClrAppDomain.Unload method. The Unload
method gracefully shuts down the specified application domain. During the unloading process, no new threads can
access the application domain, and all application domain-specific data structures are freed. Assemblies loaded into the
application domain are removed and are no longer available. If an assembly in the application domain is domain-
neutral, data for the assembly remains in memory until the entire process is shut down. There are situations where the
request to unload an application domain does not work and results in a CannotUnloadAppDomainException .
The following example creates a new application domain called MyDomain, prints some information to the console, and
then unloads the application domain. Note that the code then attempts to print the friendly name of the unloaded
application domain to the console. This action generates an exception that is handled by the try/catch statements at the
end of the program.
Example

Delphi
program AppDomain;

17
.Net Runtime Library for Delphi

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

System.Win.ComObj;

var

Console: _Console;

domain: TClrAppDomain;

AppDomainUnloadedException:
_AppDomainUnloadedException;

begin

Console := CoConsole.CreateInstance;

try
Console.WriteLine_14('Creating new
AppDomain.');

domain :=
TClrAppDomain.CreateDomain('MyDomain', nil);

Console.WriteLine_14('Host domain: ' +


TClrAppDomain.GetCurrentDomain.FriendlyName);
Console.WriteLine_14('child domain: ' +
domain.FriendlyName);

18
.Net Runtime Library for Delphi

TClrAppDomain.Unload(domain);

Console.WriteLine();

Console.WriteLine_14('Host domain: ' +


TClrAppDomain.GetCurrentDomain.FriendlyName);
// The following statement creates an
exception because the domain no longer exists.

Console.WriteLine_14('child domain: ' +


domain.FriendlyName);

except
on E: EOleException do

begin
AppDomainUnloadedException :=
CoAppDomainUnloadedException.Wrap(EClrException.Ge
tExceptionIntf(E.ErrorCode));

Console.WriteLine_14(AppDomainUnloadedException.Ge
tType().FullName);
Console.WriteLine_14('The appdomain MyDomain
does not exist.');

end;

on E: Exception do

Writeln(E.ClassName, ': ', E.Message);

end;

Console.ReadKey;

end.

19
.Net Runtime Library for Delphi

//Output

//Creating new AppDomain.

//Host domain: DefaultDomain

//child domain: MyDomain

//

//Host domain: DefaultDomain

//System.AppDomainUnloadedException

//The appdomain MyDomain does not exist.

3.2.3 How to: Configure an Application


Domain
You can provide the common language runtime with configuration information for a new application domain using the
AppDomainSetup interface. When creating your own application domains, the most important property is
ApplicationBase. The other AppDomainSetup properties are used mainly by runtime hosts to configure a particular
application domain. The ApplicationBase property defines the root directory of the application. When the runtime
needs to satisfy a type request, it probes for the assembly containing the type in the directory specified by the
ApplicationBase property.
The following example creates an instance of the AppDomainSetup class, uses this class to create a new application
domain, writes the information to console, and then unloads the application domain.

Example

Delphi
program AppDomain;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

20
.Net Runtime Library for Delphi

CNClrLib.Core;

var

Console: _Console;

domain: TClrAppDomain;

domaininfo: _AppDomainSetup;

begin

try
Console := CoConsole.CreateInstance;

// Create application domain setup


information.

domaininfo := CoAppDomainSetup.CreateInstance;

domaininfo.ApplicationBase :=
'C:\Temp\AppDomainDemo\EXE\Win32\Debug';

// Create the application domain.

domain :=
TClrAppDomain.CreateDomain('MyDomain', nil,
domaininfo);

// Write application domain information to the


console.
Console.WriteLine_14('Host domain: ' +
TClrAppDomain.GetCurrentDomain.FriendlyName);
Console.WriteLine_14('child domain: ' +
domain.FriendlyName);

21
.Net Runtime Library for Delphi

Console.WriteLine_14('Application base is: ' +


domain.DefaultInterface.SetupInformation.Applicati
onBase);

//NB: The DefaultInterface is the AppDomain


Inteface. The TClrAppDomain is
//a wrapper of the _AppDomain Dispatch
Interface

// Unload the application domain.

TClrAppDomain.Unload(domain);

Console.ReadKey;

except
on E: Exception do

Writeln(E.ClassName, ': ', E.Message);

end;

end.

//Output

//Host domain: DefaultDomain

//child domain: MyDomain


//Application base is:
C:\Temp\AppDomainDemo\EXE\Win32\Debug

22
.Net Runtime Library for Delphi

3.2.4 Retrieving Setup Information from an


Application Domain
Each instance of an application domain consists of both properties and AppDomainSetup information. You can retrieve
setup information from an application domain using the wrapper class TClrAppDomain or AppDomain interface. This
class or interface provides several members that retrieve configuration information about an application domain. You
can also query the AppDomainSetup object for the application domain to obtain setup information that was passed to
the domain when it was created.
The following example creates a new application domain and then prints several member values to the console.
Delphi

program AppDomain;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

var

Console: _Console;

domain: TClrAppDomain;

begin

try

Console := CoConsole.CreateInstance;

// Create the application domain.

domain := TClrAppDomain.CreateDomain('MyDomain', nil);

// Write application domain information to the console.

Console.WriteLine_14('Host domain: ' +


TClrAppDomain.GetCurrentDomain.FriendlyName);

Console.WriteLine_14('New domain: ' + domain.FriendlyName);

Console.WriteLine_14('Application base is: ' +


domain.BaseDirectory);

Console.WriteLine_14('Relative search path is: ' +


domain.DefaultInterface.RelativeSearchPath);

23
.Net Runtime Library for Delphi

Console.WriteLine_15('Shadow copy files is set to: {0}',


domain.DefaultInterface.ShadowCopyFiles);

//NB: The DefaultInterface is the AppDomain Inteface. The


TClrAppDomain is

//a wrapper of the _AppDomain Dispatch Interface

// Unload the application domain.

TClrAppDomain.Unload(domain);

Console.ReadKey;

except

on E: Exception do

Writeln(E.ClassName, ': ', E.Message);

end;

end.

//Output

//Host domain: DefaultDomain

//New domain: MyDomain

//Application base is: C:\Temp\AppDomainDemo\EXE\Win32\Debug\

//Relative search path is:

//Shadow copy files is set to: False

24
.Net Runtime Library for Delphi

25
.Net Runtime Library for Delphi

The following example sets, and then retrieves, setup information for an application domain. Note that
AppDomain.SetupInformation.ApplicationBase gets the configuration information.
Delphi

program AppDomain;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

var

Console: _Console;

domain: TClrAppDomain;

domaininfo: _AppDomainSetup;

begin

try

Console := CoConsole.CreateInstance;

// Create application domain setup information.

domaininfo := CoAppDomainSetup.CreateInstance;

domaininfo.ApplicationBase :=
'C:\Temp\AppDomainDemo\EXE\Win32\Debug\';

domaininfo.ConfigurationFile :=
'C:\Temp\AppDomainDemo\EXE\Win32\Debug\AppDomain.exe.Config';

26
.Net Runtime Library for Delphi

// Create the application domain.

domain := TClrAppDomain.CreateDomain('MyDomain', nil, domaininfo);

// Write application domain information to the console.

Console.WriteLine_14('Host domain: ' +


TClrAppDomain.GetCurrentDomain.FriendlyName);

Console.WriteLine_14('child domain: ' + domain.FriendlyName);

Console.WriteLine();

Console.WriteLine_14('Application base is: ' +


domain.DefaultInterface.SetupInformation.ApplicationBase);

Console.WriteLine_14('Configuration file is: ' +


domain.DefaultInterface.SetupInformation.ConfigurationFile);

//NB: The DefaultInterface is the AppDomain Inteface. The


TClrAppDomain is

//a wrapper of the _AppDomain Dispatch Interface

// Unload the application domain.

TClrAppDomain.Unload(domain);

Console.ReadKey;

except

on E: Exception do

Writeln(E.ClassName, ': ', E.Message);

end;

end.

//Output

//Host domain: DefaultDomain

//child domain: MyDomain

//

//Application base is: C:\Temp\AppDomainDemo\EXE\Win32\Debug\

//Configuration file is:


C:\Temp\AppDomainDemo\EXE\Win32\Debug\AppDomain.exe.Config

27
.Net Runtime Library for Delphi

3.2.5 How to: Load Assemblies into an


Application Domain
There are several ways to load an assembly into an application domain. These are:

 The LoadFrom method of the TClrAssembly class loads an assembly given its file location. Loading assemblies
with this method uses a different load context.
 The ReflectionOnlyLoad and ReflectionOnlyLoadFrom methods load an assembly into the reflection-only
context. Assemblies loaded into this context can be examined but not executed, allowing the examination of
assemblies that target other platforms. See How to: Load Assemblies into the Reflection-Only Context.
 Methods such as CreateInstance of the TClrAppDomain class can load assemblies into an application domain.
 The GetType method of the Type interface can load assemblies.
 The Load method of the TClrAppDomain class can load assemblies, but is primarily used for COM
interoperability. It should not be used to load assemblies into an application domain other than the
application domain from which it is called.
Example
The following code loads an assembly named "example.exe" or "example.dll" into the current application domain, gets a
type named Example from the assembly, gets a parameterless method named MethodA for that type, and executes the
method. For a complete discussion on obtaining information from a loaded assembly, see Dynamically Loading and
Using Types.
Delphi

program Asmload0;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

var

AAsm: TClrAssembly;

myType: _Type;

myMethod: _MethodInfo;

obj: OleVariant;

Clrobj: _ClrObject;

begin

28
.Net Runtime Library for Delphi

// Use the file name to load the assembly into the current

// application domain.

AAsm := TClrAssembly.Load('example');

// Get the type to use.

myType := TClrAssembly.GetType('Example');

// Get the method to call.

myMethod := myType.GetMethod_5('MethodA');

// Create an instance.

obj := TClrActivator.CreateInstance(myType);

// Execute the method.

myMethod.Invoke_2(obj, nil);

//OR

//You can use the ClrObject to invoke the method

// Create an instance of ClrObject.

Clrobj := TClrActivator.ClrCreateInstance(myType);

// Execute the method.

Clrobj.InvokeMethod('MethodA');

end.

3.2.6 How to: Obtain Type and Member


Information from an Assembly
The CNClrLib.Core.Intf namespace contains many methods for obtaining information from an assembly. This section
demonstrates one of these methods. For additional information, see Reflection Overview.
The following example obtains type and member information from an assembly.
Example
Delphi

29
.Net Runtime Library for Delphi

program Asminfo1;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

CNClrLib.Enums;

var

Console: _Console;

myType: _Type;

I: Integer;

MemberInfoArray: _MemberInfoArray;

begin

Console := CoConsole.CreateInstance;

Console.WriteLine_14('Reflection.MemberInfo');

// Get the Type and MemberInfo.

// Insert the fully qualified class name inside the quotation marks
in the

// following statement.

myType := TClrAssembly.GetType('System.IO.BinaryReader');

MemberInfoArray := myType.GetMembers_1(BindingFlags_Public or

BindingFlags_NonPublic or BindingFlags_Static or

BindingFlags_Instance or BindingFlags_DeclaredOnly);

// Get and display the DeclaringType method.

30
.Net Runtime Library for Delphi

Console.WriteLine_15('There are {0} documentable members in ',


MemberInfoArray.Length);

Console.WriteLine_15('{0}.', myType.FullName);

for I := 0 to MemberInfoArray.Length - 1 do

Console.WriteLine_14(MemberInfoArray[I].Name);

Console.ReadKey;

end.

//Output

//Reflection.MemberInfo

//There are 43 documentable members in

//System.IO.BinaryReader.

//get_BaseStream

//Close

//Dispose

//Dispose

//PeekChar

//Read

//ReadBoolean

//ReadByte

//ReadSByte

//ReadChar

//ReadInt16

//ReadUInt16

//ReadInt32

//ReadUInt32

//ReadInt64

//ReadUInt64

//ReadSingle

//ReadDouble

31
.Net Runtime Library for Delphi

//ReadDecimal

//ReadString

//Read

//InternalReadChars

//InternalReadOneChar

//ReadChars

//Read

//ReadBytes

//FillBuffer

//Read7BitEncodedInt

//.ctor

//.ctor

//.ctor

//BaseStream

//m_stream

//m_buffer

//m_decoder

//m_charBytes

//m_singleChar

//m_charBuffer

//m_maxCharsSize

//m_2BytesPerChar

//m_isMemoryStream

//m_leaveOpen

//MaxCharBytesSize

32
.Net Runtime Library for Delphi

33
.Net Runtime Library for Delphi

34
.Net Runtime Library for Delphi

Accessing external .Net Library Type Objects

Unlike COM in Delphi which requires the .Net library classes to be


marked with ComVisible attribute or the .Net Assembly to be marked as
ComVisible and the .Net Library types to be registered, the .Net Runtime
Library for Delphi behaves differently. Even though the same COM
mechanism is used, it does not require marking the .Net classes or the
assembly with ComVisible and no registration of the .Net library types
are required. In order to access any external .Net library objects; firstly,
the external library has to be loaded onto the runtime host AppDomain
using the Load Assembly methods in the runtime host class or other
means described in Section 3 above. Secondly, create an instance of the
.Net type using the CreateInstance methods in the runtime host class or
other means described in Section 4 above. Once the instance has been
created successfully, there are 3 possible ways to access the methods
and properties and perhaps the public fields of the object instance
created. These are; using CNObject interface, using Reflection and using
COM Dispatch Interface. There are three ways to access members of .net
types: These are:

Using ClrObject Interface

Using Reflection Interfaces

35
.Net Runtime Library for Delphi

Using COM Dispatch

Using ClrObject Interface

Common Language Runtime Object (ClrObject) interface or the wrapper


class TClrObject has methods which allow you to retrieve and update
object type field values, property values or invoke methods of the object
type.

For more information, see Use ClrObject Interface .

Example in C#

C#

public Object this[Int32 index]


{
Get {...}
Set {...}
}

public bool IsData


{
Get {...}
Set {...}
}

public void GetData()


{
....
}

public void GetData(bool Accept)


{
....
}

36
.Net Runtime Library for Delphi

To access the above properties and methods in delphi using ClrObject interface, see the
example code below;

Delphi

var
clrObject: TClrObject;
Index0: OleVariant;
IsData: Boolean;
begin
//Assuming the TClrObject instance has been created

//Access the property indexer at position 0


Index0 := clrObject.GetPropertyValue('Item', 0);
//Or

37
.Net Runtime Library for Delphi

Index0 := clrObject.GetPropertyValue('Item', 'System.Int32', 0);

//Access the property IsData


IsData := clrObject.GetPropertyValue('IsData');

//Set True to the property IsData


clrObject.SetPropertyValue('IsData', True);

//Invoke the parameterless method GetData


clrObject.InvokeMethod('GetData');

//Invoke the method GetData with parameter


clrObject.InvokeMethod('GetData', 'System.Boolean', [True]);
end;

38
.Net Runtime Library for Delphi

Using Reflection Interfaces

Reflection is the ability of a code to read its own metadata for the purpose of finding
assemblies, modules and type information at runtime. In other words, reflection provides
objects that encapsulate assemblies, modules and types. A program reflects on itself by
extracting metadata from its assembly and using that metadata either to inform the user or to
modify its own behaviour. By using Reflection with the help of the Delphi Framework Library,
one is able to find out details of an object, method, and create objects and invoke methods at
runtime. The CNClrLib.Core.Intf namespace contains interfaces that provide a managed view of
loaded types, methods, and fields, with the ability to dynamically create and invoke types. For
more information, see Dynamic Programming using Reflection .

Example

Delphi

program Example;

{$APPTYPE CONSOLE}
{$R *.res}

uses
System.SysUtils,
CNClrLib.Host,
CNClrLib.Core;

var
Console: _Console;
ASQLCon: OleVariant;
ASQLConStr: WideString;
ASQLConType: _Type;
AConnProp: _PropertyInfo;
AOpenMeth,
ACloseMeth: _MethodInfo;
begin
Console := CoConsole.CreateInstance;
try
//Load Assembly by Partial Name(This load the assembly from the
GAC)
Console.WriteLine_14('Load System.Data Assembly from the GAC.
FileName: System.Data.dll');
TClrAssembly.LoadWithPartialName('System.Data');

//Create Instance of System.Data.SqlClient.SqlConnection Type


ASQLCon :=
TClrActivator.CreateInstance('System.Data.SqlClient.SqlConnection');

ASQLConStr := 'Data Source=myServerAddress;Initial Catalog=


myDataBase;UserID=myUsername;Password=myPassword';
Console.WriteLine_15('Connecting to : {0}', ASQLConStr);

ASQLConType := TClrAssembly.GetObjectType(ASQLCon);
AConnProp := ASQLConType.GetProperty_6('ConnectionString');
AConnProp.SetValue_2(ASQLCon, ASQLConStr);

AOpenMeth := ASQLConType.GetMethod_5('Open');
AOpenMeth.Invoke_2(ASQLCon, nil);
Console.WriteLine_14('Connection Opened');

39
.Net Runtime Library for Delphi

ACloseMeth := ASQLConType.GetMethod_5('Close');
ACloseMeth.Invoke_2(ASQLCon, nil);
Console.WriteLine_14('Connection Closed');
except
on E: Exception do
Console.WriteLine_15('Exception: {0}', E.Message);
end;
end.

40
.Net Runtime Library for Delphi

Using COM Dispatch

This approach is the easiest and more flexible way of accessing external .Net library types by
generating the class types in .Net library as a DispInterface type with user defined DispId. DispId
is very important when using this approach to access methods and properties of the .Net
external library types. Using the COM DispInterface, the coder does not need to register the .net
libraries; however the .Net Class methods and properties should be marked with DispId
attributes. You can either mark the .Net Class with ComVisible attribute and subsequently use
the Type Library importer in Delphi to generate Delphi library version of the .Net Library or you
can manually code a corresponding DispInterface type in Delphi making sure that the DispIds in
the properties and methods of the .Net library is the same as the DispIds in the properties and
methods of the corresponding Delphi DispInterface type. Form more information, See Access
External .Net Types using COM Dispatch.

Assuming the following class is compiled into a Mathematics.dll in c#

C#

using System.Runtime.InteropServices;

namespace Mathematics

41
.Net Runtime Library for Delphi

{
public class Mathematics
{
[DispId(0)]
public int Add(int a, int b)
{
return a + b;
}

[DispId(1)]
public int Subtract(int a, int b)
{
return a - b;
}

[DispId(2)]
public bool Equal(int a, int b)
{
return a == b;
}
}
}

42
.Net Runtime Library for Delphi

You can create a corresponding dispatch interface of the c# mathematics class in the
Mathematics.dll as follows:

Delphi

_Mathematics = dispinterface
['{D77959BD-C7AC-4D65-9980-A88510F776B8}']
function Add(a, b : Integer) : Integer; dispid 0;
function Subtract(a, b : Integer) : Integer; dispid 1;
function Equal(a, b : Integer) : WordBool; dispid 2;
end;

To create instance of the _Mathematics object and access the functions, see the code below:

Delphi

program MathematicsDemo;

{$APPTYPE CONSOLE}
{$R *.res}

uses
System.SysUtils,
CNClrLib.Host,
CNClrLib.Host.Helper,
CNClrLib.Core;

type
_Mathematics = dispinterface
['{D77959BD-C7AC-4D65-9980-A88510F776B8}']
function Add(a, b : Integer) : Integer; dispid 0;
function Subtract(a, b : Integer) : Integer; dispid 1;
function Equal(a, b : Integer) : WordBool; dispid 2;
end;

var
Console: _Console;
AMaths: _Mathematics;
begin
Console := CoConsole.CreateInstance;
try
//Load Assembly into the current Domain

43
.Net Runtime Library for Delphi

//Make sure the dll is in the same location as the EXE. If you
want to store
//the dll in a separate location, make sure you provide the full
path of the dll.
TClrAssembly.LoadFrom('Mathematics.dll');

//Create instance of the Mathematics Class


AMaths :=
_Mathematics(TClrDispatchActivator.CreateInstance('Mathematics.Mathema
tics'));

Console.WriteLine_15('Add(30, 50): {0}', AMaths.Add(30, 50));


Console.WriteLine_15('Subtract(30, 50): {0}', AMaths.Subtract(30,
50));
Console.WriteLine_15('Equal(30, 50): {0}', AMaths.Equal(30,
50));
Console.WriteLine_15('Equal(50, 50): {0}', AMaths.Equal(50,
50));
except
on E: Exception do
Console.WriteLine_15('Exception: {0}', E.Message);
end;
end.

//Output

//Add(30, 50): 80
//Subtract(30, 50): -20
//Equal(30, 50): False
//Equal(50, 50): True

3.2.7 How to: Receive First-Chance Exception


Notifications
The FirstChanceException event of the AppDomain interface lets you receive a notification that an exception has been
thrown, before the common language runtime has begun searching for exception handlers. The event is raised at the
application domain level. A thread of execution can pass through multiple application domains, so an exception that is
unhandled in one application domain could be handled in another application domain. The notification occurs in each
application domain that has added a handler for the event, until an application domain handles the exception. The
procedures and examples in this article show how to receive first-chance exception notifications in a simple program
that has one application domain, and in an application domain that you create.

Receiving First-Chance Exception Notifications in the Default


Application Domain
To demonstrate first-chance exception notifications in the default application
domain

 Define an event handler for the FirstChanceException event. In this example, the event handler prints the
name of the application domain where the event was handled and the exception's Message property.

Delphi
program FirstChanceException;

{$APPTYPE CONSOLE}

44
.Net Runtime Library for Delphi

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

var

Console: _Console;

FirstChangeEventPtr: TClrEventHandler;

procedure FirstChanceEventHandler(ASender: _ClrObject; Args:


_ClrEventArgs); stdcall;

var

EvtArgs: _FirstChanceExceptionEventArgs;

begin

EvtArgs := CoFirstChanceExceptionEventArgs.Wrap(Args.EventArgs);

Console.WriteLine_17('FirstChanceException event raised in {0}:


{1}',

TClrAppDomain.GetCurrentDomain.FriendlyName,

EvtArgs.Exception.Message);

end;

begin

Console := CoConsole.CreateInstance;

try

FirstChangeEventPtr := FirstChanceEventHandler;

TClrAppDomain.GetCurrentDomain.AddFirstChanceException(nil,
@FirstChangeEventPtr);

except

on E: Exception do

Console.WriteLine_15('Exception: {0}', E.Message);

end;

end.

45
.Net Runtime Library for Delphi

46
.Net Runtime Library for Delphi

 Throw an exception and catch it. Before the runtime locates the exception handler, the
FirstChanceException event is raised and displays a message. This message is followed
by the message that is displayed by the exception handler.

Delphi

program ThrowArgumentException;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Core;

var

Console: _Console;

ArgumentException: _ArgumentException;

begin

Console := CoConsole.CreateInstance;

try

ArgumentException := CoArgumentException.CreateInstance('Thrown in
' + TClrAppDomain.GetCurrentDomain.FriendlyName);

raise
EClrException.Create(ArgumentException.AsSystemException.AsException);

47
.Net Runtime Library for Delphi

except

on E: EClrException do

Console.WriteLine_17('ArgumentException caught in {0}: {1}',

TClrAppDomain.GetCurrentDomain.FriendlyName, E.Message);

end;

end.

48
.Net Runtime Library for Delphi

 Throw an exception, but do not catch it. Before the runtime looks for an exception
handler, the FirstChanceException event is raised and displays a message. There is no
exception handler, so the application terminates.

Delphi
program FirstChanceException2;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Core;

var

Console: _Console;

ArgumentException: _ArgumentException;

FirstChangeEventPtr: TClrEventHandler;

procedure FirstChanceEventHandler(ASender: _ClrObject; Args:


_ClrEventArgs); stdcall;

var

EvtArgs: _FirstChanceExceptionEventArgs;

begin

EvtArgs := CoFirstChanceExceptionEventArgs.Wrap(Args.EventArgs);

Console.WriteLine_17('FirstChanceException event raised in {0}:


{1}',

TClrAppDomain.GetCurrentDomain.FriendlyName,

EvtArgs.Exception.Message);

end;

begin

49
.Net Runtime Library for Delphi

Console := CoConsole.CreateInstance;

try

FirstChangeEventPtr := FirstChanceEventHandler;

TClrAppDomain.GetCurrentDomain.AddFirstChanceException(nil,
@FirstChangeEventPtr);

ArgumentException := CoArgumentException.CreateInstance('Thrown in
' + TClrAppDomain.GetCurrentDomain.FriendlyName);

EClrException.ThrowDotNetException(ArgumentException.AsSystemException
.AsException);

except

on E: EClrException do

Console.WriteLine_17('ArgumentException caught in {0}: {1}',

TClrAppDomain.GetCurrentDomain.FriendlyName, E.Message);

end;

end.

50
.Net Runtime Library for Delphi

Receiving First-Chance Exception Notifications in Another


Application Domain
If your program contains more than one application domain, you can choose which application domains receive
notifications.
To receive first-chance exception notifications in an application domain
that you create

 Define an event handler for the FirstChanceException event. This example uses a static method that prints
the name of the application domain where the event was handled and the exception's Message property.

Delphi

51
.Net Runtime Library for Delphi

procedure FirstChanceEventHandler(ASender: _ClrObject; Args:


_ClrEventArgs); stdcall;

var

EvtArgs: _FirstChanceExceptionEventArgs;

begin

EvtArgs := CoFirstChanceExceptionEventArgs.Wrap(Args.EventArgs);

Console.WriteLine_17('FirstChanceException event raised in {0}:


{1}',

TClrAppDomain.GetCurrentDomain.FriendlyName,

EvtArgs.Exception.Message);

end;

Create an application domain and add the event handler to the FirstChanceException event for that application
domain. In this example, the application domain is named AD1.

Delphi

...

var

FirstChangeEventPtr: TClrEventHandler;

AppD: TClrAppDomain;

begin

FirstChangeEventPtr := FirstChanceEventHandler;

AppD := TClrAppDomain.Create('AD1');

52
.Net Runtime Library for Delphi

AppD.AddFirstChanceException(nil, @FirstChangeEventPtr);

...

See Also
Raise and Consume Events

3.2.8 Resolving Assembly Loads


The Framework Library provides the TClrAppDomain.AssemblyResolve event for applications that require greater
control over assembly loading. By handling this event, your application can load an assembly into the load context from
outside the normal probing paths, select which of several assembly versions to load, emit a dynamic assembly and
return it, and so on. This topic provides guidance for handling the AssemblyResolve event.

Note

For resolving assembly loads in the reflection-only context, use the


TClrAppDomain.ReflectionOnlyAssemblyResolve event instead.

How the AssemblyResolve Event Works


When you register a handler for the AssemblyResolve event, the handler is invoked whenever the runtime fails to bind
to an assembly by name. For example, calling the following methods from user code can cause the AssemblyResolve
event to be raised:
 An TClrAppDomain.Load method overload or TClrAssembly.Load method overload whose first argument is a
string that represents the display name of the assembly to load (that is, the string returned by the
TClrAssembly.FullName property).
 An TClrAppDomain.Load method overload or TClrAssembly.Load method overload whose first argument is an
AssemblyName object that identifies the assembly to load.
 An TClrAssembly.LoadWithPartialName method overload.
 An TClrAppDomain.CreateInstance method overload that instantiates an object in another application
domain.

What the Event Handler Does


The handler for the AssemblyResolve event receives the display name of the assembly to be loaded, in the
ResolveEventArgs.Name property. If the handler does not recognize the assembly name, it returns null.
If the handler recognizes the assembly name, it can load and return an assembly that satisfies the request. The following
list describes some sample scenarios.

53
.Net Runtime Library for Delphi

 If the handler knows the location of a version of the assembly, it can load the assembly by using the
TClrAssembly.LoadFrom or TClrAssembly.LoadFile method, and can return the loaded assembly if successful.
 If the handler has access to a database of assemblies stored as byte arrays, it can load a byte array by using
one of the TClrAssembly.Load method overloads that take a byte array.
 The handler can generate a dynamic assembly and return it.
It is the responsibility of the event handler to return a suitable assembly. The handler can parse the display name of the
requested assembly by passing the ResolveEventArgs.Nameproperty value to the
CoAssemblyName.CreateInstance(WideString) . The event handler can return a different version of the assembly
than the version that was requested.

In most cases, the assembly that is returned by the handler appears in the load context, regardless of the context the
handler loads it into. For example, if the handler uses the TClrAssembly.LoadFrom method to load an assembly into the
load-from context, the assembly appears in the load context when the handler returns it. However, in the following case
the assembly appears without context when the handler returns it:
 The handler loads an assembly without context.
 The ResolveEventArgs.RequestingAssembly property is not null.
 The requesting assembly (that is, the assembly that is returned by the
ResolveEventArgs.RequestingAssembly property) was loaded without context.
Multiple versions of the same assembly can be loaded into the same application domain. This practice is not
recommended, because it can lead to type assignment problems.

What the Event Handler Should Not Do


The primary rule for handling the AssemblyResolve event is that you should not try to return an assembly you do not
recognize. When you write the handler, you should know which assemblies might cause the event to be raised. Your
handler should return null for other assemblies.
When loading an assembly, the event handler must not use any of the TClrAppDomain.Load or TClrAssembly.Load
method overloads that can cause the AssemblyResolve event to be raised recursively, because this can lead to a stack
overflow. This happens even if you provide exception handling for the load request, because no exception is thrown
until all event handlers have returned. Thus, the following code results in a stack overflow if MyAssembly is not found:

Delphi

program BadExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

CNClrLib.Core.Intf;

var

Console: _Console;

AssemblyResolve: TClrEventHandlerR;

54
.Net Runtime Library for Delphi

procedure MyHandler(ASender: _ClrObject; AEventArgs: _ClrEventArgs;

out ReturnValue: _ClrObject); stdcall;

var

AResolveEventArgs: _ResolveEventArgs;

begin

AResolveEventArgs := CoResolveEventArgs.Wrap(AEventArgs.EventArgs);

Console.WriteLine_15('Resolving {0}', AResolveEventArgs.Name);

ReturnValue :=
TClrAssembly.Load(AResolveEventArgs.Name).AsClrObject;

end;

begin

Console := CoConsole.CreateInstance;

AssemblyResolve := MyHandler;

TClrAppDomain.GetCurrentDomain.AddAssemblyResolve(nil,
@AssemblyResolve);

try

TClrAppDomain.GetCurrentDomain.DefaultInterface.CreateInstanceAndUnwra
p('MyAssembly, version=1.2.3.4, culture=neutral, publicKeyToken=null',

'MyType');

except

on E: Exception do

Console.WriteLine_14(E.Message);

end;

Console.ReadKey;

end.

(* This example produces output similar to the following:

55
.Net Runtime Library for Delphi

Resolving MyAssembly, Version=1.2.3.4, Culture=neutral,


PublicKeyToken=null

Resolving MyAssembly, Version=1.2.3.4, Culture=neutral,


PublicKeyToken=null

...

Resolving MyAssembly, Version=1.2.3.4, Culture=neutral,


PublicKeyToken=null

Resolving MyAssembly, Version=1.2.3.4, Culture=neutral,


PublicKeyToken=null

Process is terminated due to StackOverflowException.

*)

3.3 Create Instance of .Net Objects


In order to interact with .Net Objects's methods, properties, Fields and events, you need to
create an instance of the object. There are several ways to Create an Instance of a .Net Object in
Delphi using the Delphi Framework Library (DFL). These are:

 Using Reflection
 Using Common Language Runtime Object (ClrObject)
 Using Constructor CoClasses

Using Reflection to Create instance of .Net Objects


There are several classes and methods that can be used to create instances of .Net Objects. The
mechanism used to create these instances is through reflection. For more information about
using Reflection in Delphi using DFL. For more information, see Reflection Overview.

The following methods can be used to create instances of .Net Objects through reflections:

 TClrAppDomain.CreateInstance: This method creates a new instance of the specified


type defined in the specified assembly.

Delphi

program AppDomainCreateInstance;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

56
.Net Runtime Library for Delphi

CNClrLib.Core;

var

CurrentAppD: TClrAppDomain;

ObjHandle: _ObjectHandle;

ObjUnwrap: Variant;

begin

CurrentAppD := TClrAppDomain.GetCurrentDomain;

ObjHandle := CurrentAppD.CreateInstance('MyAssembly,
version=1.2.3.4, culture=neutral, publicKeyToken=null', 'MyType');

ObjUnwrap := ObjHandle.Unwrap_;

end.

 TClrAppDomain.CreateInstanceFrom: This method createa a new instance of a specified


type defined in the specified assembly file.

Delphi
program AppDomainCreateInstanceFrom;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

57
.Net Runtime Library for Delphi

CNClrLib.Core;

var

CurrentAppD: TClrAppDomain;

ObjHandle: _ObjectHandle;

ObjUnwrap: Variant;

begin

CurrentAppD := TClrAppDomain.GetCurrentDomain;

ObjHandle :=
CurrentAppD.CreateInstanceFrom('C:\Temp\Mathematics.dll', 'MyType');

ObjUnwrap := ObjHandle.Unwrap_;

//Note the ObjectHandle.Unwrap is different from


ObjectHandle.Unwrap_.

//The Unwrap method returns the original .Net ObjectHandle object


whereas the

//Unwrap_ returns the .net wrapped object

end.

58
.Net Runtime Library for Delphi

 TClrAppDomain.CreateComInstanceFrom: This method creates a new instance of a


specified COM type. Parameters specify the name of a file that contains an assembly
containing the type and the name of the type.

Delphi
program AppDomainCreateComInstanceFrom;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

var

CurrentAppD: TClrAppDomain;

ObjHandle: _ObjectHandle;

ObjUnwrap: Variant;

begin

CurrentAppD := TClrAppDomain.GetCurrentDomain;

ObjHandle := CurrentAppD.CreateComInstanceFrom('MyCOM_Assembly,
version=1.2.3.4, culture=neutral, publicKeyToken=null', 'MyType');

ObjUnwrap := ObjHandle.Unwrap_;

//Note the ObjectHandle.Unwrap is different from


ObjectHandle.Unwrap_.

//The Unwrap method returns the original .Net ObjectHandle object


whereas the

//Unwrap_ returns the .net wrapped object

end

59
.Net Runtime Library for Delphi

 All Create Instance Methods in TClrActivator class: The class contains methods to create
types of objects locally or remotely, or obtain references to existing remote objects.

Delphi
program ActivatorCreateInstance;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

CNClrLib.EnumTypes;

var

Obj: Variant;

ObjHandle: _ObjectHandle;

ClrObject: _ClrObject;

begin

60
.Net Runtime Library for Delphi

//This method create Instance of ArrayList type by name using that


type's default constructor

Obj := TClrActivator.CreateInstance('System.Collections.ArrayList');

//This method creates an instance of the ArrayList type by name


using the constructor that best matches the specified parameters.

//In this case the parameter is an integer, hence the ArrayList


Constructor with Capacity as parameter will be invoked.

Obj := TClrActivator.CreateInstance('System.Collections.ArrayList',
[10]);

//Same as above except this method accepts _ObjectArray

Obj := TClrActivator.CreateInstance('System.Collections.ArrayList',
TClrArrayHelper.ToObjectArray([10]));

//This method create Instance of ArrayList type using that type's


default constructor

Obj :=
TClrActivator.CreateInstance(TClrAssembly.GetType('System.Collections.
ArrayList'));

//This method creates an instance of the ArrayList type using the


constructor that best matches the specified parameters.

//In this case the parameter is an integer, hence the ArrayList


Constructor with Capacity as parameter will be invoked.

//A Binding attribute is part of the method definition which


controls the binding and the

//way in which the search for members and types is conducted by


reflection.

Obj :=
TClrActivator.CreateInstance(TClrAssembly.GetType('System.Collections.
ArrayList'),

[10], [bfInstance, bfPublic], nil);

//This method creates an instance of the type whose name is


specified, using

//the named assembly file and the constructor that best matches the
specified parameters.

//A Binding attribute is part of the method definition which


controls the binding and the

61
.Net Runtime Library for Delphi

//way in which the search for members and types is conducted by


reflection.

ObjHandle :=
TClrActivator.CreateInstanceFrom('C:\Temp\Mathematics.dll', 'SumData',

True, [bfInstance, bfPublic], nil,


TClrArrayHelper.ToObjectArray([2, 5]));

Obj := ObjHandle.Unwrap_;

//This method creates an instance of the COM object whose name is


specified.

ObjHandle := TClrActivator.CreateComInstance('MyCOM_Assembly,
version=1.2.3.4, culture=neutral, publicKeyToken=null', 'MyType');

Obj := ObjHandle.Unwrap_;

//Create an Instance of ArrayList type by name with no parameter and


return ClrObject

ClrObject :=
TClrActivator.ClrCreateInstance('System.Collections.ArrayList');

Obj := ClrObject.Unwrap;

end.

62
.Net Runtime Library for Delphi

 All the Methods in TClrDispatchActivator Class : The class contains methods to create
types of objects and return type will be Dispatch Interface instaed of Unknown Variant
(IUnknown). These create instance methods in this class are required if you want ot
create a library in .net with DispIDs and access them directly in delphi using
dispinterfaces. For more information see Access External .Net Types using COM
Dispatch.

63
.Net Runtime Library for Delphi

Delphi
program DispatchActivatorCreateInstance;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

var

Obj: IDispatch;

begin

//This method create Instance of ArrayList type by name using that


type's default constructor

Obj :=
TClrDispatchActivator.CreateInstance('System.Collections.ArrayList');

//This method creates an instance of the ArrayList type by name


using the constructor that best matches the specified parameters.

//In this case the parameter is an integer, hence the ArrayList


Constructor with Capacity as parameter will be invoked.

Obj :=
TClrDispatchActivator.CreateInstance('System.Collections.ArrayList',
[10]);

//Same as above except this method accepts _ObjectArray

Obj :=
TClrDispatchActivator.CreateInstance('System.Collections.ArrayList',
TClrArrayHelper.ToObjectArray([10]));

end.

64
.Net Runtime Library for Delphi

 TClrAssembly.CreateInstance: This method locates a type from the assembly loaded and
create an instance of it using the system activator.

Delphi
program AssemblyCreateInstance;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

CNClrLib.EnumTypes;

var

Obj: Variant;

AAsm: TClrAssembly;

begin

//Load an assembly file

AAsm := TClrAssembly.LoadFrom('C:\Temp\Mathematics.dll');

65
.Net Runtime Library for Delphi

//Create the specified type from this assembly and creates an


instance of the type by name

//with optional case-sensitive search, arguments, and binding.

Obj := AAsm.CreateInstance('Mathematics.MathsData', True,

[bfInstance, bfPublic, bfIgnoreCase],


TClrArrayHelper.ToObjectArray([10]));

end.

Using Common Object Runtime Object (ClrObject) to


create and wrap .Net Object
This is a wrapper interface which provides low-level services to all interfaces defined in the
Delphi Framework Library and .net objects. The ClrObject interface has methods and properties
which allows you to interact with the properties, fields, events and methods of the object to
which the interface is wrapped. The process of retrieving the members of the internal object is
smooth and fast. For more information see How to Use ClrObject Interface. There are 2 ways to
create instances of .Net Objects using the ClrObject. These are:

 Inherit from TClrBaseObject Class and create your own methods and properties for the
class.

C#

66
.Net Runtime Library for Delphi

//Assuming I have a C# Class which looks like this:;

// =================================================

//Compiled To: Mathematics.dll

using System;

using System.Runtime.InteropServices;

namespace Mathematics

public class Mathematics

public Mathematics()

public bool IgnoreError { get; set; }

public int Add(int a, int b)

return a + b;

public int Subtract(int a, int b)

return a - b;

public bool Equal(int a, int b)

return a == b;

67
.Net Runtime Library for Delphi

Delphi

program MathematicDLLDemo;

{$APPTYPE CONSOLE}

{$R *.res}

68
.Net Runtime Library for Delphi

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

//Delphi Representation of the above C# Class will look like below:

type

TMathematics = class(TClrBaseObject)

private

function GetIgnoreError: Boolean;

procedure SetIgnoreError(Value: Boolean);

public

constructor Create; //Default Constructor;

Destructor Destroy; override;

function Add(A, B: Integer): Integer;

function Subtract(A, B: Integer): Integer;

function Equal(A, B: Integer): Boolean;

property IgnoreError: Boolean read GetIgnoreError write


SetIgnoreError;

end;

{ TMathematics }

function TMathematics.Add(A, B: Integer): Integer;

begin

Result := InvokeMethod('Add', 'System.Int32;System.Int32', [A, B]);

end;

constructor TMathematics.Create;

begin

69
.Net Runtime Library for Delphi

inherited Create('Mathematics.Mathematics', nil);

//Note: I am not using 'inherited Create('Mathematics.Mathematics')'

//because the class is not static;

end;

destructor TMathematics.Destroy;

begin

inherited;

end;

function TMathematics.Equal(A, B: Integer): Boolean;

begin

Result := InvokeMethod('Equal', ['System.Int32', 'System.Int32'],


[A, B]);

end;

function TMathematics.GetIgnoreError: Boolean;

begin

Result := GetPropertyValue('IgnoreError');

end;

procedure TMathematics.SetIgnoreError(Value: Boolean);

begin

SetPropertyValue('IgnoreError', Value);

end;

function TMathematics.Subtract(A, B: Integer): Integer;

begin

Result := InvokeMethod('Subtract', 'System.Int32;System.Int32', [A,


B]);

end;

var

70
.Net Runtime Library for Delphi

AMaths: TMathematics;

Console: _Console;

begin

Console := CoConsole.CreateInstance;

//Load Assembly into the current Domain

//Make sure the dll is in the same location as the EXE. If you want
to store

//the dll in a separate location, make sure you provide the full
path of the dll.

TClrAssembly.LoadFrom('Mathematics.dll');

AMaths := TMathematics.Create;

try

Console.WriteLine_15('Add(30, 50): {0}', AMaths.Add(30, 50));

Console.WriteLine_15('Subtract(30, 50): {0}', AMaths.Subtract(30,


50));

Console.WriteLine_15('Equal(30, 50): {0}', AMaths.Equal(30,


50));

Console.WriteLine_15('Equal(50, 50): {0}', AMaths.Equal(50,


50));

Console.WriteLine_15('IgnoreError: {0}', AMaths.IgnoreError);

Console.WriteLine;

Console.WriteLine_14('Set IgnoreError to True');

AMaths.IgnoreError := True;

Console.WriteLine_15('IgnoreError: {0}', AMaths.IgnoreError);

finally

AMaths.Free;

end;

Console.ReadKey;

end.

//Output

//Add(30, 50): 80

71
.Net Runtime Library for Delphi

//Subtract(30, 50): -20

//Equal(30, 50): False

//Equal(50, 50): True

//IgnoreError: False

//Set IgnoreError to True

//IgnoreError: True

72
.Net Runtime Library for Delphi

73
.Net Runtime Library for Delphi

74
.Net Runtime Library for Delphi

 Use the ClrObject Interface to create wrapper instance of the original object to allow
easy access and interactions to the objects members (Fields, Properties, Members, and
Events etc.).

Delphi
program MathematicDLLDemo2;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

var

Console: _Console;

AMaths: TClrObject;

clrObject: _ClrObject;

begin

Console := CoConsole.CreateInstance;

TClrAssembly.LoadFrom('Mathematics.dll');

//Create an instance of the Mathematics type in the Mathematics.dll


and wrap it as ClrObject

clrObject :=
CoClrObject.CreateInstance(TClrAssembly.GetType('Mathematics.Mathemati
cs'), nil);

AMaths := TClrObject.Create(clrObject);

try

75
.Net Runtime Library for Delphi

Console.WriteLine_15('Add(30, 50): {0}',


AMaths.InvokeMethod('Add', 'System.Int32;System.Int32', [30, 50]));

Console.WriteLine_15('Subtract(30, 50): {0}',


AMaths.InvokeMethod('Subtract', 'System.Int32;System.Int32', [30,
50]));

Console.WriteLine_15('Equal(30, 50): {0}',


AMaths.InvokeMethod('Equal', 'System.Int32;System.Int32', [30, 50]));

Console.WriteLine_15('Equal(50, 50): {0}',


AMaths.InvokeMethod('Equal', 'System.Int32;System.Int32', [50, 50]));

Console.WriteLine_15('IgnoreError: {0}',
AMaths.GetPropertyValue('IgnoreError'));

Console.WriteLine;

Console.WriteLine_14('Set IgnoreError to True');

AMaths.SetPropertyValue('IgnoreError', True);

Console.WriteLine_15('IgnoreError: {0}',
AMaths.GetPropertyValue('IgnoreError'));

finally

AMaths.Free;

end;

Console.ReadKey;

end.

//Output

//Add(30, 50): 80

//Subtract(30, 50): -20

//Equal(30, 50): False

//Equal(50, 50): True

//IgnoreError: False

//Set IgnoreError to True

//IgnoreError: True

76
.Net Runtime Library for Delphi

77
.Net Runtime Library for Delphi

Using Constructor CoClasses


There are several classes defined in the Runtime library for creating instances of the .net
framework types. These classes are called CoClasses. For example, to create an instance of
System.io.FileStream(string path, FileMode mode) using Delphi Framework Library (DFL), use the
equivalent interface of System.io.FileStream which is _FileStream defined in DFL to create an
instance of the _FileStream using the FileStream coClass called coFileStream class. The class
has static methods called CreateInstance and each method represent the constructors defined
for the System.io.FileStream. For more information see Constructor Classes.

The following code example shows how to write data to a file, byte by byte, and then verify that
the data was written correctly using _FileStream Interface.

Delphi

program FStream;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

CNClrLib.Enums,

CNClrLib.EnumTypes,

CNClrLib.IO;

const

fileName = 'Test#@@#.dat';

78
.Net Runtime Library for Delphi

var

Console: _Console;

dataArray: _ByteArray;

random: _Random;

fileStream: _FileStream;

I: Integer;

begin

//Create static instance of the System.Console class in Delphi using


DFL

Console := CoConsole.CreateInstance;

// Create random data to write to the file.

dataArray := CoByteArray.CreateInstance(100000);

random := CoRandom.CreateInstance;

random.NextBytes(dataArray);

//Create an instance of the FileStream using CoClass of the


FileStream called coFileStream;

fileStream := CoFileStream.CreateInstance(fileName, fmCreate);

// Write the data to the file, byte by byte.

for I := 0 to dataArray.Length - 1 do

fileStream.WriteByte(dataArray[I]);

// Set the stream position to the beginning of the file.

fileStream.Seek(0, SeekOrigin_Begin);

try

// Read and verify the data.

for I := 0 to dataArray.Length - 1 do

begin

if dataArray[i] <> fileStream.ReadByte() then

begin

Console.WriteLine_14('Error writing data.');

79
.Net Runtime Library for Delphi

exit;

end;

end;

Console.WriteLine_15('The data was written to {0} and verified.',


fileStream.Name);

finally

Console.ReadKey;

end;

end.

//Output

//The data was written to ..\Test#@@#.dat and verified.

3.4 Handling and Raise Events


Events in the .NET Framework are based on the delegate model. The delegate model follows the observer design
pattern, which enables a subscriber to register with, and receive notifications from, a provider. An event sender pushes a
notification that an event has happened, and an event receiver receives that notification and defines a response to it.

Events
An event is a message sent by an object to signal the occurrence of an action. The object that raises the event is called
the event sender . The event sender doesn't know which object or method will receive (handle) the events it raises. The
event is typically a member of the event sender. The .NET Framework follows a naming pattern of ending all event data
classes with EventArgs.
Example of standard .Net framework event delegate:
C#

//Does not return anything

public delegate void StateChangeHandler (Object sender,


StateChangeEventArgs e);

//Return Boolean

public delegate bool StateChangeHandler (Object sender,


StateChangeEventArgs e);

80
.Net Runtime Library for Delphi

A delegate is a type that holds a reference to a method. A delegate is declared with a signature that shows the return
type and parameters for the methods it references, and can hold references only to methods that match its signature. A
delegate is thus equivalent to a function pointer or a callback in Delphi. The Runtime Library provides the following
delegates or function pointers to support the c# standard delegates such as the one above.
Delphi

//Does not return anything

TClrEventHandler = procedure(ASender: _ClrObject; AEventArgs:


_ClrEventArgs); stdcall;

//The value returned is stored in the last parameter

TClrEventHandlerR = procedure(ASender: _ClrObject; AEventArgs:


_ClrEventArgs; out ReturnValue: _ClrObject); stdcall;

Use the TClrEventHandler delegate for all events that do not return type value and take takes
two parameters (an object for the source of the event and an object for event data). Use the
TClrEventHandlerR delegate for all events that return type value and take three parameters (an
object for the source of the event, an object for event data and the object for the return value).
You can create your own function pointer or delegate in delphi to register a c# event whose
signature does not match the standard .Net event delegate. For Example, if a C# event delegate
looks like this:

C#

public delegate void CounterChangehandler(int Counter, int Total);

In order to hook up thios event in delphi using the runtime library, you need to create a
function pointer which matches the signature and ends with a stdcall convertion call.

Delphi

TCounterChangehandler = procedure(Counter, Total: Integer); stdcall;

81
.Net Runtime Library for Delphi

For more information and example, see Raise and Consume Events .

Event Data
Data that is associated with an event can be provided through an event data class. The Runtime
Library provides a ClrEventArgs interface that you can use in your applications. The
ClrEventArgs.EventArgs property holds the .net framework Event Data.

Event Handlers
To respond to an event, you define an event handler method in the event receiver. This method
must match the signature of the delegate for the event you are handling. In the event handler,
you perform the actions that are required when the event is raised, such as collecting user input
after the user clicks a button. To receive notifications when the event occurs, your event handler
method must subscribe to the event.

The following example shows an event handler method named c_ThresholdReached that matches the signature for
the TClrEventHandler function pointer. The method subscribes to the ThresholdReached event.
Delphi

program EventHandler;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

var

Console: _Console;

AThresholdReachedPtr: TClrEventHandler;

ACounter: _Counter;

//Method with the same signature as the Runtime Library


Delegate/Function Pointer

82
.Net Runtime Library for Delphi

//Remember to include stdcall calling convertion. This allow


parameters to be pass from right to left

//Omitting this convertion will cause access violation when the


managed code callback this event method

procedure c_ThresholdReached(ASender: _ClrObject; AEventArgs:


_ClrEventArgs); stdcall;

begin

Console.WriteLine_14('The threshold was reached.');

end;

begin

Console := CoConsole.CreateInstance;

AThresholdReachedPtr:= c_ThresholdReached;

ACounter := CoCounter.CreateInstance;

//Add Event handler

ACounter.AddThresholdReached(nil, @AThresholdReachedPtr);

//Remove Event Handler

ACounter.RemoveThresholdReached(@AThresholdReachedPtr);

end.

83
.Net Runtime Library for Delphi

Related Topics

Title Description

How to: Raise and Consume Contains examples of raising and consuming
Events events.

See Also

84
.Net Runtime Library for Delphi

ClrEventArgs
ClrEventCallbacks
ClrEventHandler

3.4.1 Raise and Consume Events


The examples in this topic show how to work with events. They include examples of the TClrEventHandler and
TClrEventHandlerR standard function pointers. There are examples which does not use the Clr Standard function
pointers. A new function pointer will be created whose signature matches the signature of the eventhander method
defined in c#.
The examples use concepts described in the Handling and Raising Events article.

Example 1
The first example shows how to raise and consume an event that doesn't have data. It contains a class named Counter
that has an event named ThresholdReached. This event is raised when a counter value equals or exceeds a threshold
value. The TClrEventHandler function pointer is associated with the event, because no event data is provided.
Assuming you have a C# class as shown below which is compiled to Counter.dll.
C#

namespace CounterEventhandler

public class Counter

private int threshold;

private int total;

public Counter(int passedThreshold)

threshold = passedThreshold;

public void Add(int x)

total += x;

if (total >= threshold)

OnThresholdReached(EventArgs.Empty);

85
.Net Runtime Library for Delphi

protected virtual void OnThresholdReached(EventArgs e)

EventHandler handler = ThresholdReached;

if (handler != null)

handler(this, e);

public event EventHandler ThresholdReached;

86
.Net Runtime Library for Delphi

Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Core;

//Delphi Implementation of the C# Class above

type

TCounter = class(TClrBaseObject)

private

FOnThresholdReached : TClrEventHandler;

procedure SetThresholdReached(Value : TClrEventHandler);

public

constructor Create(passedThreshold: Integer);

destructor Destroy; override;

procedure Add(x: Integer);

property OnThresholdReached: TClrEventHandler read


FOnThresholdReached write SetThresholdReached;

end;

{ TCounter }

procedure TCounter.Add(x: Integer);

begin

87
.Net Runtime Library for Delphi

InvokeMethod('Add', 'System.Int32', [x]);

end;

constructor TCounter.Create(passedThreshold: Integer);

begin

inherited Create('CounterEventhandler.Counter', [passedThreshold]);

end;

destructor TCounter.Destroy;

begin

inherited;

end;

procedure TCounter.SetThresholdReached(Value: TClrEventHandler);

begin

if @FOnThresholdReached <> nil then

UnRegisterEventCallBack('ThresholdReached', @FOnThresholdReached);

FOnThresholdReached := Value;

if @FOnThresholdReached <> nil then

RegisterEventCallBack('ThresholdReached', @FOnThresholdReached)

end;

var

Console: _Console;

Counter: TCounter;

procedure c_ThresholdReached(ASender: _ClrObject; AEventArgs:


_ClrEventArgs); stdcall;

begin

Console.WriteLine_14('The threshold was reached.');

Abort;

end;

88
.Net Runtime Library for Delphi

begin

Console := CoConsole.CreateInstance;

TClrAssembly.LoadFrom('Counter.dll');

Counter := TCounter.Create(CoRandom.CreateInstance.Next_2(10));

Counter.OnThresholdReached := c_ThresholdReached;

Console.WriteLine_14('press ''a'' key to increase total');

while TClrCharHelper.ToChar(Console.ReadKey_1(True).KeyChar) = 'a'


do

begin

Console.WriteLine_14('adding one');

Counter.Add(1);

end;

end.

89
.Net Runtime Library for Delphi

90
.Net Runtime Library for Delphi

Example 2
The next example shows how to raise and consume an event that provides data. The TClrEventHandler function pointer
is associated with the event, and an instance of a custom event data object is provided.
Assuming you have a C# class as shown below which is compiled to Counter.dll.
C#

namespace CounterEventhandler

class Counter

private int threshold;

private int total;

public Counter(int passedThreshold)

threshold = passedThreshold;

public void Add(int x)

total += x;

if (total >= threshold)

ThresholdReachedEventArgs args = new


ThresholdReachedEventArgs();

args.Threshold = threshold;

args.TimeReached = DateTime.Now;

OnThresholdReached(args);

protected virtual void


OnThresholdReached(ThresholdReachedEventArgs e)

91
.Net Runtime Library for Delphi

EventHandler<ThresholdReachedEventArgs> handler =
ThresholdReached;

if (handler != null)

handler(this, e);

public event ThresholdReached(Object Sender,


ThresholdReachedEventArgs e);

public class ThresholdReachedEventArgs : EventArgs

public int Threshold { get; set; }

public DateTime TimeReached { get; set; }

92
.Net Runtime Library for Delphi

Delphi

program ExampleApp1;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Core;

//Delphi Implementation of the C# Class above

type

TCounter = class(TClrBaseObject)

private

FOnThresholdReached : TClrEventHandler;

procedure SetThresholdReached(Value : TClrEventHandler);

public

93
.Net Runtime Library for Delphi

constructor Create(passedThreshold: Integer);

destructor Destroy; override;

procedure Add(x: Integer);

property OnThresholdReached: TClrEventHandler read


FOnThresholdReached write SetThresholdReached;

end;

{ TCounter }

procedure TCounter.Add(x: Integer);

begin

InvokeMethod('Add', 'System.Int32', [x]);

end;

constructor TCounter.Create(passedThreshold: Integer);

begin

inherited Create('CounterEventhandler.Counter', [passedThreshold]);

end;

destructor TCounter.Destroy;

begin

inherited;

end;

procedure TCounter.SetThresholdReached(Value: TClrEventHandler);

begin

if @FOnThresholdReached <> nil then

UnRegisterEventCallBack('ThresholdReached', @FOnThresholdReached);

FOnThresholdReached := Value;

if @FOnThresholdReached <> nil then

RegisterEventCallBack('ThresholdReached', @FOnThresholdReached)

end;

94
.Net Runtime Library for Delphi

var

Console: _Console;

Counter: TCounter;

procedure c_ThresholdReached(ASender: _ClrObject; AEventArgs:


_ClrEventArgs); stdcall;

var

ThresholdReachedEventArgs: _ClrObject;

Threshold: Integer;

TimeReached: TDateTime;

begin

//NB: The C# ThresholdReachedEventArgs class object is stored


_ClrEventArgs.EventArgs

ThresholdReachedEventArgs:= AEventArgs.EventArgs.AsClrObject;

Threshold :=
ThresholdReachedEventArgs.GetPropertyValue('Threshold');

TimeReached :=
ThresholdReachedEventArgs.GetPropertyValue('TimeReached');

Console.WriteLine_17('The threshold of {0} was reached at {1}.',


Threshold, TimeReached);

Abort;

end;

begin

Console := CoConsole.CreateInstance;

TClrAssembly.LoadFrom('Counter.dll');

Counter := TCounter.Create(CoRandom.CreateInstance.Next_2(10));

Counter.OnThresholdReached := c_ThresholdReached;

Console.WriteLine_14('press ''a'' key to increase total');

while TClrCharHelper.ToChar(Console.ReadKey_1(True).KeyChar) = 'a'


do

begin

Console.WriteLine_14('adding one');

95
.Net Runtime Library for Delphi

Counter.Add(1);

end;

end.

96
.Net Runtime Library for Delphi

Example 3
The next example shows how to raise and consume an event that provides data. The TClrEventHandlerR function
pointer is associated with theAssemblyResolve event.
Delphi

program ExampleApp2;

{$APPTYPE CONSOLE}

{$R *.res}

97
.Net Runtime Library for Delphi

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

CNClrLib.Core.Intf;

const

lookupPath = 'c:\otherbin\'; {Assuming the missing Dlls are located


in this Folder}

procedure AssemblyResolveHandler(ASender: _ClrObject; AEventArgs:


_ClrEventArgs;

out ReturnValue: _ClrObject); stdcall;

var

Args: _ResolveEventArgs;

AsmName: _AssemblyName;

AsmFileName: string;

Asmbly: _Assembly;

begin

//Convert the AEventArgs.EventArgs to the original C# event Data


which is ResolveEventArgs

Args := CoResolveEventArgs.Wrap(AEventArgs.EventArgs);

AsmName := CoAssemblyName.CreateInstance(Args.Name);

AsmFileName:= lookupPath + AsmName.Name + '.dll';

if FileExists(AsmFileName) then

begin

//Load and Convert the Assembly to ClrObject and pass to the out
parameter of the event handler;

ReturnValue := TClrAssembly.LoadFrom(AsmFileName).AsClrObject;

end

else

ReturnValue := nil;

end;

98
.Net Runtime Library for Delphi

var

Console: _Console;

AssemblyResolve: TClrEventHandlerR;

begin

Console := CoConsole.CreateInstance;

AssemblyResolve := AssemblyResolveHandler;

TClrAppDomain.GetCurrentDomain.AddAssemblyResolve(nil,
@AssemblyResolve);

try

//For this code example to run, you must provide the fully
qualified assembly name

TClrAppDomain.GetCurrentDomain.DefaultInterface.CreateInstanceAndUnwra
p('MyAssembly, '+

'version=1.2.3.4, culture=neutral, publicKeyToken=null',


'MyType');

except

on E: Exception do

Console.WriteLine_14(E.Message);

end;

Console.ReadKey;

end.

99
.Net Runtime Library for Delphi

Example 4
The next example shows how to raise and consume an event without using the standard Clr
function Pointers (TClrEventHandlerR or TClrEventHandler). A new function pointer is created
whose signature matches the signature of the eventhandler method in c#. Assuming you have a
C# class as shown below which is compiled to Counter.dll.

100
.Net Runtime Library for Delphi

C#

namespace CounterEventhandler

public class Counter

private int threshold;

private int total;

public Counter(int passedThreshold)

threshold = passedThreshold;

public void Add(int x)

total += x;

if (total >= threshold)

OnThresholdReached(total, threshold);

protected virtual void OnThresholdReached(int total, int


threshold)

EventHandler handler = ThresholdReached;

if (handler != null)

handler(this, e);

public event Action<int,int> ThresholdReached;

101
.Net Runtime Library for Delphi

The following Delphi Code demonstrate how to register the event from the C# Class without
using standard Clr function pointers and also how to unregister the event.

Delphi

program Register_UnRegisterEvents;

102
.Net Runtime Library for Delphi

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Core;

type

//Since i am not using the standard Clr Function Pointer


(TClrEvenHandler or TClrEventhandlerR),

//I am creating my own which will mimick the signature of the the C#
event i want to register.

TThresholdReached = procedure(total, threshold: Integer); stdcall;

var

Console: _Console;

clrCounter: _ClrObject;

ARandom: _Random;

OnThresholdReached : TThresholdReached;

procedure c_ThresholdReached(total, threshold: Integer); stdcall;

begin

Console.WriteLine_14('The threshold was reached.');

Abort;

end;

begin

Console := CoConsole.CreateInstance;

TClrAssembly.LoadFrom('Counter.dll');

103
.Net Runtime Library for Delphi

ARandom := CoRandom.CreateInstance;

clrCounter :=
CoClrObject.CreateInstance(TClrAssembly.GetType('CounterEventhandler.C
ounter'),

TClrArrayHelper.ToObjectArray([ARandom.Next_2(10)]));

//Register Event

OnThresholdReached := c_ThresholdReached;

clrCounter.RegisterEventCallBackDirect('ThresholdReached',
TClrConvert.ToManagedPointer(@OnThresholdReached));

Console.WriteLine_14('press ''a'' key to increase total');

while TClrCharHelper.ToChar(Console.ReadKey_1(True).KeyChar) = 'a'


do

begin

Console.WriteLine_14('adding one');

clrCounter.InvokeMethod_1('Add', 'System.Int32',
TClrArrayHelper.ToObjectArray([1]));

end;

//UnRegister Event

clrCounter.UnRegisterEventCallBackDirect('ThresholdReached',
TClrConvert.ToManagedPointer(@OnThresholdReached));

end.

104
.Net Runtime Library for Delphi

See Also
Handling and Raising Events

3.5 Use Base Interface


The _IClrObject Interface is the base interface where all the Delphi Framework Library interfaces
inherit from. It provides a common base interface for all the interfaces defined in the Dephi
Framework Library. All the library interfaces can be wrapped or cast to this base interface.

105
.Net Runtime Library for Delphi

Methods

Name Description

Unwrap Returns the wrapped object. The wrapped object is the .net
object instance of a class.

GetType Gets the Type of the current wrapped instance

AsPointer Converts the value of this wrapped object instance to a


managed pointer

AsClrObject Converts the value of this wrapped object instance to a


clrObject interface.

Example
The following example demonstrates how to cast array of integer to the base interface
_IClrObject.

Delphi

program BaseInterfaceExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.Core;

var

myData: _Int32Array;

baseIntf: _IClrObject;

begin

myData := CoInt32Array.CreateInstance(3);

myData[0] := 1;

myData[1] := 2;

myData[2] := 3;

106
.Net Runtime Library for Delphi

baseIntf := CoIClrObject.Wrap(myData);

end.

3.6 Use ClrObject Interface


This is an interface that is capable of containing almost any .net object as well as data type
value, along with type information for that value. It provides the ability to store the value, and
type information of an instance of any type. It is designed to ease the access to fields,
properties, methods and events of the stored value.

Note

All the Runtime Library interfaces have a method called AsClrObject which returns the ClrObject
interface.

The CoClass for the ClrObject interface (CoClrObject) has overload static methods called
CreateInstance and Wrap which allows you to create instance of the ClrObject type and cast a
variant to ClrObject type respectively.

Example 1

Delphi

program ClrObjectDemo;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Core;

var

Console: _Console;

ClrObject,

107
.Net Runtime Library for Delphi

InvObject: _ClrObject;

AnyVar: Variant;

begin

//Create ClrObject Instance of System.Object type

ClrObject := CoClrObject.CreateInstance;

//Create Static ClrObject Type of System.Convert

ClrObject :=
ClrHostManager.DefaultInterface.CreateStaticObject(TClrAssembly.GetTyp
e('System.Convert'));

//Create ClrObject Instance of System.String Data Value 'ClrObject


holds String Value'

ClrObject := CoClrObject.CreateInstance('ClrObject holds String


Value');

//Create ClrObject Instance of System.Boolean Data Value True

ClrObject := CoClrObject.CreateInstance(True);

//Create ClrObject Instance of System.Int32 Data Value 12345

ClrObject := CoClrObject.CreateInstance(12345);

//Create ClrObject Instance of System.Char Data Value 'c'

ClrObject :=
CoClrObject.CreateInstance(TClrCharHelper.ToClrChar('c'));

//Create ClrObject Instance of System.Decimal Data Value 4565.98676

ClrObject :=
CoClrObject.CreateInstance(TClrConvert.ToDecimal(4565.98676));

//Create ClrObject Instance of System.Double Data Value 4565.98676

ClrObject := CoClrObject.CreateInstance(4565.98676);

//Assuming this InvObject object contains a method called GetUD and


the return

//type of this method is an instance of another class.

108
.Net Runtime Library for Delphi

//

ClrObject := InvObject.InvokeMethod_('GetUD');

//Or Use the InvokeMethod which will return an IUnKnown variant

ClrObject :=
CoClrObject.CreateInstance(InvObject.InvokeMethod('GetUD'));

AnyVar := Integer(@ClrObject);// Any value type;

ClrObject := CoClrObject.CreateInstance(AnyVar);

//Create ClrObject Instance of System.Guid(String guid) type

ClrObject :=
CoClrObject.CreateInstance(TClrAssembly.GetType('System.Guid'),

TClrArrayHelper.ToObjectArray(['{7C0AE73C-599F-4EFD-
A287-ECA434B1BC40}']));

//Create ClrObject Instance of System.Collection.Generic.List<Int32>


Type

ClrObject :=
CoClrObject.CreateInstance(TClrAssembly.GetType('System.Collection.Gen
eric.List<>'),

TClrArrayHelper.ToTypeArray(['System.Int32']),

nil);

//Cast the Variant Value to ClrObject

ClrObject := CoClrObject.Wrap(AnyVar);

end.

109
.Net Runtime Library for Delphi

110
.Net Runtime Library for Delphi

ClrObject allows you to create and hold object of .net generic type. It has generic conversions
for other types (Asxxx ). Example: If you call this method AsByte , the stored value will return a
byte which is a conversion of the stored value, an error may be triggered if the value does not
support such conversion.

Getting the stored data can be done by calling the Unwrap method.

Example 2

Delphi

program UsingUnwrapMethod;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Core;

var

Console: _Console;

ClrObject: _ClrObject;

IntVal,

UnwrapVal: Integer;

begin

Console := CoConsole.CreateInstance;

IntVal := 12345;

Console.WriteLine_15('Original Data: {0}', IntVal);

//Create ClrObject Instance of System.Int32 Data Value 12345

ClrObject := CoClrObject.CreateInstance(IntVal);

111
.Net Runtime Library for Delphi

UnwrapVal := ClrObject.Unwrap;

Console.WriteLine_15('Unwrap Data: {0}', UnwrapVal);

Console.WriteLine;

Console.WriteLine_15('Same Data: {0}', IntVal = UnwrapVal);

end.

//Output

//Original Data: 12345

//Unwrap Data: 12345

//

//Same Data: True

112
.Net Runtime Library for Delphi

Access Object Fields

Examples

The following example uses the GetField overload methods to get the field-related information from the FieldInfo
interface, and then displays field attributes and get and set their values.

Delphi

//Assuming the c# code below is compiled into a dll and loaded by the
Runtime Library

(*

public class FieldInfoClass

public int myField1;

protected string myField2;

public FieldInfoClass()

myField1 = 0;

myField2 = null;

*)

program AccessFieldInfo1;

{$APPTYPE CONSOLE}

{$R *.res}

113
.Net Runtime Library for Delphi

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

CNClrLib.Enums,

CNClrLib.Core.Intf;

var

Console: _Console;

FieldInfoObj: _ClrObject;

myField1: _FieldInfo;

myField2: _FieldInfo;

procedure DisplayFieldInfo(ATarget: Variant; AField: _FieldInfo;

AChangeFieldValue: Variant);

begin

with AField do

begin

Console.WriteLine_15('Name : {0}', Name);

Console.WriteLine_15('Declaring Type : {0}', DeclaringType);

Console.WriteLine_15('IsPublic : {0}', IsPublic);

Console.WriteLine_15('MemberType : {0}', MemberType);

Console.WriteLine_15('FieldType : {0}', FieldType);

Console.WriteLine_15('IsFamily : {0}', IsFamily);

Console.WriteLine_15('GetValue : {0}',
GetValue(FieldInfoObj));

Console.WriteLine_15('Set Field Value to ''{0}''',


AChangeFieldValue);

SetValue_2(ATarget, AChangeFieldValue);

Console.WriteLine_15(GetValue : {0}',
GetValue(FieldInfoObj));

114
.Net Runtime Library for Delphi

Console.WriteLine;

end;

end;

begin

Console := CoConsole.CreateInstance;

FieldInfoObj :=
CoClrObject.CreateInstance(TClrAssembly.GetType('FieldInfoClass'),
nil);

myField1 := FieldInfoObj.GetField_1('myField1',
BindingFlags_Instance or BindingFlags_Public);

myField2 := FieldInfoObj.GetField_1('myField2',
BindingFlags_Instance or BindingFlags_NonPublic);

DisplayFieldInfo(FieldInfoObj, myField1, 2000);

DisplayFieldInfo(FieldInfoObj, myField2, 'My New String');

Console.ReadKey;

end.

115
.Net Runtime Library for Delphi

The following example uses the GetValue method to retrieve the value of a static field.

Delphi

//Assuming the c# code below is compiled into a dll and loaded by the
Runtime Library

(*

public class FieldInfoClass

public static String val = "test";

116
.Net Runtime Library for Delphi

*)

program AccessFieldInfo2;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

var

Console: _Console;

FieldInfoObj: _ClrObject;

val: string;

begin

Console := CoConsole.CreateInstance;

FieldInfoObj :=
ClrHostManager.DefaultInterface.CreateStaticObject(TClrAssembly.GetTyp
e('FieldInfoClass'));

val := FieldInfoObj.GetFieldValue('val');

Console.WriteLine_14(val);

FieldInfoObj.SetFieldValue('val', 'hi');

Console.WriteLine_14(val);

end.

// The example displays the following output:

// test

117
.Net Runtime Library for Delphi

// hi

Access Object Properties

There are methods on this interface for providing access to the stored object's property
metadata and also for returning the value of a property supported by the object.

Examples

The following example uses the GetProperty overload methods to get the property-related information from the
PropertyInfo interface, and then displays property attributes and get and set their values.

Delphi

//Assuming the c# code below is compiled into a dll and loaded by the
Runtime Library

(*

118
.Net Runtime Library for Delphi

public class PropertyInfoClass

public int myProperty { get; set; }

public PropertyInfoClass()

myProperty = 0;

*)

program AccessObjectProperty1;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

CNClrLib.Enums,

CNClrLib.Core.Intf;

var

Console: _Console;

PropertyInfoObj: _ClrObject;

myProperty: _PropertyInfo;

begin

Console := CoConsole.CreateInstance;

PropertyInfoObj :=
CoClrObject.CreateInstance(TClrAssembly.GetType('PropertyInfoClass'),
nil);

myProperty := PropertyInfoObj.GetProperty('myProperty');

119
.Net Runtime Library for Delphi

Console.WriteLine_15('Name : {0}', myProperty.Name);

Console.WriteLine_15('Declaring Type : {0}',


myProperty.DeclaringType);

Console.WriteLine_15('MemberType : {0}',
myProperty.MemberType);

Console.WriteLine_15('PropertyType : {0}',
myProperty.PropertyType);

Console.WriteLine_15('GetValue : {0}',
myProperty.GetValue(PropertyInfoObj));

Console.WriteLine_14('Set Property Value to ''123455''');

myProperty.SetValue_2(PropertyInfoObj, 123455);

Console.WriteLine_15('GetValue : {0}',
myProperty.GetValue(PropertyInfoObj));

Console.ReadKey;

end.

120
.Net Runtime Library for Delphi

The following example displays the index parameters of the specified property. Assuming the c# code below is
compiled into a dll and loaded by the Runtime Library:

C#

using System;

using System.Reflection;

// A class that contains some properties.

public class MyProperty

// Define a simple string property.

private string caption = "A Default caption";

public string Caption

get{return caption;}

set {if(caption!=value) {caption = value;}

// A very limited indexer that gets or sets one of four

// strings.

private string[] strings = {"abc", "def", "ghi", "jkl"};

121
.Net Runtime Library for Delphi

public string this[int Index]

get

return strings[Index];

set

strings[Index] = value;

Delphi
program AccessObjectProperty2;

{$APPTYPE CONSOLE}

{$R *.res}

122
.Net Runtime Library for Delphi

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

CNClrLib.Enums,

CNClrLib.Core.Intf;

var

Console: _Console;

PropertyInfoObj: _ClrObject;

piProperty: _PropertyInfo;

Parms: _ParameterInfoArray;

I: Integer;

begin

Console := CoConsole.CreateInstance;

PropertyInfoObj :=
CoClrObject.CreateInstance(TClrAssembly.GetType('MyProperty'), nil);

piProperty := PropertyInfoObj.GetProperty('Caption');

// Get the public GetIndexParameters method.

Parms := piProperty.GetIndexParameters;

Console.WriteLine_14(PropertyInfoObj.GetType.FullName + '.' +
piProperty.Name

+ ' has ' + IntToStr(Parms.GetLength(0)) + '


parameters.');

// Display a property that has parameters. The default name of an


indexer is "Item".

piProperty := PropertyInfoObj.GetProperty('Item');

Parms := piProperty.GetIndexParameters;

Console.WriteLine_14(PropertyInfoObj.GetType.FullName + '.' +
piProperty.Name

+ ' has ' + IntToStr(Parms.GetLength(0)) + '


parameters.');

123
.Net Runtime Library for Delphi

for I := 0 to Parms.Length - 1 do

Console.WriteLine_14(' Parameter: ' + Parms[I].Name);

Console.WriteLine_14('Get Value at Index 1');

Console.WriteLine_15('Value at Index 1: {0}',


PropertyInfoObj.GetPropertyValue_1('Item', 1));

Console.WriteLine_14('Set Value at Index 1 to ''efg''');

PropertyInfoObj.SetPropertyValue_7('Item', 'efg', 1);

Console.WriteLine_15('Value at Index 1: {0}',


PropertyInfoObj.GetPropertyValue_1('Item', 1));

Console.ReadKey;

end.

(*

This example produces the following output:

MyProperty.Caption has 0 parameters.

MyProperty.Item has 1 parameters.

Parameter: Index

Get Value at Index 1

Value at Index 1: def

Set Value at Index 1 to 'efg'

Value at Index 1: efg

*)

124
.Net Runtime Library for Delphi

Access and Invoke Object Methods

There are methods on this interface for providing access to the stored object's method
metadata and also for invoking the method supported by the object. The following code example
demonstrates dynamic method lookup.

Examples

Assuming the c# code below is compiled into a dll and loaded by the Runtime Library:

125
.Net Runtime Library for Delphi

C#

using System;

using System.Reflection;

public class MagicClass

private int magicBaseValue;

public MagicClass()

magicBaseValue = 9;

public int ItsMagic(int preMagic)

return preMagic * magicBaseValue;

126
.Net Runtime Library for Delphi

Delphi

program AccessObjectMethod;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

CNClrLib.Enums,

CNClrLib.Core.Intf;

var

Console: _Console;

MethodObj: _ClrObject;

magicValue: Variant;

begin

Console := CoConsole.CreateInstance;

MethodObj :=
CoClrObject.CreateInstance(TClrAssembly.GetType('MagicClass'), nil);

// Invoke ItsMagic method with a parameter value of 100

magicValue := MethodObj.InvokeMethod_1('', 'System.Int32',


TClrArrayHelper.ToObjectArray([100]));

Console.WriteLine_14('ClrObject.InvokeMethod() Example');

Console.WriteLine;

Console.WriteLine_15('MagicClass.ItsMagic() returned: {0}',


magicValue);

Console.ReadKey;

end.

127
.Net Runtime Library for Delphi

// The example program gives the following output:

//

// MethodInfo.Invoke() Example

//

// MagicClass.ItsMagic() returned: 900

128
.Net Runtime Library for Delphi

Access and Invoke Object's Generic Methods

Examples

Assuming you have the following C# Codes which has generic method ShowType<T> and is
compiled into a dll and loaded by the Runtime Library:

C#

public class Test

public void ShowType<T>()

Console.WriteLine(typeof(T));

The below example in Delphi shows how to invoke this generic method:

Delphi

program InvokeGenericMethod;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

129
.Net Runtime Library for Delphi

var

MethodObj: _ClrObject;

begin

MethodObj :=
CoClrObject.CreateInstance(TClrAssembly.GetType('Test'), nil);

MethodObj.InvokeGenericMethod('ShowType',
TClrArrayHelper.ToTypeArray(['System.Int32']));

MethodObj.InvokeGenericMethod('ShowType',
TClrArrayHelper.ToTypeArray(['System.Double']));

MethodObj.InvokeGenericMethod('ShowType',
TClrArrayHelper.ToTypeArray(['System.Object']));

end.

// The example program gives the following output:

//

// System.Int32

// System.Double

// System.Object

130
.Net Runtime Library for Delphi

Register/UnRegister Events

To register or unregister events use the RegisterEventCallBack or UnRegisterEventCallBack


methods respectively if the eventhandler method signature is the same signature of the Clr
function pointer TClrEventhandler or TClrEventHandlerR. If the Signatures are different then use
RegisterEventCallBackDirect or UnRegisterEventCallBackDirect.

1. Using RegisterEventCallBack/UnRegisterEventCallBack Methods

Assuming you have a C# class as shown below which is compiled to Counter.dll.

C#

namespace CounterEventhandler

public class Counter

private int threshold;

private int total;

public Counter(int passedThreshold)

threshold = passedThreshold;

public void Add(int x)

total += x;

if (total >= threshold)

OnThresholdReached(EventArgs.Empty);

protected virtual void OnThresholdReached(EventArgs e)

131
.Net Runtime Library for Delphi

EventHandler handler = ThresholdReached;

if (handler != null)

handler(this, e);

public event EventHandler ThresholdReached;

132
.Net Runtime Library for Delphi

The following Delphi Code demonstrate how to register the event from the C# Class using the
standard Clr function pointers and also how to unregister the events

Delphi

program Register_UnRegisterEvents;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Core;

var

Console: _Console;

clrCounter: _ClrObject;

ARandom: _Random;

OnThresholdReached : TClrEventHandler;

procedure c_ThresholdReached(ASender: _ClrObject; AEventArgs:


_ClrEventArgs); stdcall;

begin

Console.WriteLine_14('The threshold was reached.');

Abort;

end;

begin

Console := CoConsole.CreateInstance;

TClrAssembly.LoadFrom('Counter.dll');

133
.Net Runtime Library for Delphi

ARandom := CoRandom.CreateInstance;

clrCounter :=
CoClrObject.CreateInstance(TClrAssembly.GetType('CounterEventhandler.C
ounter'),

TClrArrayHelper.ToObjectArray([ARandom.Next_2(10)]));

//Register Event

OnThresholdReached := c_ThresholdReached;

clrCounter.RegisterEventCallBack('ThresholdReached',
TClrConvert.ToManagedPointer(@OnThresholdReached));

Console.WriteLine_14('press ''a'' key to increase total');

while TClrCharHelper.ToChar(Console.ReadKey_1(True).KeyChar) = 'a'


do

begin

Console.WriteLine_14('adding one');

clrCounter.InvokeMethod_1('Add', 'System.Int32',
TClrArrayHelper.ToObjectArray([1]));

end;

//UnRegister Event

clrCounter.UnRegisterEventCallBack('ThresholdReached',
TClrConvert.ToManagedPointer(@OnThresholdReached));

end.

134
.Net Runtime Library for Delphi

2. Using RegisterEventCallBackDirect/UnRegisterEventCallBackDirect
Methods

It is highly recommended to use RegisterEventCallBack or UnRegisterEventCallBack methods to


register or unregister events, however situations where the .Net standard event delegate is not
for the event delegate signature, these methods can be used to register/unregister the event,
see the example codes below:

Assuming you have a C# class as shown below which is compiled to Counter.dll.

C#

namespace CounterEventhandler

public class Counter

private int threshold;

private int total;

135
.Net Runtime Library for Delphi

public Counter(int passedThreshold)

threshold = passedThreshold;

public void Add(int x)

total += x;

if (total >= threshold)

OnThresholdReached(total, threshold);

protected virtual void OnThresholdReached(int total, int


threshold)

EventHandler handler = ThresholdReached;

if (handler != null)

handler(this, e);

public event Action<int,int> ThresholdReached;

136
.Net Runtime Library for Delphi

The following Delphi Code demonstrate how to register the event from the C# Class without
using Clr standard function pointers and also how to unregister the events

Delphi

program Register_UnRegisterEvents;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Core;

type

//Since i am not using the standard Clr Function Pointer


(TClrEvenHandler or TClrEventhandlerR),

137
.Net Runtime Library for Delphi

//I am creating my own which will mimick the signature of th C# event


i want to register.

TThresholdReached = procedure(total, threshold: Integer); stdcall;

var

Console: _Console;

clrCounter: _ClrObject;

ARandom: _Random;

OnThresholdReached : TThresholdReached;

procedure c_ThresholdReached(total, threshold: Integer); stdcall;

begin

Console.WriteLine_14('The threshold was reached.');

Abort;

end;

begin

Console := CoConsole.CreateInstance;

TClrAssembly.LoadFrom('Counter.dll');

ARandom := CoRandom.CreateInstance;

clrCounter :=
CoClrObject.CreateInstance(TClrAssembly.GetType('CounterEventhandler.C
ounter'),

TClrArrayHelper.ToObjectArray([ARandom.Next_2(10)]));

//Register Event

OnThresholdReached := c_ThresholdReached;

clrCounter.RegisterEventCallBackDirect('ThresholdReached',
TClrConvert.ToManagedPointer(@OnThresholdReached));

Console.WriteLine_14('press ''a'' key to increase total');

while TClrCharHelper.ToChar(Console.ReadKey_1(True).KeyChar) = 'a'


do

138
.Net Runtime Library for Delphi

begin

Console.WriteLine_14('adding one');

clrCounter.InvokeMethod_1('Add', 'System.Int32',
TClrArrayHelper.ToObjectArray([1]));

end;

//UnRegister Event

clrCounter.UnRegisterEventCallBackDirect('ThresholdReached',
TClrConvert.ToManagedPointer(@OnThresholdReached));

end.

139
.Net Runtime Library for Delphi

ClrObject As an Array Type

The ClrObject can be used to hold array types and the functions below allows you to access the
array information:

 function GetArrayLength: Integer;


 function GetArrayElement(Index: Integer): OleVariant;
 function GetArrayElement_(Index: Integer): _ClrObject;
 procedure SetArrayElement(Index: Integer; Value: OleVariant);
 procedure SetArrayElement_1(Index: Integer; Value: _ClrObject);
 function AsArray: _Array;
 property IsArray: WordBool;

Example

Delphi

program ArrayExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

var

140
.Net Runtime Library for Delphi

Console: _Console;

ClrObject: _ClrObject;

begin

Console := CoConsole.CreateInstance;

//Create ClrObject of an Integer array with values {0, 1, 2, 3, 4,


5}

ClrObject :=
CoClrObject.CreateInstance(TClrArrayHelper.ToInt32Array([0, 1, 2, 3,
4, 5]));

Console.WriteLine_15('Object is an Array: {0}', ClrObject.IsArray);

Console.WriteLine_15('Array Length: {0}', ClrObject.GetArrayLength);

Console.WriteLine_15('Array Element at index 3: {0}',


ClrObject.GetArrayElement(3));

Console.WriteLine_14('Set Array Element at index 3 to 300');

ClrObject.SetArrayElement(3, 300);

Console.WriteLine_15('Array Element at 3: {0}',


ClrObject.GetArrayElement(3));

end.

//Output

//Object is an Array: True

//Array Length: 6

//Array Element at index 3: 3

//Set Array Element at index 3 to 300

//Array Element at 3: 300

141
.Net Runtime Library for Delphi

Other Examples
Any C# type can be used as an ClrObject. The program shows that as an object, the reference
still is an instance of the more-derived StringBuilder type.

Delphi

program StringBuilderExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

var

Console: _Console;

ClrObject: _ClrObject;

begin

Console := CoConsole.CreateInstance;

ClrObject :=
CoClrObject.CreateInstance(CoStringBuilder.CreateInstance);

142
.Net Runtime Library for Delphi

// OR

ClrObject := CoStringBuilder.CreateInstance.AsClrObject;

Console.WriteLine_12(ClrObject.GetType);

end.

//Output

//System.Text.StringBuilder

3.7 Use Array Interfaces


An array is a special type of data type which can store fixed number of values sequentially using
special syntax. It is used to store similar data types grouping as a single unit. We can access
Array elements by its numeric index. The array indexes start at zero. The default value of
numeric array elements is set to zero. Instead of declaring individual variables, such as number0,
number1, ..., and number99, you declare one array variable such as numbers and use
numbers[0], numbers[1], and ..., numbers[99] to represent individual variables. A specific
element in an array is accessed by an index. All arrays consist of contiguous memory locations.
The lowest address corresponds to the first element and the highest address to the last
element.

Array Declaration
Below is an example of how to declare an array using the runtime library:

Delphi

var

intArray: _Int32Array; // can store int values

boolArray: _BooleanArray; // can store boolean values

stringArray: _StringArray; // can store string values

doubleArray:_DoubleArray; // can store double values

byteArray: _ByteArray; // can store byte values

byte2DimArray: _Byte2DimArray; // can store 2 dimensional byte


values

objectArray: _ObjectArray; // can store object values

baseArray: _Array; // can store any array type.

143
.Net Runtime Library for Delphi

Note

All the C# data types have an array interface equivalent in the runtime library. Example, integer 1
dimensional array is called _Int32Array. These array interfaces are declared in CNClrLib.Core.Intf
namespace.

Array Initialization
Declaring an array does not initialize the array in the memory. When the array variable is
initialized, you can assign values to the array. An array can be initialized using it own coClasses
defined in the runtime library. The following example shows the way of initializing an array.

Delphi

// defining an integer array with size 5. add values later on

intArray = CoInt32Array.CreateInstance(5);

// defining an object array with size 5.

objectArray = CoObjectArray.CreateInstance(5);

// defining array of System.Guid type with size 5.

baseArray = CoArray.CreateInstance('System.Guid', 5)

n the above example, the first statement declares & initializes int type array that can store five
int values. The size of the array is specified as a parameter of the CreateInstance method. The
second statement also creates an instance of an object array (System.Object[] in c#). The third
statement directly initializes a dynamic array of System.Guid type with a size of 5.

Accessing Array Elements

144
.Net Runtime Library for Delphi

Values can also be assigned to individual index randomly as shown below. The following
example demonstrates how to assign values to array index:

Delphi

intArray[0] := 10;

intArray[1] := 20;

intArray[2] := 30;

intArray[3] := 40;

intArray[4] := 50;

In the same way, you can retrieve values at a particular index as shown in the example below:

Delphi

intArray[0]; //returns 10

intArray[2]; //returns 30

Use a for loop to access the values from all the indexes of an array by using length property of
an array. The example below demonstrates how to access array elements using for loop.

Delphi

for i := 0 to intArray.Length - 1 do

Console.WriteLine_8(intArray[i]);

Full Example
Delphi

program ArrayApplication;

{$APPTYPE CONSOLE}

{$R *.res}

145
.Net Runtime Library for Delphi

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core;

var

Console: _Console;

intArray: _Int32Array;

i:Integer;

begin

Console := CoConsole.CreateInstance;

//intArray is an array of 10 integers

intArray := CoInt32Array.CreateInstance(10);

//initialize elements of array intArray

for I := 0 to 9 do

intArray[I] := i + 100;

Console.WriteLine_15('Array Length Before Resize: {0} ',


intArray.Length);

//Resize the array from size of 10 to 11

intArray.Resize(11);

intArray[10] := 10 + 100;

Console.WriteLine_15('Array Length After Resize: {0} ',


intArray.Length);

//output each array element's value

for I := 0 to intArray.Length - 1 do

Console.WriteLine_17('Element[{0}] = {1}', I, intArray[I]);

Console.ReadKey;

146
.Net Runtime Library for Delphi

end.

//When the above code is compiled and executed, it produces the


following result:

//Array Length Before Resize: 10

//Array Length After Resize: 11

//Element[0] = 100

//Element[1] = 101

//Element[2] = 102

//Element[3] = 103

//Element[4] = 104

//Element[5] = 105

//Element[6] = 106

//Element[7] = 107

//Element[8] = 108

//Element[9] = 109

//Element[10] = 110

147
.Net Runtime Library for Delphi

Array and ClrObjectEach array interface including the base array interface
(_Array) defined in the runtime library has a method called AsClrObject which returns a
ClrObject of the array object.

Base Array Interface


The base Array Interface is the base class for all arrays. It can be of any type. The array can be Single-
Dimensional or Multidimensional.

Example

Delphi

program BaseArrayApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

148
.Net Runtime Library for Delphi

CNClrLib.Host,

CNClrLib.Core;

var

Console: _Console;

baseArray: _Array;

i:Integer;

begin

Console := CoConsole.CreateInstance;

//Initialize the Array interface of Guid type with a size of 5

baseArray := CoArray.CreateInstance('System.Guid', 5);

//Assigning values to the array index

baseArray.SetValue('4F5C2B75-C407-46B6-A0CB-5DCD8CD708E9', 0);

baseArray.SetValue('306A5906-E576-4C12-8010-B4E88FB0EE8E', 1);

baseArray.SetValue('D0F6474D-E7BA-4392-90D3-96F8AA4E7EF1', 2);

baseArray.SetValue('1448A19F-8F8A-460C-A96A-5A51FD349341', 3);

baseArray.SetValue('17973E5C-3BC7-4B3D-AEE5-76EB33B87A47', 4);

//Accessing base Array elements

baseArray.GetValue(0); //returns '4F5C2B75-C407-46B6-A0CB-


5DCD8CD708E9'

baseArray.GetValue(2); //returns 'D0F6474D-E7BA-4392-90D3-


96F8AA4E7EF1'

//Accessing base Array elements using for loop

for i := 0 to baseArray.Length - 1 do

Console.WriteLine_12(baseArray.GetValue(i));

end.

//Output

//4f5c2b75-c407-46b6-a0cb-5dcd8cd708e9

149
.Net Runtime Library for Delphi

//306a5906-e576-4c12-8010-b4e88fb0ee8e

//d0f6474d-e7ba-4392-90d3-96f8aa4e7ef1

//1448a19f-8f8a-460c-a96a-5a51fd349341

//17973e5c-3bc7-4b3d-aee5-76eb33b87a47

150
.Net Runtime Library for Delphi

Multidimensional Arrays
Multi-dimensional arrays are also called rectangular array. The example below illustrates how to
declare, initialize and access multidimensional array elements.

Delphi

program MultDimensionalArray;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Core;

var

Console: _Console;

o2DimArray: _Array;

o3DimArray: _Array;

o4DimArray: _Array;

i, j, k, l:Integer;

intVal: Integer;

begin

Console := CoConsole.CreateInstance;

//2-dimensional array of string: initialize with Values and access


array elements

//====================================================================
==========

o2DimArray := CoArray.CreateInstance('System.String', 1, 2);

151
.Net Runtime Library for Delphi

o2DimArray.SetValue_8('test', 0, 0);

o2DimArray.SetValue_8('test2', 0, 1);

Console.WriteLine_14('Loop through 2-dimensional array');

for I := 0 to o2DimArray.GetLength(0) - 1 do

for J := 0 to o2DimArray.GetLength(1) - 1 do

Console.WriteLine_19('Element[{0}][{1}] = {2}', I, J,
o2DimArray.GetValue_4(I, J));

//3-dimensional array of string: initialize with Values and access


array elements

//====================================================================
==========

o3DimArray := CoArray.CreateInstance('System.String', 1, 2, 3);

o3DimArray.SetValue_12('test', 0, 0, 0);

o3DimArray.SetValue_12('test2', 0, 0, 1);

o3DimArray.SetValue_12('test3', 0, 0, 2);

o3DimArray.SetValue_12('test4', 0, 1, 0);

o3DimArray.SetValue_12('test5', 0, 1, 1);

o3DimArray.SetValue_12('test6', 0, 1, 2);

Console.WriteLine_14('Loop through 3-dimensional array');

for I := 0 to o3DimArray.GetLength(0) - 1 do

for J := 0 to o3DimArray.GetLength(1) - 1 do

for K := 0 to o3DimArray.GetLength(2) - 1 do

Console.WriteLine_23('Element[{0}][{1}][{2}] = {3}',

TClrArrayHelper.ToObjectArray([I, J, K,
o3DimArray.GetValue_6(I, J, K)]));

//4-dimensional array of string: initialize with Values and access


array elements

//The TClrArrayHelper.ToInt32Array is used to convert delphi integer


array to

152
.Net Runtime Library for Delphi

//.Net Integer Array

//====================================================================
==========

o4DimArray := CoArray.CreateInstance('System.String',
TClrArrayHelper.ToInt32Array([1, 2, 3, 4]));

o4DimArray.SetValue_4('test', TClrArrayHelper.ToInt32Array([0, 0, 0,
0]));

o4DimArray.SetValue_4('test2', TClrArrayHelper.ToInt32Array([0, 0,
0, 1]));

o4DimArray.SetValue_4('test3', TClrArrayHelper.ToInt32Array([0, 0,
0, 2]));

o4DimArray.SetValue_4('test4', TClrArrayHelper.ToInt32Array([0, 0,
0, 3]));

o4DimArray.SetValue_4('test5', TClrArrayHelper.ToInt32Array([0, 0,
1, 0]));

o4DimArray.SetValue_4('test6', TClrArrayHelper.ToInt32Array([0, 0,
1, 1]));

o4DimArray.SetValue_4('test7', TClrArrayHelper.ToInt32Array([0, 0,
1, 2]));

o4DimArray.SetValue_4('test8', TClrArrayHelper.ToInt32Array([0, 0,
1, 3]));

o4DimArray.SetValue_4('test9', TClrArrayHelper.ToInt32Array([0, 0,
2, 0]));

o4DimArray.SetValue_4('test10', TClrArrayHelper.ToInt32Array([0, 0,
2, 1]));

o4DimArray.SetValue_4('test11', TClrArrayHelper.ToInt32Array([0, 0,
2, 2]));

o4DimArray.SetValue_4('test12', TClrArrayHelper.ToInt32Array([0, 0,
2, 3]));

o4DimArray.SetValue_4('test13', TClrArrayHelper.ToInt32Array([0, 1,
0, 0]));

o4DimArray.SetValue_4('test14', TClrArrayHelper.ToInt32Array([0, 1,
0, 1]));

o4DimArray.SetValue_4('test15', TClrArrayHelper.ToInt32Array([0, 1,
0, 2]));

o4DimArray.SetValue_4('test16', TClrArrayHelper.ToInt32Array([0, 1,
0, 3]));

o4DimArray.SetValue_4('test17', TClrArrayHelper.ToInt32Array([0, 1,
1, 0]));

o4DimArray.SetValue_4('test18', TClrArrayHelper.ToInt32Array([0, 1,
1, 1]));

153
.Net Runtime Library for Delphi

o4DimArray.SetValue_4('test19', TClrArrayHelper.ToInt32Array([0, 1,
1, 2]));

o4DimArray.SetValue_4('test20', TClrArrayHelper.ToInt32Array([0, 1,
1, 3]));

o4DimArray.SetValue_4('test21', TClrArrayHelper.ToInt32Array([0, 1,
2, 0]));

o4DimArray.SetValue_4('test22', TClrArrayHelper.ToInt32Array([0, 1,
2, 1]));

o4DimArray.SetValue_4('test23', TClrArrayHelper.ToInt32Array([0, 1,
2, 2]));

o4DimArray.SetValue_4('test24', TClrArrayHelper.ToInt32Array([0, 1,
2, 3]));

Console.WriteLine_14('Loop through 4-dimensional array');

for I := 0 to o4DimArray.GetLength(0) - 1 do

for J := 0 to o4DimArray.GetLength(1) - 1 do

for K := 0 to o4DimArray.GetLength(2) - 1 do

for L := 0 to o4DimArray.GetLength(3) - 1 do

Console.WriteLine_23('Element[{0}][{1}][{2}][{3}] = {4}',

TClrArrayHelper.ToObjectArray([I, J, K, L,
o4DimArray.GetValue_2(

TClrArrayHelper.ToInt32Array([I, J, K, L]))]));

Console.ReadKey;

end.

//Output

//Loop through 2-dimensional array

//Element[0][0] = test

//Element[0][1] = test2

//Loop through 3-dimensional array

//Element[0][0][0] = test

//Element[0][0][1] = test2

//Element[0][0][2] = test3

154
.Net Runtime Library for Delphi

//Element[0][1][0] = test4

//Element[0][1][1] = test5

//Element[0][1][2] = test6

//Loop through 4-dimensional array

//Element[0][0][0][0] = test

//Element[0][0][0][1] = test2

//Element[0][0][0][2] = test3

//Element[0][0][0][3] = test4

//Element[0][0][1][0] = test5

//Element[0][0][1][1] = test6

//Element[0][0][1][2] = test7

//Element[0][0][1][3] = test8

//Element[0][0][2][0] = test9

//Element[0][0][2][1] = test10

//Element[0][0][2][2] = test11

//Element[0][0][2][3] = test12

//Element[0][1][0][0] = test13

//Element[0][1][0][1] = test14

//Element[0][1][0][2] = test15

//Element[0][1][0][3] = test16

//Element[0][1][1][0] = test17

//Element[0][1][1][1] = test18

//Element[0][1][1][2] = test19

//Element[0][1][1][3] = test20

//Element[0][1][2][0] = test21

//Element[0][1][2][1] = test22

//Element[0][1][2][2] = test23

//Element[0][1][2][3] = test24

155
.Net Runtime Library for Delphi

156
.Net Runtime Library for Delphi

157
.Net Runtime Library for Delphi

The following example demonstrates the use of some of the methods of the Array interface.

Delphi

program UseArrayMethods

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

158
.Net Runtime Library for Delphi

CNClrLib.Core;

var

Console: _Console;

intArray: _Int32Array;

I: Integer;

begin

Console := CoConsole.CreateInstance;

intArray := CoInt32Array.CreateInstance(8);

intArray[0] := 34;

intArray[1] := 72;

intArray[2] := 13;

intArray[3] := 13;

intArray[4] := 44;

intArray[5] := 25;

intArray[6] := 30;

intArray[7] := 10;

Console.Write_22('Original Array: ');

for I := 0 to intArray.Length - 1 do

Console.Write_22(IntToStr(intArray[I]) + ' ');

Console.WriteLine;

// reverse the array

intArray.Reverse;

Console.Write_22('Reversed Array: ');

for I := 0 to intArray.Length - 1 do

Console.Write_22(IntToStr(intArray[I]) + ' ');

Console.WriteLine;

159
.Net Runtime Library for Delphi

//sort the array

intArray.Sort;

Console.Write_22('Reversed Array: ');

for I := 0 to intArray.Length - 1 do

Console.Write_22(IntToStr(intArray[I]) + ' ');

Console.WriteLine;

Console.ReadKey;

end.

//Output

//Original Array: 34 72 13 13 44 25 30 10

//Reversed Array: 10 30 25 44 13 13 72 34

//Reversed Array: 10 13 13 25 30 34 44 72

160
.Net Runtime Library for Delphi

Array Classes and Helper


There are basically 2 array classes and an array helper class defined in the CNClrLib.Host namespace.
These are TClrArray, TClrObjectArray and TClrArrayHelper.

161
.Net Runtime Library for Delphi

TClrArray Class
The TClrArray is a class wrapper of the base array interface. It has constructors which allows you to
create one or mutidimensional array of a .net type. The example below shows how to use this class .

Delphi

var

cArray: TClrArray;

begin

//Create 1 dimensional Array of Integer type of size 5

cArray := TClrArray.Create('System.Integer', 5);

//Create 2 dimensional Array of Integer type of dimensions 5 and 3

cArray := TClrArray.Create(TClrAssembly.GetType('System.Integer'),
5, 3);

//Create 4 dimensional Array of Integer type of dimensions 5, 3 and


2

cArray := TClrArray.Create(TClrAssembly.GetType('System.Integer'),

TClrArrayHelper.ToInt32Array([5, 3, 2]));

end.

To access the element of this array, you can use the GetValue method to retrieve the element at
a specified position or SetValue method to set a value to the element at a specified position.

TClrObjectArray Class

TClrObjectArray is an array of TClrBaseObject. The array internally holds a reference to the array
interface which contains the default interface (which is the ClrObject Interface) of each elements
(TClrBaseObject) in the TClrObjectArray object. For more information, see TClrObjectArray.

162
.Net Runtime Library for Delphi

TClrArrayHelper Class

This is a helper class of an Array. This class contians static methods which allows you to convert
delphi arrays to it equivalent arrays in .net and vice versa. For more information, see
TClrArrayHelper.

3.8 Access Static Classes or Static Class


Members
A static class in c# is basically the same as a non-static class, but there is one difference: a static class cannot be
instantiated, however to use an interface which is a representation or a wrapper of c# static class. you must instantiate
the interface type using using parameterless CreateInstance before it's members can be accessed. For example,
System.Console is a static class and it interface in the CrystalNet Class Library is called _Console. To access the public
members such as writeline method of the _Console interface, you need to instantiate the interface type, you call the
method as shown in the following example:
Delphi

var

Console: _Console;

begin

// In C# you can call the WriteLine directly without

// instantiating the static class as System.Console.WriteLine,


however it is

// different using this class library

Console := CoConsole.CreateInstance;

Console.WriteLine;

end.

Static Members A non-static class can contain static methods, fields, properties, or events. If a C# non static
class has static members, then the name of the interface will be appended with Helper. Example a decimal interface is
called _Decimal, however to access the static methods of the Decimal class in c# you need to instantiate a different

163
.Net Runtime Library for Delphi

interface type called _DecimalHelper. The example below demonstrates how to access the static and non static
methods of a c# class Decimal.
Delphi

var

nonStaticDecimal: _Decimal;

StaticDecimal: _DecimalHelper;

begin

// Instantiate a non-static Decimal Type

nonStaticDecimal := CoDecimal.CreateInstance(400.90);

// Instantiate a static Decimal Type

StaticDecimal := CoDecimalHelper.CreateInstance;

end.

3.9 Use AsXXXX methods


The AsXXXX methods represent the conversion from the type to it inherited interfaces or
classes. The XXXX represent the name of the inherited class or interfaces in c#. Example
AsStream method is available to any interfaces if the class the interface represent or wrapped
in c# inherits from Stream class. So in this case, XXXX represent the Stream, the base class.

Delphi

program FromDerivedToBaseConv;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.EnumTypes,

CNClrLib.Core;

var

fileStream: _FileStream;

stream: _Stream;

idisposable: _IDisposable;

164
.Net Runtime Library for Delphi

begin

fileStream := CoFileStream.CreateInstance('C:\Temp\Test.txt',
fmOpenOrCreate);

// The fileStream in C# inherits from the Stream Class, so to


implicitly cast to the

// base class Stream use the AsXXXX method on the FileStream


interface.

stream := fileStream.AsStream;

//Convert to IDisposable interface which FileStream inherit from

idisposable := fileStream.AsIDisposable;

//To Convert back to FileStream Interface use the Wrap method

fileStream := CoFileStream.Wrap(stream);

end.

3.10 Use Collections Interfaces


Similar data can often be handled more efficiently when stored and manipulated as a collection. You can use the Array
class or the interfaces in CNClrLib.Collections namespace to add, remove, and modify either individual elements or a
range of elements in a collection.
There are two main types of collections; generic collections and non-generic collections. Generic collections were added
in the .NET Framework 2.0 and provide collections that are type-safe at compile time. Because of this, generic
collections typically offer better performance. Generic collections accept a type parameter when they are constructed
and do not require that you cast to and from the Object type when you add or remove items from the collection. Non-
generic collections store items as Object.

Common collection features


All collections provide methods for adding, removing or finding items in the collection. In addition, all collections that
directly or indirectly implement the ICollection interface share these features:
 The ability to enumerate the collection
Each Collection interface that implements System.Collections.IEnumerable or
System.Collections.Generic.IEnumerable<T> contains AsIEnumerable method which allows the collection to
be iterated through. An enumerator can be thought of as a movable pointer to any element in the collection.
 The ability to copy the collection contents to an array
All collections can be copied to an array using the CopyTo method; however, the order of the elements in the
new array is based on the sequence in which the enumerator returns them. The resulting array is always one-
dimensional with a lower bound of zero.
In addition, many collection classes contain the following features:
 Capacity and Count properties
The capacity of a collection is the number of elements it can contain. The count of a collection is the number
of elements it actually contains. Some collections hide the capacity or the count or both.
A BitArray interface is a special case; its capacity is the same as its length, which is the same as its count.
 A consistent lower bound
The lower bound of a collection is the index of its first element. All indexed collections in the
CNClrLib.Collections namespace have a lower bound of zero, meaning they are 0-indexed. Array has a lower
bound of zero by default, but a different lower bound can be defined when creating an instance of the Array
class or interface.

165
.Net Runtime Library for Delphi

 Synchronization for access from multiple threads


Non-generic collection types in the CNClrLib.Collections namespace provide some thread safety with
synchronization; typically exposed through the SyncRoot and IsSynchronized members.

Choosing a collection
In general, you should use generic collections. The following table describes some common collection scenarios and the
collection classes you can use for those scenarios. If you are new to generic collections, this table will help you choose
the generic collection that works the best for your task.

I want to. Generic collection Non-generic Thread-safe or


option(s) collection immutable collection
option(s) option(s)

Store items _GenericDictionary _Hashtable _GenericConcurrentDicti


as (A collection of onary
key/value key/value pairs _GenericReadOnlyDictio
pairs for that are organize nary
quick look- based on the
up by key hash code of the
key.)

Access _GenericList _Array No recommendation


items by Interface/TClrAr
index ray Class
_ArrayList

Use items _GenericQueue _Queue _GenericConcurrentQueu


first-in- e
first-out
(FIFO)

Use data _GenericStack _Stack _GenericConcurrentStack


Last-In-
First-Out
(LIFO)

Access _GenericLinkedList No No recommendation


items recommendation
sequentiall
y

Receive _GenericObservableColle No No recommendation


notification ction recommendation
s when
items are
removed or
added to
the
collection.

A sorted _GenericSortedList _SortedList No recommendation

166
.Net Runtime Library for Delphi

collection

A set for _GenericHashSet No No recommendation


mathemati _GenericSortedSet recommendation
cal
functions

Reference
Array Interface
TClrArray Class
CNClrLib.Collections Namespace
CNClrLib.Linq Namespace

3.10.1 Non-generic Collections


Collections are data structures that holds data in different ways for flexible operations. Non-
generic collections store items as Object. The runtime library Collection interfaces are defined as
part of the CNClrLib.Collections namespace. The following are list of some of the non-generic
collection types. with code examples.

ArrayList Collection

An ArrayList is a dynamic array. It provides random access to its elements. An ArrayList


automatically expands as data is added. Unlike arrays, an ArrayList can hold data of multiple
data types. Elements in the ArrayList are accessed via an integer index. Indexes are zero
based. Indexing of elements and insertion and deletion at the end of the ArrayList takes
constant time. Inserting or deleting an element in the middle of the dynamic array is more
costly. It takes linear time. The example below demonstrates how to create, add, remove and
access elements of an arraylist:

Delphi

program ArrayListExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Collections,

CNClrLib.Core;

167
.Net Runtime Library for Delphi

var

Console: _Console;

ArrayList: _ArrayList;

I: Integer;

begin

Console := CoConsole.CreateInstance;

//Create new instance ArrayList

ArrayList := CoArrayList.CreateInstance;

//Add elements to the ArrayList

ArrayList.Add('Pascal');

ArrayList.Add(344);

ArrayList.Add(55);

ArrayList.Add(CoClrObject.CreateInstance);

//Remove one element from the ArrayList

ArrayList.Remove(55);

//Iterate through the arraylist and print its elements to the


console

for I := 0 to ArrayList.Count - 1 do

Console.WriteLine_12(ArrayList[I]);

end.

//Output

//Pascal

//344

//System.Object

168
.Net Runtime Library for Delphi

Hashtable Collection
The Hashtable represents a collection of key/value pairs that are organized based on the hash code of the key. The
following example shows how to create, initialize and perform various functions to a Hashtable and how to print out its
keys and values.

Delphi

program HashtableExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Collections,

169
.Net Runtime Library for Delphi

CNClrLib.Core;

var

Console: _Console;

openWith: _Hashtable;

Values: _IEnumerator;

Keys: _IEnumerator;

I: Integer;

s: string;

begin

Console := CoConsole.CreateInstance;

//Create a new hash table.

//

openWith := CoHashtable.CreateInstance;

// Add some elements to the hash table. There are no

// duplicate keys, but some of the values are duplicates.

openWith.Add('txt', 'notepad.exe');

openWith.Add('bmp', 'paint.exe');

openWith.Add('dib', 'paint.exe');

openWith.Add('rtf', 'wordpad.exe');

// The Add method throws an exception if the new key is

// already in the hash table.

try

openWith.Add('txt', 'winword.exe');

except

Console.WriteLine_14('An element with Key = ''txt'' already


exists.');

end;

// The Item property is the default property, so you

170
.Net Runtime Library for Delphi

// can omit its name when accessing elements.

Console.WriteLine_15('For key = ''rtf'', value = {0}.',


openWith['rtf']);

// The default Item property can be used to change the value

// associated with a key.

openWith['rtf'] := 'winword.exe';

Console.WriteLine_15('For key = ''rtf'', value = {0}.',


openWith['rtf']);

// If a key does not exist, setting the default Item property

// for that key adds a new key/value pair.

openWith['doc'] := 'winword.exe';

// ContainsKey can be used to test keys before inserting

// them.

if not openWith.ContainsKey('ht') then

begin

openWith.Add('ht', 'hypertrm.exe');

Console.WriteLine_15('Value added for key = ''ht'': {0}',


openWith['ht']);

end;

// Use while to enumerate hash table elements;

// Use the Keys property (ICollection) inherited class called


IEnumerable in the

// form of a method in the ICollection interface called


AsIEnumerable and get the

// GetEnumerator for the keys. Enumerate through the key values and
display both the

// key and value of the hashtable per iteration.

Console.WriteLine();

Keys := openWith.Keys.AsIEnumerable.GetEnumerator;

while Keys.MoveNext do

Console.WriteLine_17('Key = {0}, Value = {1}', Keys.Current,


openWith.Item[Keys.Current]);

171
.Net Runtime Library for Delphi

// To get the values alone, use the Values property.

Values := openWith.Values.AsIEnumerable.GetEnumerator;

// The elements of the ValueCollection are strongly typed

// with the type that was specified for hash table values.

Console.WriteLine();

while Values.MoveNext do

Console.WriteLine_15('Value = {0}', Values.Current);

// Reset Keys Collection Enumerator values to point to the first


data in the list

// because it has been used above.

Keys.Reset;

// The elements of the KeyCollection are strongly typed

// with the type that was specified for hash table keys.

Console.WriteLine();

while Keys.MoveNext do

Console.WriteLine_15('Key = {0}', Keys.Current);

// Use the Remove method to remove a key/value pair.

Console.WriteLine;

Console.WriteLine_14('Remove(''doc'')');

openWith.Remove('doc');

if not openWith.ContainsKey('doc') then

Console.WriteLine_14('Key ''doc'' is not found.');

end.

(* This code example produces the following output:

An element with Key = 'txt' already exists.

172
.Net Runtime Library for Delphi

For key = 'rtf', value = wordpad.exe.

For key = 'rtf', value = winword.exe.

Value added for key = 'ht': hypertrm.exe

Key = rtf, Value = winword.exe

Key = bmp, Value = paint.exe

Key = dib, Value = paint.exe

Key = doc, Value = winword.exe

Key = txt, Value = notepad.exe

Key = ht, Value = hypertrm.exe

Value = winword.exe

Value = paint.exe

Value = paint.exe

Value = winword.exe

Value = notepad.exe

Value = hypertrm.exe

Key = rtf

Key = bmp

Key = dib

Key = doc

Key = txt

Key = ht

Remove('doc')

Key 'doc' is not found.

*)

173
.Net Runtime Library for Delphi

174
.Net Runtime Library for Delphi

175
.Net Runtime Library for Delphi

Queue Collection
The Queue represents a first-in, first-out collection of objects. The queue is implemented as a circular array. Objects
stored in a Queue are inserted at one end and removed from the other. Queues are useful when you need temporary
storage for information; that is, when you might want to discard an element after retrieving its value. Use Queue if you
need to access the information in the same order that it is stored in the collection. Queue accepts null as a valid value
and allows duplicate elements. The following example shows how to create and add values to a Queue and how to print
out its values.

Delphi

program QueueExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Collections,

CNClrLib.Core;

var

Console: _Console;

myQ: _Queue;

myCollection: _IEnumerator;

begin

Console := CoConsole.CreateInstance;

// Creates and initializes a new Queue.

myQ := CoQueue.CreateInstance;

myQ.Enqueue('Hello');

myQ.Enqueue('World');

myQ.Enqueue('!');

176
.Net Runtime Library for Delphi

// Displays the properties and values of the Queue.

Console.WriteLine_14('myQ');

Console.WriteLine_15(' Count: {0}', myQ.Count );

Console.Write_22(' Values:');

myCollection:= myQ.AsIEnumerable.GetEnumerator;

while myCollection.MoveNext do

Console.Write(' {0}', myCollection.Current);

end.

(*

This code produces the following output.

myQ

Count: 3

Values: Hello World !

*)

177
.Net Runtime Library for Delphi

Stack Collection
The stack represents a simple last-in-first-out (LIFO) non-generic collection of objects. Stacks are useful when you
need temporary storage for information; that is, when you might want to discard an element after retrieving its value.
Use Stack if you need to access the information in reverse order. Stack accepts null as a valid value and allows duplicate
elements. The following example shows how to create and add values to a Stack and how to display its values.

Delphi

program StackExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Collections,

CNClrLib.Core;

var

Console: _Console;

178
.Net Runtime Library for Delphi

myStack: _Stack;

myCollection: _IEnumerator;

begin

Console := CoConsole.CreateInstance;

// Creates and initializes a new Stack.

myStack := CoStack.CreateInstance;

myStack.Push('Hello');

myStack.Push('World');

myStack.Push('!');

// Displays the properties and values of the Stack.

Console.WriteLine_14('myStack');

Console.WriteLine_15(' Count: {0}', myStack.Count );

Console.Write_22(' Values:');

myCollection:= myStack.AsIEnumerable.GetEnumerator;

while myCollection.MoveNext do

Console.Write(' {0}', myCollection.Current);

end.

(*

This code produces the following output.

myStack

Count: 3

Values: Hello World !

*)

179
.Net Runtime Library for Delphi

SortedList Collection
The SortedList represents a collection of key/value pairs that are sorted by the keys and are accessible by key and by
index. A SortedList element can be accessed by its key, like an element in any IDictionary implementation, or by its
index, like an element in any IList implementation.. The following code example shows how to create and initialize a
SortedList object and how to print out its keys and values.

Delphi

program SortedListExample;

{$APPTYPE CONSOLE}

{$R *.res}

180
.Net Runtime Library for Delphi

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Collections,

CNClrLib.Core;

var

Console: _Console;

mySL: _SortedList;

I: Integer;

begin

Console := CoConsole.CreateInstance;

// Creates and initializes a new SortedList.

mySL := CoSortedList.CreateInstance;

mySL.Add('Third', '!');

mySL.Add('Second', 'World');

mySL.Add('First', 'Hello');

// Displays the properties and values of the SortedList.

Console.WriteLine_14('mySL');

Console.WriteLine_15(' Count: {0}', mySL.Count );

Console.WriteLine_15(' Capacity: {0}', mySL.Capacity );

Console.WriteLine_14(' Keys and Values:');

Console.WriteLine_14(' -KEY- -VALUE-');

for I := 0 to mySL.Count - 1 do

Console.WriteLine_17(' {0}: {1}', mySL.GetKey(I),


mySL.GetByIndex(I) );

end.

(*

181
.Net Runtime Library for Delphi

This code produces the following output.

mySL

Count: 3

Capacity: 16

Keys and Values:

-KEY- -VALUE-

First: Hello

Second: World

Third: !

*)

182
.Net Runtime Library for Delphi

BitArray Collections
The BitArray manages a compact array of bit values, which are represented as Booleans, where true indicates that
the bit is on (1) and false indicates the bit is off (0). The BitArray is a collection in which the capacity is always the same
as the count. Elements are added to a BitArray by increasing the Length property; elements are deleted by decreasing
the Length property. The following code example shows how to create and initialize a BitArray and how to print out its
values.

Delphi

program BitArrayExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Collections,

CNClrLib.Core;

var

Console: _Console;

myBA1: _BitArray;

myBA2: _BitArray;

myBA3: _BitArray;

myBA4: _BitArray;

myBA5: _BitArray;

183
.Net Runtime Library for Delphi

myBytes: _ByteArray;

myBools: _BooleanArray;

myInts: _Int32Array;

I: Integer;

procedure PrintValues(myList: _IEnumerator; myWidth: Integer);

var

i: Integer;

begin

i := myWidth;

while myList.MoveNext do

begin

if i <= 0 then

begin

i := myWidth;

Console.WriteLine;

end;

Dec(i);

Console.Write('{0,8}', myList.Current);

end;

Console.WriteLine;

end;

begin

Console := CoConsole.CreateInstance;

// Creates and initializes several BitArrays.

myBA1 := CoBitArray.CreateInstance(5);

myBA2 := CoBitArray.CreateInstance(5, false);

myBytes := TClrArrayHelper.ToByteArray([1, 2, 3, 4, 5]);

myBA3 := CoBitArray.CreateInstance(myBytes);

184
.Net Runtime Library for Delphi

myBools := TClrArrayHelper.ToBooleanArray([true, false, true, true,


false]);

myBA4 := CoBitArray.CreateInstance(myBools);

myInts := TClrArrayHelper.ToInt32Array([ 6, 7, 8, 9, 10]);

myBA5 := CoBitArray.CreateInstance(myInts);

// Displays the properties and values of the BitArrays.

Console.WriteLine_14('myBA1');

Console.WriteLine_15(' Count: {0}', myBA1.Count );

Console.WriteLine_15(' Length: {0}', myBA1.Length );

Console.WriteLine_14(' Values:' );

PrintValues(myBA1.GetEnumerator, 8);

Console.WriteLine_14('myBA2');

Console.WriteLine_15(' Count: {0}', myBA2.Count );

Console.WriteLine_15(' Length: {0}', myBA2.Length );

Console.WriteLine_14(' Values:' );

PrintValues(myBA2.GetEnumerator, 8);

Console.WriteLine_14('myBA3');

Console.WriteLine_15(' Count: {0}', myBA3.Count );

Console.WriteLine_15(' Length: {0}', myBA3.Length );

Console.WriteLine_14(' Values:' );

PrintValues(myBA3.GetEnumerator, 8);

Console.WriteLine_14('myBA4');

Console.WriteLine_15(' Count: {0}', myBA4.Count );

Console.WriteLine_15(' Length: {0}', myBA4.Length );

Console.WriteLine_14(' Values:' );

PrintValues(myBA4.GetEnumerator, 8);

185
.Net Runtime Library for Delphi

Console.WriteLine_14('myBA5');

Console.WriteLine_15(' Count: {0}', myBA5.Count );

Console.WriteLine_15(' Length: {0}', myBA5.Length );

Console.WriteLine_14(' Values:' );

PrintValues(myBA5.GetEnumerator, 8);

end.

(*

This code produces the following output.

myBA1

Count: 5

Length: 5

Values:

False False False False False

myBA2

Count: 5

Length: 5

Values:

False False False False False

myBA3

Count: 40

Length: 40

Values:

True False False False False False False False

False True False False False False False False

True True False False False False False False

False False True False False False False False

True False True False False False False False

myBA4

Count: 5

Length: 5

Values:

186
.Net Runtime Library for Delphi

True False True True False

myBA5

Count: 160

Length: 160

Values:

False True True False False False False False

False False False False False False False False

False False False False False False False False

False False False False False False False False

True True True False False False False False

False False False False False False False False

False False False False False False False False

False False False False False False False False

False False False True False False False False

False False False False False False False False

False False False False False False False False

False False False False False False False False

True False False True False False False False

False False False False False False False False

False False False False False False False False

False False False False False False False False

False True False True False False False False

False False False False False False False False

False False False False False False False False

False False False False False False False False

*)

187
.Net Runtime Library for Delphi

188
.Net Runtime Library for Delphi

189
.Net Runtime Library for Delphi

Comparer Interface
Compares two objects for equivalence, where string comparisons are case-sensitive. The following code example shows
how Compare returns different values depending on the culture associated with the Comparer.

Delphi

program CompareExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Collections,

CNClrLib.Core;

var

Console: _Console;

ComparerStatic: _ComparerHelper;

myCompIntl: _Comparer;

CultureInfo1: _CultureInfo;

myCompTrad: _Comparer;

190
.Net Runtime Library for Delphi

CultureInfoTrad: _CultureInfo;

str1, str2: string;

I: Integer;

begin

Console := CoConsole.CreateInstance;

// Creates the strings to compare.

str1 := 'llegar';

str2 := 'lugar';

Console.WriteLine_17('Comparing ''{0}'' and ''{1}'' ...', str1,


str2);

// Uses the DefaultInvariant Comparer.

ComparerStatic := CoComparerHelper.CreateInstance;

Console.WriteLine_15(' Invariant Comparer: {0}',


ComparerStatic.DefaultInvariant.Compare(str1, str2));

// Uses the Comparer based on the culture "es-ES" (Spanish - Spain,


international sort).

CultureInfo1 := CoCultureInfo.CreateInstance('es-ES', false);

myCompIntl := CoComparer.CreateInstance(CultureInfo1);

Console.WriteLine_15(' International Sort: {0}',


myCompIntl.Compare(str1, str2));

// Uses the Comparer based on the culture identifier 0x040A (Spanish


- Spain, traditional sort).

CultureInfoTrad := CoCultureInfo.CreateInstance($040A, false);

myCompTrad := CoComparer.CreateInstance(CultureInfoTrad);

Console.WriteLine_15(' Traditional Sort : {0}',


myCompTrad.Compare(str1, str2));

end.

(*

This code produces the following output.

191
.Net Runtime Library for Delphi

Comparing 'llegar' and 'lugar' ...

Invariant Comparer: -1

International Sort: -1

Traditional Sort : 1

*)

3.10.2 Generic Collections


Generic collections were added in the .NET Framework 2.0 and provide collections that are
type-safe at compile time. Because of this, generic collections typically offer better performance.
Generic collections accept a type parameter when they are constructed and do not require that
you cast to and from the Object type when you add or remove items from the collection. In the
runtime Library, Generics are prefixed with Generic. For example GenericList interface
represent in C# as List Class. Generics allow you to delay the specification of the data type of
programming elements in a class or a method, until it is actually used in the program. In other
words, generics allow you to write a class or method that can work with any data type. The
following are list of some of the types of the Generic Collections with code examples.

GenericList Collections
This interface represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort,
and manipulate lists. This is the generic equivalent of the ArrayList interface. GenericList accepts null as a valid
value for reference types and allows duplicate elements. Elements in this collection can be accessed using an integer
index. Indexes in this collection are zero-based. The GenericList is not guaranteed to be sorted. You must sort the
GenericList before performing operations (such as BinarySearch) that require the GenericList to be sorted. In
deciding whether to use the GenericList or ArrayList collections, both of which have similar functionality, remember
that the GenericList class performs better in most cases and is type safe.

Delphi

program GenericListExample; //List<Int32>

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Collections,

CNClrLib.Core;

var

192
.Net Runtime Library for Delphi

Console: _Console;

list: _GenericList;

listEnum: _IEnumerator;

intArray: _Int32Array;

I: Integer;

begin

Console := CoConsole.CreateInstance;

// Create a new Generic List of integer.

list :=
CoGenericList.CreateInstance(TClrAssembly.GetType('System.Int32'));

// Add some elements to the List.

list.Add(2);

list.Add(3);

list.Add(5);

list.Add(7);

// Loop through List with foreach.

for I := 0 to list.Count - 1 do

Console.WriteLine_8(list[I]);

//Change List element at index 0

Console.Write('Changed Generic List at 0 index from {0}', list[0]);

list[0] := 300;

Console.WriteLine_15(' to {0}', list[0]);

// Contains can be used to check if an item exist in the list

if list.Contains(300) then

Console.WriteLine_14('Value ''300'' in the generic list')

else

193
.Net Runtime Library for Delphi

Console.WriteLine_14('Value ''300'' not exist in the generic


list');

Console.WriteLine();

// Use while to enumerate the List elements using the IEnumerator


Interface;

Console.WriteLine_14('Loop through Generic List using IEnumerator


Interface');

listEnum := list.AsIEnumerable.GetEnumerator;

while listEnum.MoveNext do

Console.WriteLine_15('{0}', listEnum.Current);

// Use the Remove method to remove an element.

Console.WriteLine;

Console.WriteLine_14('Remove(300)');

list.Remove(300);

if not list.Contains(300) then

Console.WriteLine_14('Value ''300'' is not found.');

end.

(* This code example produces the following output:

Changed Generic List at 0 index from 2 to 300

Value '300' in the generic list

Loop through Generic List using IEnumerator Interface

194
.Net Runtime Library for Delphi

300

Remove(300)

Value '300' is not found.

*)

195
.Net Runtime Library for Delphi

196
.Net Runtime Library for Delphi

GenericDictionary Collections
This interface represents a collection of keys and values. It provides a mapping from a set of keys to a set of values. Each
addition to the dictionary consists of a value and its associated key. Retrieving a value by using its key is very fast. The
following code example creates an empty GenericDictionary of strings with string keys and uses the Add method to
add some elements. The example demonstrates that the Add method throws an ArgumentException when attempting
to add a duplicate key. The example uses the Item property to retrieve values, demonstrating that a
KeyNotFoundException is thrown when a requested key is not present, and showing that the value associated with a
key can be replaced. The example shows how to use the TryGetValue method as a more efficient way to retrieve values
if a program often must try key values that are not in the dictionary, and it shows how to use the ContainsKey method
to test whether a key exists before calling the Add method. The example shows how to enumerate the keys and values
in the dictionary and how to enumerate the keys and values alone using the Keys property and the Values property.
Finally, the example demonstrates the Remove method.

Delphi

program GenericDictionaryExample; //Dictionary<String, String>

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Collections,

CNClrLib.Core,

System.Win.ComObj;

var

Console: _Console;

openWith: _GenericDictionary;

Values: _IEnumerator;

Keys: _IEnumerator;

ClrEx: EClrException;

I: Integer;

s: string;

197
.Net Runtime Library for Delphi

value: OleVariant;

begin

Console := CoConsole.CreateInstance;

// Create a new dictionary of strings, with string keys.

//

openWith :=
CoGenericDictionary.CreateInstance(TClrAssembly.GetType('System.String
'),

TClrAssembly.GetType('System.String'));

// Add some elements to the dictionary. There are no

// duplicate keys, but some of the values are duplicates.

openWith.Add('txt', 'notepad.exe');

openWith.Add('bmp', 'paint.exe');

openWith.Add('dib', 'paint.exe');

openWith.Add('rtf', 'wordpad.exe');

// The Add method throws an exception if the new key is

// already in the dictionary.

try

openWith.Add('txt', 'winword.exe');

except

on Eole: EOleSysError do

begin

ClrEx := EClrException.GetLastClrException;

try

if ClrEx.IsTypeOf('System.ArgumentException') then

Console.WriteLine_14('An element with Key = ''txt'' already


exists.');

finally

ClrEx.Free;

end;

end;

198
.Net Runtime Library for Delphi

end;

// The Item property is the default property, so you

// can omit its name when accessing elements.

Console.WriteLine_15('For key = ''rtf'', value = {0}.',


openWith['rtf']);

// The default Item property can be used to change the value

// associated with a key.

openWith['rtf'] := 'winword.exe';

Console.WriteLine_15('For key = ''rtf'', value = {0}.',


openWith['rtf']);

// If a key does not exist, setting the default Item property

// for that key adds a new key/value pair.

openWith['doc'] := 'winword.exe';

// The indexer throws an exception if the requested key is

// not in the dictionary.

try

Console.WriteLine_15('For key = ''tif'', value = {0}.',


openWith['tif']);

except

on Eole: EOleSysError do

begin

ClrEx := EClrException.GetLastClrException;

try

if
ClrEx.IsTypeOf('System.Collections.Generic.KeyNotFoundException') then

Console.WriteLine_14('Key = ''tif'' is not found.');

finally

ClrEx.Free;

end;

end;

end;

199
.Net Runtime Library for Delphi

// When a program often has to try keys that turn out not to

// be in the dictionary, TryGetValue can be a more efficient

// way to retrieve values.

value := '';

if openWith.TryGetValue('tif', value) then

Console.WriteLine_15('For key = ''tif'', value = {0}.', value)

else

Console.WriteLine_14('Key = ''tif'' is not found.');

// ContainsKey can be used to test keys before inserting

// them.

if not openWith.ContainsKey('ht') then

begin

openWith.Add('ht', 'hypertrm.exe');

Console.WriteLine_15('Value added for key = ''ht'': {0}',


openWith['ht']);

end;

// Use while to enumerate the dictionary elements;

// Use the Keys property (ICollection) inherited class called


IEnumerable in the

// form of a method in the ICollection interface called


AsIEnumerable and get the

// GetEnumerator for the keys. Enumerate through the key values and
display both the

// key and value of the dictionary per iteration.

Console.WriteLine();

Keys := openWith.Keys.AsIEnumerable.GetEnumerator;

while Keys.MoveNext do

Console.WriteLine_17('Key = {0}, Value = {1}', Keys.Current,


openWith.Item[Keys.Current]);

// To get the values alone, use the Values property.

Values := openWith.Values.AsIEnumerable.GetEnumerator;

200
.Net Runtime Library for Delphi

// The elements of the ValueCollection are strongly typed

// with the type that was specified for hash table values.

Console.WriteLine();

while Values.MoveNext do

Console.WriteLine_15('Value = {0}', Values.Current);

// Reset Keys Collection Enumerator values to point to the first


data in the list

// because it has been used above.

Keys.Reset;

// The elements of the KeyCollection are strongly typed

// with the type that was specified for hash table keys.

Console.WriteLine();

while Keys.MoveNext do

Console.WriteLine_15('Key = {0}', Keys.Current);

// Use the Remove method to remove a key/value pair.

Console.WriteLine;

Console.WriteLine_14('Remove(''doc'')');

openWith.Remove('doc');

if not openWith.ContainsKey('doc') then

Console.WriteLine_14('Key ''doc'' is not found.');

end.

(* This code example produces the following output:

An element with Key = 'txt' already exists.

For key = 'rtf', value = wordpad.exe.

For key = 'rtf', value = winword.exe.

Key = 'tif' is not found.

201
.Net Runtime Library for Delphi

Key = 'tif' is not found.

Value added for key = 'ht': hypertrm.exe

Key = txt, Value = notepad.exe

Key = bmp, Value = paint.exe

Key = dib, Value = paint.exe

Key = rtf, Value = winword.exe

Key = doc, Value = winword.exe

Key = ht, Value = hypertrm.exe

Value = notepad.exe

Value = paint.exe

Value = paint.exe

Value = winword.exe

Value = winword.exe

Value = hypertrm.exe

Key = txt

Key = bmp

Key = dib

Key = rtf

Key = doc

Key = ht

Remove('doc')

Key 'doc' is not found.

*)

202
.Net Runtime Library for Delphi

203
.Net Runtime Library for Delphi

204
.Net Runtime Library for Delphi

205
.Net Runtime Library for Delphi

GenericHashSet Collections
This interface represents a set of values. It provides high-performance set operations. A set is a collection that
contains no duplicate elements, and whose elements are in no particular order. The following example demonstrates
how to merge two disparate sets. This example creates two GenericHashSet objects, and populates them with even and
odd numbers, respectively. A third GenericHashSet object is created from the set that contains the even numbers. The
example then calls the UnionWith method, which adds the odd number set to the third set.

Delphi

program GenericHashSetExample; //HashSet<Int32>

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Collections,

CNClrLib.Core;

var

Console: _Console;

evenNumbers: _GenericHashSet;

oddNumbers: _GenericHashSet;

numbers: _GenericHashSet;

intType: _Type;

i: Integer;

procedure DisplaySet(Aset: _GenericHashSet);

var

ASetEnum: _IEnumerator;

begin

Console.Write_22('{');

206
.Net Runtime Library for Delphi

ASetEnum := Aset.AsIEnumerable.GetEnumerator;

while ASetEnum.MoveNext do

Console.Write(' {0}', ASetEnum.Current);

Console.WriteLine_14(' }');

end;

begin

Console := CoConsole.CreateInstance;

intType := TClrAssembly.GetType('System.Int32');

evenNumbers := CoGenericHashSet.CreateInstance(intType);

oddNumbers := CoGenericHashSet.CreateInstance(intType);

for i := 0 to 4 do

begin

// Populate numbers with just even numbers.

evenNumbers.Add(i * 2);

// Populate oddNumbers with just odd numbers.

oddNumbers.Add((i * 2) + 1);

end;

Console.Write('evenNumbers contains {0} elements: ',


evenNumbers.Count);

DisplaySet(evenNumbers);

Console.Write('oddNumbers contains {0} elements: ',


oddNumbers.Count);

DisplaySet(oddNumbers);

// Create a new HashSet populated with even numbers.

numbers := CoGenericHashSet.CreateInstance(evenNumbers);

207
.Net Runtime Library for Delphi

Console.WriteLine_14('numbers UnionWith oddNumbers...');

numbers.UnionWith(oddNumbers.AsGenericIEnumerable);

Console.Write('numbers contains {0} elements: ', numbers.Count);

DisplaySet(numbers);

end.

(* This code example produces the following output:

evenNumbers contains 5 elements: { 0 2 4 6 8 }

oddNumbers contains 5 elements: { 1 3 5 7 9 }

numbers UnionWith oddNumbers...

numbers contains 10 elements: { 0 2 4 6 8 1 3 5 7 9 }

*)

208
.Net Runtime Library for Delphi

209
.Net Runtime Library for Delphi

GenericLinkedList Collections
This interface represent a doubly linked list. It is a general-purpose linked list. GenericLinkedList provides
separate nodes of type GenericLinkedListNode, so insertion and removal are O(1) operations. You can remove nodes
and reinsert them, either in the same list or in another list, which results in no additional objects allocated on the heap.
The following code example demonstrates many features of the GenericLinkedList interface.

Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Collections,

CNClrLib.Core,

System.Variants,

System.Win.ComObj;

var

Console: _Console;

words: _StringArray;

sArray: _GenericArray;

stringType: _Type;

sentence: _GenericLinkedList;

mark1: _GenericLinkedListNode;

mark2: _GenericLinkedListNode;

current: _GenericLinkedListNode;

icoll: _GenericICollection;

ClrEx: EClrException;

s: string;

I: Integer;

210
.Net Runtime Library for Delphi

procedure Display(words: _GenericLinkedList; test: string);

var

AEnumerator: _IEnumerator;

begin

Console.WriteLine_14(test);

AEnumerator := words.AsIEnumerable.GetEnumerator;

while AEnumerator.MoveNext do

Console.Write_22(AEnumerator.Current + ' ');

Console.WriteLine;

Console.WriteLine;

end;

procedure IndicateNode(node: _GenericLinkedListNode; test: string);

var

result: _StringBuilder;

nodeP: _GenericLinkedListNode;

begin

Console.WriteLine_14(test);

if node.List = nil then

begin

Console.WriteLine_15('Node ''{0}'' is not in the list.',


node.Value);

Console.WriteLine;

exit;

end;

result := CoStringBuilder.CreateInstance('(' +
VarToStr(node.Value) + ')');

nodeP := node.Previous;

while nodeP <> nil do

begin

result.Insert_17(0, nodeP.Value + ' ');

211
.Net Runtime Library for Delphi

nodeP := nodeP.Previous;

end;

node := node.Next;

while nodeP <> nil do

begin

result.Append_17(' ' + node.Value);

node := node.Next;

end;

Console.WriteLine_12(result);

Console.WriteLine;

end;

begin

Console := CoConsole.CreateInstance;

// Create the link list.

words := TClrArrayHelper.ToStringArray(['the', 'fox', 'jumped',


'over', 'the', 'dog']);

stringType := TClrAssembly.GetType('System.String');

//Convert the StringArray to

sentence :=
CoGenericLinkedList.CreateInstance(words.AsArray.AsGenericIEnumerable)
;

Display(sentence, 'The linked list values:');

Console.WriteLine_15('sentence.Contains(''jumped'') = {0}',
sentence.Contains('jumped'));

// Add the word 'today' to the beginning of the linked list.

sentence.AddFirst('today');

Display(sentence, 'Test 1: Add ''today'' to beginning of the


list:');

212
.Net Runtime Library for Delphi

// Move the first node to be the last node.

mark1 := sentence.First;

sentence.RemoveFirst;

sentence.AddLast_2(mark1);

Display(sentence, 'Test 2: Move first node to be last node:');

// Change the last node be 'yesterday'.

sentence.RemoveLast;

sentence.AddLast('yesterday');

Display(sentence, 'Test 3: Change the last node to ''yesterday'':');

// Move the last node to be the first node.

mark1 := sentence.Last;

sentence.RemoveLast;

sentence.AddFirst_2(mark1);

Display(sentence, 'Test 4: Move last node to be first node:');

// Indicate, by using parentheisis, the last occurence of 'the'.

sentence.RemoveFirst();

current := sentence.FindLast('the');

IndicateNode(current, 'Test 5: Indicate last occurence of


''the'':');

// Add 'lazy' and 'old' after 'the' (the LinkedListNode named


current).

sentence.AddAfter_1(current, 'old');

sentence.AddAfter_1(current, 'lazy');

IndicateNode(current, 'Test 6: Add ''lazy'' and ''old'' after


''the'':');

// Indicate 'fox' node.

current := sentence.Find('fox');

IndicateNode(current, 'Test 7: Indicate the ''fox'' node:');

213
.Net Runtime Library for Delphi

// Add 'quick' and 'brown' before 'fox':

sentence.AddBefore(current, 'quick');

sentence.AddBefore(current, 'brown');

IndicateNode(current, 'Test 8: Add ''quick'' and ''brown'' before


''fox'':');

// Keep a reference to the current node, 'fox',

// and to the previous node in the list. Indicate the 'dog' node.

mark1 := current;

mark2 := current.Previous;

current := sentence.Find('dog');

IndicateNode(current, 'Test 9: Indicate the ''dog'' node:');

// The AddBefore method throws an InvalidOperationException

// if you try to add a node that already belongs to a list.

Console.WriteLine_14('Test 10: Throw exception by adding node (fox)


already in the list:');

try

sentence.AddBefore(current, mark1);

except

on Ex: EOleSysError do

begin

ClrEx := EClrException.GetLastClrException;

try

if ClrEx.IsTypeOf('System.InvalidOperationException') then

Console.WriteLine_15('Exception message: {0}', Ex.Message);

finally

ClrEx.Free;

end;

end;

end;

Console.WriteLine;

214
.Net Runtime Library for Delphi

// Remove the node referred to by mark1, and then add it

// before the node referred to by current.

// Indicate the node referred to by current.

sentence.Remove_2(mark1);

sentence.AddBefore_2(current, mark1);

IndicateNode(current, 'Test 11: Move a referenced node (fox) before


the current node (dog):');

// Remove the node referred to by current.

sentence.Remove_2(current);

IndicateNode(current, 'Test 12: Remove current node (dog) and


attempt to indicate it:');

// Add the node after the node referred to by mark2.

sentence.AddAfter(mark2, current);

IndicateNode(current, 'Test 13: Add node removed in test 11 after a


referenced node (brown):');

// The Remove method finds and removes the

// first node that that has the specified value.

sentence.Remove('old');

Display(sentence, 'Test 14: Remove node that has the value


''old'':');

Console.WriteLine_14('Test 15: Copy the list to an array:');

// Create an array with the same number of

// elements as the inked list.

sArray := CoGenericArray.CreateInstance(stringType, sentence.Count);

sentence.CopyTo(sArray, 0);

for I := 0 to sArray.Length - 1 do

Console.WriteLine_12(sArray.GetValue(I));

// Release all the nodes.

sentence.Clear();

215
.Net Runtime Library for Delphi

Console.WriteLine();

Console.WriteLine_15('Test 16: Clear linked list. Contains


''jumped'' = {0}',

sentence.Contains('jumped'));

Console.ReadLine();

end.

(* This code example produces the following output:

The linked list values:

the fox jumped over the dog

sentence.Contains('jumped') = True

Test 1: Add 'today' to beginning of the list:

today the fox jumped over the dog

Test 2: Move first node to be last node:

the fox jumped over the dog today

Test 3: Change the last node to 'yesterday':

the fox jumped over the dog yesterday

Test 4: Move last node to be first node:

yesterday the fox jumped over the dog

Test 5: Indicate last occurence of 'the':

the fox jumped over (the)

Test 6: Add 'lazy' and 'old' after 'the':

the fox jumped over (the)

216
.Net Runtime Library for Delphi

Test 7: Indicate the 'fox' node:

the (fox)

Test 8: Add 'quick' and 'brown' before 'fox':

the quick brown (fox)

Test 9: Indicate the 'dog' node:

the quick brown fox jumped over the lazy old (dog)

Test 10: Throw exception by adding node (fox) already in the list:

Test 11: Move a referenced node (fox) before the current node (dog):

the quick brown jumped over the lazy old fox (dog)

Test 12: Remove current node (dog) and attempt to indicate it:

Node 'dog' is not in the list.

Test 13: Add node removed in test 11 after a referenced node (brown):

the quick brown (dog)

Test 14: Remove node that has the value 'old':

the quick brown dog jumped over the lazy fox

Test 15: Copy the list to an array:

the

quick

brown

dog

jumped

over

the

lazy

fox

217
.Net Runtime Library for Delphi

Test 16: Clear linked list. Contains 'jumped' = False

*)

218
.Net Runtime Library for Delphi

219
.Net Runtime Library for Delphi

220
.Net Runtime Library for Delphi

221
.Net Runtime Library for Delphi

222
.Net Runtime Library for Delphi

GenericStack Collections
This interface represents a variable size last-in-first-out (LIFO) collection of instances of the same specified type.
Stacks are useful when you need temporary storage for information; that is, when you might want to discard an element
after retrieving its value. Use GenericQueue if you need to access the information in the same order that it is stored in
the collection. Use GenericStack if you need to access the information in reverse order. GenericStack accepts
null as a valid value for reference types and allows duplicate elements. The following code example demonstrates
several methods of the GenericStack interface. The code example creates a stack of strings with default capacity
and uses the Push method to push five strings onto the stack. The elements of the stack are enumerated, which does
not change the state of the stack. The Pop method is used to pop the first string off the stack. The Peek method is used
to look at the next item on the stack, and then the Pop method is used to pop it off.

Delphi

program GenericStackExample; // Stack<String>

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Collections,

CNClrLib.Core;

var

Console: _Console;

numbers: _GenericStack;

stack2: _GenericStack;

stackEnum: _IEnumerator;

stack2Enum: _IEnumerator;

stringType: _Type;

223
.Net Runtime Library for Delphi

begin

Console := CoConsole.CreateInstance;

stringType := TClrAssembly.GetType('System.String');

numbers := CoGenericStack.CreateInstance(stringType);

numbers.Push('one');

numbers.Push('two');

numbers.Push('three');

numbers.Push('four');

numbers.Push('five');

// A stack can be enumerated without disturbing its contents.

stackEnum := numbers.AsIEnumerable.GetEnumerator;

while stackEnum.MoveNext do

Console.WriteLine_12(stackEnum.Current);

Console.WriteLine;

Console.WriteLine_15('Popping ''{0}''', numbers.Pop());

Console.WriteLine_15('Peek at next item to destack: {0}',

numbers.Peek());

Console.WriteLine_15('Popping ''{0}''', numbers.Pop());

// Create a copy of the stack, using the AsGenericIEnumerable method


and the

// constructor that accepts a Generic Object which can be


GenericIEnumerable,

// GenericStack etc

stack2 :=
CoGenericStack.CreateInstance(numbers.AsGenericIEnumerable);

Console.WriteLine_14('Contents of the first copy:');

stack2Enum := stack2.AsIEnumerable.GetEnumerator;

224
.Net Runtime Library for Delphi

while stack2Enum.MoveNext do

Console.WriteLine_12(stack2Enum.Current);

Console.WriteLine;

Console.WriteLine_15('stack2.Contains(''four'') = {0}',
stack2.Contains('four'));

Console.WriteLine_14('stack2.Clear()');

stack2.Clear();

Console.WriteLine_15('stack2.Count = {0}', stack2.Count);

end.

(* This code example produces the following output:

five

four

three

two

one

Popping 'five'

Peek at next item to destack: four

Popping 'four'

Contents of the first copy:

one

two

three

stack2.Contains('four') = False

stack2.Clear()

stack2.Count = 0

*)

225
.Net Runtime Library for Delphi

3.11 Use Linq and Dynamic Linq


Interfaces
LINQ (Language Integrated Query) is uniform query syntax used to save and retrieve data from
different sources. It provides a single querying interface for different types of data sources. For
example, SQL is a Structured Query Language used to save and retrieve data from a database.
In the same way, LINQ is a structured query syntax used to save and retrieve data from different
types of data sources like an Object Collection, SQL server database, XML, web service etc. LINQ
always works with objects so you can use the same basic coding patterns to query and
transform data in XML documents, SQL databases, ADO.NET Datasets, .NET collections, and any
other format for which a LINQ provider is available.
LINQ is nothing but the collection of methods for interfaces with methods AsIEnumerable and
AsIQueryable. Linq interfaces can be defined in CNClrLib.Linq namespaces and Dynamic Linq
interfaces are defined in CNClrLib.DynamicLinq namespace. LINQ has two main interfaces:
Theses are:

1. Enumerable Interface
2. Queryable Interface

Enumerable Interface
Enumerable interface includes methods for interfaces that has AsGenericIEnumerable method,
this include all the generic collection types such as GenericList interface, GenericDictionary
interface, GenericSortedList interface, GenericQueue interface, GenericHashSet interface,
GenericLinkedList interface etc. The following demonstrates how to use Enumerable interface
methods such as First, FirstOrDefault, Last, LastOrDefault, Single, SingleOrDefault,
ElementAt, ElementAtOrDefault, Count, Contains, Sum, Min, Max. The other methods such
as Select, where etc which accepts a generic predicate can only be used if the predicate
method is defined in a .net assembly. In future version, you will be able to create
GenericPredicate interface from a delphi function pointer. In the meantime there is an
alternative solution which is to use Dynamic Linq. The next Linq interface (Queryable Interface)
explains how to use the dynamic Linq methods.

Delphi

program LinqWithEnumerableInterface;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

226
.Net Runtime Library for Delphi

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Collections,

CNClrLib.DynamicLinq,

CNClrLib.Linq,

CNClrLib.Core;

var

Console: _Console;

IntList: _GenericList;

intType: _Type;

Enumerable: _Enumerable;

ListEnumerable: _GenericIEnumerable;

I: Integer;

begin

Console := CoConsole.CreateInstance;

//Integer Type

intType := TClrAssembly.GetType('System.Int32');

//Integer Collections

IntList := CoGenericList.CreateInstance(intType);

IntList.Add(33);

IntList.Add(45);

IntList.Add(50);

IntList.Add(45);

IntList.Add(34);

IntList.Add(23);

IntList.Add(67);

Console.WriteLine_14('Elements in the List:');

for I := 0 to IntList.Count - 1 do

Console.WriteLine_8(IntList[I]);

227
.Net Runtime Library for Delphi

//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));

try

Console.WriteLine_15('Single: {0}',
Enumerable.Single(intType, ListEnumerable));

except

on E: Exception do

Console.WriteLine_15('Single: {0}', E.Message);

end;

try

Console.WriteLine_15('SingleOrDefault: {0}',
Enumerable.SingleOrDefault(intType, ListEnumerable));

except

on E: Exception do

Console.WriteLine_15('SingleOrDefault: {0}', E.Message);

end;

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));

228
.Net Runtime Library for Delphi

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));

Console.ReadLine();

end.

(* This code example produces the following output:

Elements in the List:

33

45

50

45

34

23

67

Enumerable Interface Methods:

First: 33

FirstOrDefault: 33

Last: 67

LastOrDefault: 67

Single: Sequence contains more than one element

SingleOrDefault: Sequence contains more than one element

229
.Net Runtime Library for Delphi

ElementAt: 34

ElementAtOrDefault: 23

Count: 7

Contains: False

Contains: True

Sum: 297

Min: 23

Min with Int32 Type:23

Max: 67

Max with Int32 Type:67

Average: 42.4285714285714

*)

230
.Net Runtime Library for Delphi

231
.Net Runtime Library for Delphi

Queryable Interface
The Queryable interface includes methods for interfaces that has AsGenericIQueryable
method. GenericIQueryable interface is used to provide querying capabilities against a specific
data source where the type of the data is known. For example, Entity Framework api interfaces
has AsGenericIQueryable method to support LINQ queries with underlaying database like SQL
Server. The following demonstrates how to use dynamic Queryable interface methods such as
First, FirstOrDefault, Last, LastOrDefault, Single, SingleOrDefault, ElementAt,
ElementAtOrDefault, Count, Contains, Sum, Min, Max .

Delphi

program LinqWithDynamicQueryableInterface;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Collections,

CNClrLib.DynamicLinq,

CNClrLib.Linq,

CNClrLib.Core;

232
.Net Runtime Library for Delphi

var

Console: _Console;

IntList: _GenericList;

intType: _Type;

ListQueryable: _IQueryable;

DynamicQry: _ClrDynamicQueryable;

I: Integer;

begin

Console := CoConsole.CreateInstance;

//Integer Type

intType := TClrAssembly.GetType('System.Int32');

//Integer Collections

IntList := CoGenericList.CreateInstance(intType);

IntList.Add(33);

IntList.Add(45);

IntList.Add(50);

IntList.Add(45);

IntList.Add(34);

IntList.Add(23);

IntList.Add(67);

Console.WriteLine_14('Elements in the List:');

for I := 0 to IntList.Count - 1 do

Console.WriteLine_8(IntList[I]);

//Create Dynamic Queryable Linq Interface

DynamicQry := CoClrDynamicQueryable.CreateInstance;

//Get _Queryable Interface from the GenericList

ListQueryable := DynamicQry.AsQueryable_6(IntList);

233
.Net Runtime Library for Delphi

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

Console.WriteLine_15('First: {0}',
DynamicQry.First_1(ListQueryable));

Console.WriteLine_15('FirstOrDefault: {0}',
DynamicQry.FirstOrDefault(ListQueryable));

Console.WriteLine_15('Last: {0}',
DynamicQry.Last(ListQueryable));

Console.WriteLine_15('LastOrDefault: {0}',
DynamicQry.LastOrDefault(ListQueryable));

try

Console.WriteLine_15('Single: {0}',
DynamicQry.Single(ListQueryable));

except

on E: Exception do

Console.WriteLine_15('Single: {0}', E.Message);

end;

try

Console.WriteLine_15('SingleOrDefault: {0}',
DynamicQry.SingleOrDefault(ListQueryable));

except

on E: Exception do

Console.WriteLine_15('SingleOrDefault: {0}', E.Message);

end;

Console.WriteLine_15('ElementAt: {0}',
DynamicQry.ElementAt(ListQueryable, 4));

Console.WriteLine_15('ElementAtOrDefault: {0}',
DynamicQry.ElementAtOrDefault(ListQueryable, 5));

Console.WriteLine_15('Count: {0}',
DynamicQry.Count(ListQueryable));

Console.WriteLine_15('Contains: {0}',
DynamicQry.Contains(ListQueryable, 30));

Console.WriteLine_15('Contains: {0}',
DynamicQry.Contains(ListQueryable, 34));

234
.Net Runtime Library for Delphi

Console.WriteLine_15('Sum: {0}',
DynamicQry.SumInt32(ListQueryable));

Console.WriteLine_15('Min: {0}',
DynamicQry.Min(ListQueryable));

Console.WriteLine_15('Max: {0}',
DynamicQry.Max(ListQueryable));

Console.WriteLine_15('Average: {0}',
DynamicQry.AverageInt32(ListQueryable));

Console.ReadLine();

end.

(* This code example produces the following output:

Elements in the List:

33

45

50

45

34

23

67

Enumerable Interface Methods:

First: 33

FirstOrDefault: 33

Last: 67

LastOrDefault: 67

Single: Sequence contains more than one element

SingleOrDefault: Sequence contains more than one element

ElementAt: 34

ElementAtOrDefault: 23

Count: 7

Contains: False

Contains: True

Sum: 297

235
.Net Runtime Library for Delphi

Min: 23

Max: 67

Average: 42.4285714285714

*)

236
.Net Runtime Library for Delphi

237
.Net Runtime Library for Delphi

Standard Query Operators in Enumerable and


Queryable Interfaces
Classification Standard Query Operators

Filtering Where, OfType

Sorting OrderBy, OrderByDescending, ThenBy, ThenByDescending, Reverse

Grouping GroupBy, ToLookup

Join GroupJoin, Join

Projection Select, SelectMany

Aggregation Aggregate, Average, Count, LongCount, Max, Min, Sum

Quantifiers All, Any, Contains

Elements ElementAt, ElementAtOrDefault, First, FirstOrDefault, Last, LastOrDefault, Single,


SingleOrDefault

238
.Net Runtime Library for Delphi

Classification Standard Query Operators

Set Distinct, Except, Intersect, Union

Partitioning Skip, SkipWhile, Take, TakeWhile

Concatenation Concat

Equality SequenceEqual

Generation DefaultEmpty, Empty, Range, Repeat

Conversion AsEnumerable, AsQueryable, Cast, ToArray, ToDictionary, ToList

Lamdba Expression
The lambda expression is a shorter way of representing anonymous method using some special
syntax. It is mostly used to create delegates in LINQ. Simply put, it's a method without a
declaration, i.e., access modifier, return value declaration, and name.

How to build Lambda Expression and use in IQueryable Interface

Assuming you have C# code which uses predicates to find value in a generic list.

C#

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace DesignPattern

class Program

static void Main(string[] args)

List<int> Lst = new List<int>();

Lst.Add(100);

Lst.Add(200);

239
.Net Runtime Library for Delphi

Lst.Add(300);

int Value = Lst.Find(m => m.Equals(100));

Console.WriteLine(Value);

Console.ReadLine();

//Output

// 100

To generate the same code in Delphi using the runtime library, you need to use the
DynamicExpression to build a lambda expression which will be built into predicate.
Delphi

240
.Net Runtime Library for Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Collections,

CNClrLib.DynamicLinq,

CNClrLib.Linq,

CNClrLib.Core;

var

Console: _Console;

DynamicQry: _ClrDynamicQueryable;

Lst: _GenericList;

expParamArray: _ParameterExpressionArray;

expParam: _ParameterExpression;

expHelper: _ExpressionHelper;

DynamicExpr: _ClrDynamicExpression;

LambdaExpr: _LambdaExpression;

intType, retType: _Type;

Value: Integer;

exprStr: string;

begin

Console := CoConsole.CreateInstance;

//Integer Type

intType := TClrAssembly.GetType('System.Int32');

//Boolean Type

retType := TClrAssembly.GetType('System.Boolean');

241
.Net Runtime Library for Delphi

//Integer Collections

Lst := CoGenericList.CreateInstance(intType);

Lst.Add(100);

Lst.Add(200);

Lst.Add(300);

//Create Dynamic Queryable Linq Interface

DynamicQry := CoClrDynamicQueryable.CreateInstance;

//The Lambda Expression as String

exprStr := 'm.Equals(100)';

//Create Expression Parameter Array

expParamArray := CoParameterExpressionArray.CreateInstance(1);

//Create Expression Helper

expHelper := CoExpressionHelper.CreateInstance;

//Create Parameter Expression and assign to the array index 0;

//the m parameter in the expression is of integer type.

expParam := expHelper.Parameter_1(intType, 'm');

expParamArray[0] := expParam;

//Create Dynamic Lamdba Expression by passing the parameter


expression,

//the return type of the expression is boolean

DynamicExpr := CoClrDynamicExpression.CreateInstance;

LambdaExpr := DynamicExpr.ParseLambda_4(expParamArray, retType,


exprStr, nil);

//Convert the Compiled Lamdba Expression which is Func<int, bool> to


Predicate<int> and

242
.Net Runtime Library for Delphi

//find value in list base on the predicate.

Value :=
Lst.Find(TClrGenericHelper.ToGenericPredicate(LambdaExpr.Compile,
intType));

Console.WriteLine_8(Value);

Console.ReadLine();

end.

(* This code example produces the following output:

100

*)

243
.Net Runtime Library for Delphi

The following example uses dynamic labda expression to find all even number from collection.

Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

244
.Net Runtime Library for Delphi

System.SysUtils,

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Collections,

CNClrLib.DynamicLinq,

CNClrLib.Linq,

CNClrLib.Core;

var

Console: _Console;

DynamicQry: _ClrDynamicQueryable;

ListQueryable: _IQueryable;

Lst, evensLst: _GenericList;

expParamArray: _ParameterExpressionArray;

expParam: _ParameterExpression;

expHelper: _ExpressionHelper;

ListEnumerator: _IEnumerator;

DynamicExpr: _ClrDynamicExpression;

LambdaExpr: _LambdaExpression;

intType, retType: _Type;

exprStr: string;

begin

Console := CoConsole.CreateInstance;

//Integer Type

intType := TClrAssembly.GetType('System.Int32');

//Boolean Type

retType := TClrAssembly.GetType('System.Boolean');

//Integer Collections

Lst := CoGenericList.CreateInstance(intType);

Lst.Add(1);

Lst.Add(2);

245
.Net Runtime Library for Delphi

Lst.Add(3);

Lst.Add(4);

Lst.Add(5);

Lst.Add(6);

Lst.Add(7);

Console.WriteLine_14('Elements in the List');

ListEnumerator := Lst.AsIEnumerable.GetEnumerator;

while ListEnumerator.MoveNext do

Console.WriteLine_12(ListEnumerator.Current);

//Create Dynamic Queryable Linq Interface

DynamicQry := CoClrDynamicQueryable.CreateInstance;

//Get _Queryable Interface from the GenericList

ListQueryable := DynamicQry.AsQueryable_6(Lst);

//The Lambda Expression as String

exprStr := 'n % 2 == 0';

//Create Expression Parameter Array

expParamArray := CoParameterExpressionArray.CreateInstance(1);

//Create Expression Helper

expHelper := CoExpressionHelper.CreateInstance;

//Create Parameter Expression and assign to the array index 0;

//the m parameter in the expression is of integer type.

expParam := expHelper.Parameter_1(intType, 'n');

expParamArray[0] := expParam;

246
.Net Runtime Library for Delphi

//Create Dynamic Lamdba Expression by passing the parameter


expression,

//the return type of the expression is boolean

DynamicExpr := CoClrDynamicExpression.CreateInstance;

LambdaExpr := DynamicExpr.ParseLambda_4(expParamArray, retType,


exprStr, nil);

//Convert the Compiled Lamdba Expression which is Func<int, bool> to


Predicate<int>

//Findall the match using the predicate delegate

evensLst :=
Lst.FindAll(TClrGenericHelper.ToGenericPredicate(LambdaExpr.Compile,
intType));

Console.WriteLine_14('List of Even numbers:');

ListEnumerator := evensLst.AsIEnumerable.GetEnumerator;

while ListEnumerator.MoveNext do

Console.WriteLine_12(ListEnumerator.Current);

Console.ReadLine();

end.

(* This code example produces the following output:

Elements in the List

List of Even numbers:

247
.Net Runtime Library for Delphi

*)

248
.Net Runtime Library for Delphi

249
.Net Runtime Library for Delphi

Alternatively, you can use Queryable interface method Where to achieve the same output.

Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Collections,

CNClrLib.DynamicLinq,

CNClrLib.Linq,

CNClrLib.Core;

var

Console: _Console;

DynamicQry: _ClrDynamicQueryable;

ListQueryable: _IQueryable;

Lst: _GenericList;

expParamArray: _ParameterExpressionArray;

expParam: _ParameterExpression;

expHelper: _ExpressionHelper;

ListEnumerator: _IEnumerator;

250
.Net Runtime Library for Delphi

DynamicExpr: _ClrDynamicExpression;

LambdaExpr: _LambdaExpression;

intType, retType: _Type;

exprStr: string;

begin

Console := CoConsole.CreateInstance;

//Integer Type

intType := TClrAssembly.GetType('System.Int32');

//Boolean Type

retType := TClrAssembly.GetType('System.Boolean');

//Integer Collections

Lst := CoGenericList.CreateInstance(intType);

Lst.Add(1);

Lst.Add(2);

Lst.Add(3);

Lst.Add(4);

Lst.Add(5);

Lst.Add(6);

Lst.Add(7);

Console.WriteLine_14('Elements in the List');

ListEnumerator := Lst.AsIEnumerable.GetEnumerator;

while ListEnumerator.MoveNext do

Console.WriteLine_12(ListEnumerator.Current);

//Create Dynamic Queryable Linq Interface

DynamicQry := CoClrDynamicQueryable.CreateInstance;

//The Lambda Expression as String

exprStr := 'n % 2 == 0';

251
.Net Runtime Library for Delphi

//Create Expression Parameter Array

expParamArray := CoParameterExpressionArray.CreateInstance(1);

//Create Expression Helper

expHelper := CoExpressionHelper.CreateInstance;

//Create Parameter Expression and assign to the array index 0;

//the m parameter in the expression is of integer type.

expParam := expHelper.Parameter_1(intType, 'n');

expParamArray[0] := expParam;

//Create Dynamic Lamdba Expression by passing the parameter


expression,

//the return type of the expression is boolean

DynamicExpr := CoClrDynamicExpression.CreateInstance;

LambdaExpr := DynamicExpr.ParseLambda_4(expParamArray, retType,


exprStr, nil);

Console.WriteLine_14('List of Even numbers:');

//Get _Queryable Interface from the GenericList

ListQueryable := DynamicQry.AsQueryable_6(Lst);

ListEnumerator := DynamicQry.Where_2(ListQueryable,
LambdaExpr).AsIEnumerable.GetEnumerator;

while ListEnumerator.MoveNext do

Console.WriteLine_12(ListEnumerator.Current);

Console.ReadLine();

end.

(* This code example produces the following output:

Elements in the List

252
.Net Runtime Library for Delphi

List of Even numbers:

*)

253
.Net Runtime Library for Delphi

254
.Net Runtime Library for Delphi

The following anonymous method checks if student is teenager or not:

//Anonymous method in C#:

delegate(Student s) { return s.Age > 12 && s.Age < 20; };

The above anonymous method can be represented using a Lambda Expression in C#

//Lambda Expression in C#:

s => s.Age > 12 && s.Age < 20

The above expressions can be represented in delphi using Dynamic Lambda Expression.

Delphi

var

DynamicQry: _ClrDynamicQueryable;

255
.Net Runtime Library for Delphi

expParamArray: _ParameterExpressionArray;

expParam: _ParameterExpression;

expHelper: _ExpressionHelper;

DynamicExpr: _ClrDynamicExpression;

LambdaExpr: _LambdaExpression;

intType, retType: _Type;

exprStr: string;

delegate: _Delegate;

begin

//Student Type

intType := TClrAssembly.GetType('ClassP.Student');

//Boolean Type

retType := TClrAssembly.GetType('System.Boolean');

//The Lambda Expression as String

exprStr := 's.Age > 12 && s.Age < 20';

//Create Expression Parameter Array

expParamArray := CoParameterExpressionArray.CreateInstance(1);

//Create Expression Helper

expHelper := CoExpressionHelper.CreateInstance;

//Create Parameter Expression and assign to the array index 0;

//the m parameter in the expression is of integer type.

expParam := expHelper.Parameter_1(intType, 's');

expParamArray[0] := expParam;

//Create Dynamic Lamdba Expression by passing the parameter


expression,

//the return type of the expression is boolean

DynamicExpr := CoClrDynamicExpression.CreateInstance;

256
.Net Runtime Library for Delphi

LambdaExpr := DynamicExpr.ParseLambda_4(expParamArray, retType,


exprStr, nil);

delegate := LambdaExpr.Compile;

end.

Lambda Expression with Multiple Parameters


Example: Specify parameter type in lambda expression C#:

(Student s,int youngAge) => s.Age >= youngage;

257
.Net Runtime Library for Delphi

This can be represented in delphi as follows using dynamic lamdba expression. The Lambda
expression will be compiled to a delegate which will be the same as above c# code:

Delphi

var

DynamicQry: _ClrDynamicQueryable;

expParamArray: _ParameterExpressionArray;

expParam1, expParam2: _ParameterExpression;

expHelper: _ExpressionHelper;

DynamicExpr: _ClrDynamicExpression;

LambdaExpr: _LambdaExpression;

intType1, intType2, retType: _Type;

exprStr: string;

delegate: _Delegate;

begin

//Student Type

intType1 := TClrAssembly.GetType('ClassP.Student');

//Integer Type

intType2 := TClrAssembly.GetType('System.Int32');

//Boolean Type

retType := TClrAssembly.GetType('System.Boolean');

//The Lambda Expression as String

exprStr := 's.Age >= youngage';

//Create Expression Parameter Array

expParamArray := CoParameterExpressionArray.CreateInstance(2);

//Create Expression Helper

expHelper := CoExpressionHelper.CreateInstance;

258
.Net Runtime Library for Delphi

//Create Parameter Expression and assign to the array index 0;

//the m parameter in the expression is of integer type.

expParam1 := expHelper.Parameter_1(intType1, 's');

expParam2 := expHelper.Parameter_1(intType2, 'youngage');

expParamArray[0] := expParam1;

expParamArray[1] := expParam2;

//Create Dynamic Lamdba Expression by passing the parameter


expression,

//the return type of the expression is boolean

DynamicExpr := CoClrDynamicExpression.CreateInstance;

LambdaExpr := DynamicExpr.ParseLambda_4(expParamArray, retType,


exprStr, nil);

delegate := LambdaExpr.Compile;

end.

3.12 Convert Between Types


Every value has an associated type, which defines attributes such as the amount of space allocated to the value, the
range of possible values it can have, and the members that it makes available. Many values can be expressed as more
than one type. For example, the value 4 can be expressed as an integer or a floating-point value. Type conversion
creates a value in a new type that is equivalent to the value of an old type, but does not necessarily preserve the identity
(or exact value) of the original object.
To perform conversion from derived class to a base class, base class back to the original derived class or Conversion
from a type that implements an interface to an interface object that represents that interface, use the wrap method. You
can use the conversion types defined in CNClrLib.Host.Helper to perform conversions between inbuilt data types, as well
as use TClrConvert class to convert a base data type to another base data type and TClrBitConverter class to Converts
base data types to an array of bytes, and an array of bytes to base data types. All the base type conversion types are
declared in CNClrLib.Host.Helper namespace.

Conversion between inbuilt Data Types


Widening conversions involve the creation of a new value from the value of an existing type that has either a more
restrictive range or a more restricted member list than the target type. Widening conversions cannot result in data loss
(although they may result in a loss of precision). Because data cannot be lost.

For example, the _Decimal interface type supports conversions from Byte, Char, Int16, Int32, Int64, SByte, UInt16, UInt32,
and UInt64 values using the TClrConvert class defined in the CNClrLib.Host.Helper namespace. The following example
illustrates some of these conversions in assigning values to a _Decimal variable.

Delphi

var

Console: _Console;

259
.Net Runtime Library for Delphi

byteValue: ClrByte;

shortValue: ClrInt16;

intValue: ClrInt32;

longValue: ClrInt64;

ulongValue: ClrUInt64;

decimalValue: _Decimal;

begin

try

byteValue := 16;

shortValue := -1024;

intValue := -1034000;

longValue := 1152921504606846976;

ulongValue := High(UInt64);

Console := CoConsole.CreateInstance;

decimalValue := TClrConvert.ToDecimal(byteValue);

Console.WriteLine_15('After converting from a Byte value, the


Decimal value is {0}.', decimalValue);

decimalValue := TClrConvert.ToDecimal(shortValue);

Console.WriteLine_15('After converting from a Int16 value, the


Decimal value is {0}.', decimalValue);

decimalValue := TClrConvert.ToDecimal(intValue);

Console.WriteLine_15('After converting from a Int32 value, the


Decimal value is {0}.', decimalValue);

decimalValue := TClrConvert.ToDecimal(longValue);

Console.WriteLine_15('After converting from a Int64 value, the


Decimal value is {0}.', decimalValue);

decimalValue := TClrConvert.ToDecimal(ulongValue);

Console.WriteLine_15('After converting from a UInt64 value, the


Decimal value is {0}.', decimalValue);

260
.Net Runtime Library for Delphi

Console.ReadLine;

// The example displays the following output:

// After assigning a Byte value, the Decimal value is 16.

// After assigning a Int16 value, the Decimal value is -1024.

// After assigning a Int32 value, the Decimal value is -


1034000.

// After assigning a value, the Decimal value is


1152921504606846976.

// After assigning a Int64 value, the Decimal value is


18446744073709551615.

except

on E: Exception do

Writeln(E.ClassName, ': ', E.Message);

end;

end.

261
.Net Runtime Library for Delphi

Narrowing conversions involve the creation of a new value from the value of an existing type that has either a greater
range or a larger member list than the target type. Because a narrowing conversion can result in a loss of data, it is
often require that the conversion be made explicit through a call to a conversion method called wrap method or use the
AsXXXX method of the interface object. Example _Decimal.AsIConvertible, the interface _Decimal provides an AsXXXX
methods (such as AsIConvertible) which represent all the base classes as well as inherited interfaces defined in the .net
framework. Doing so means you don't need to do explicit wrapping conversion, just call the AsXXXX method of the
interface and the interface object will be converted to the specific AsXXXX method's return data type. To get the original
.net object from the wrap DFL object use the Unwrap method.

Delphi

program ConversionDemo;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

CNClrLib.Core.Intf,

CNClrLib.Host.Helper;

var

AConsole: _Console;

ADecimal: _Decimal;

AConvertible: _IConvertible;

262
.Net Runtime Library for Delphi

ACultureHelper : _CultureInfoHelper;

ACultureInfo : _CultureInfo;

AFormatProv:IFormatProvider;

AInt32: ClrInt32;

begin

try

AConsole := CoConsole.CreateInstance;

//using Wrap Method

//====================================================================
======

//To convert integer value to decimal object, you can use the wrap
method of the

//_Decimal interface.

AInt32 := 45;

ADecimal := CoDecimal.Wrap(AInt32);

AConsole.WriteLine_15('Convert Integer value ''45'' to Decimal


value using the Wrap method, '+

'the Decimal value is {0}.', ADecimal);

//using AsXXXXX methods

//====================================================================
======

//Using C# Char struct inherited from the interface IConvertible,


IFormatible

//C# Class Declaration Syntax

//public struct Char : IComparable, IConvertible,


IComparable<char>, IEquatable<char>

//

//In the Delphi Framework Library Interface _Char, the inherited


base classes or interfaces are represented as AsXXXXX

//methods, these are:

//AsIComparable

//AsIConvertible

263
.Net Runtime Library for Delphi

//Convert decimal object to inherited interface IConvertible;

AConvertible := ADecimal.AsIConvertible;

//Create Static CultureInfo interface type

ACultureHelper := CoCultureInfoHelper.CreateInstance;

ACultureInfo := ACultureHelper.CurrentCulture;

//Convert CultureInfo object to inherited interface


IFormatProvider

AFormatProv := ACultureInfo.AsIFormatProvider;

//Convert char 'c' to sbyte using IConvertible interface

AInt32 := AConvertible.ToInt32(AFormatProv);

AConsole.WriteLine_17('Convert decimal ''{0}'' to integer value


using IConvertible '+

'interface, the Integer value is {1}.',


ADecimal, AInt32);

AConsole.ReadKey;

// The example displays the following output:

// Convert Integer value '45' to Decimal value using the Wrap


method, the Decimal value is 45.

// Convert decimal '45' to integer value using IConvertible


interface, the Integer value is 45.

except

on E: Exception do

Writeln(E.ClassName, ': ', E.Message);

end;

end.

264
.Net Runtime Library for Delphi

265
.Net Runtime Library for Delphi

Custom Conversions with the ChangeType Method


In addition to supporting conversions to each of the base types, the
TClrConvert class can be used to convert a custom type to one or more
predefined types. This conversion is performed by the
TClrConvert.ChangeType method, which in turn wraps a call to
the IConvertible.ToType method of the value parameter. This means
that the object represented by the value parameter must provide an
implementation of the IConvertible interface.

Type Conversion Tables

Widening conversion occurs when a value of one type is converted to


another type that is of equal or greater size. A narrowing conversion
occurs when a value of one type is converted to a value of another type
that is of a smaller size. The tables in this topic illustrate the behaviors
exhibited by both types of conversions. For more information see .Net
Type Conversion Tables.

266
.Net Runtime Library for Delphi

3.13 Place .Net Controls on VCL Form


Microsoft .NET controls give developers the leverage they need to build modular solutions. A
developer can design custom controls from a myriad of existing controls and embed the
custom control into a Windows Form or another control. With some additional code, one can
also embed those controls in a Web Form. Using the host control container called TClrContainer
will allow you to place .net controls on delphi VCL forms. The TClrContainer Control is a
container control to host a group of .net controls. It is used to group collections of .Net controls. This
control type is defined in the namespace CNClrLib.Comp .

Creating a ClrContainer
We can create a ClrContainer Control using the Forms designer at design-time or using the
TClrContainer class in code at run-time.

Design Time
To create a Panel Control at design-time, you can drag and drop a Panel Control from the
Toolbox to a Form in Delphi IDE. After you dragging and dropping a ClrContainer Control to the
Form, the control looks like Figure 1. Once a ClrContainer is on the form, you can move it
around and resize it using the mouse and set its properties and events.

Figure 1

Run-time
Creating a ClrContainer Control at run-time is merely a work of creating an instance of the
TClrContainer class, setting its properties and adding the TClrContainer to the form controls.
The first step to create a dynamic ClrContainer is to create an instance of the TClrContainer
class. The following code snippet creates a TClrContainer Control object.

Delphi

....

267
.Net Runtime Library for Delphi

var

dynamicCtrl: TClrContainer;

begin

dynamicCtrl := TClrContainer.Create(Self);

....

The next step is to add the ClrContainer to a form so it becomes a part of the form. To do so,
set the parent property of the control to the form. The following code snippet adds a
ClrContainer Control to the current form.

Delphi

dynamicCtrl.Parent := Self; //Self is the form

dynamicCtrl.Name := 'ClrContainer1';

dynamicCtrl.Align := alClient;

dynamicCtrl.TabOrder := 0;

Adding .Net Controls to a ClrContainer


Adding .net controls to the ClrContainer can be done at runtime. Use the overload method
AddClrControl to add the instance of the .net control created to the container control. The
following code snipper demonstrates how an instance of a .Net DatagridView control can be
added to the ClrContainer.

Delphi

///Create Instance of the DatagridView control and set it properties

FDataGridView := CoDataGridView.CreateInstance;

FDataGridView.Dock := DockStyle_Fill;

FDataGridView.AutoGenerateColumns := True;

268
.Net Runtime Library for Delphi

///Temporarily suspends the layout logic for the control.

ClrContainer1.SuspendLayout;

//Add the DatagridView control to the host control container

ClrContainer1.AddClrControl(FDataGridView);

//Resumes usual layout logic.

ClrContainer1.ResumeLayout();

Example
The example below demonstrates how to load data from the database, bind it to a
DatagridView control which is added to the ClrContainer and display the gridview result on the
VCL form.

Delphi

unit Examples;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses

System.SysUtils, System.Variants, System.Classes, Vcl.Controls,


Vcl.Forms,

Vcl.Dialogs, Vcl.StdCtrls, CNClrLib.Windows, CNClrLib.Enums,


Vcl.ExtCtrls,

269
.Net Runtime Library for Delphi

CNClrLib.Data, CNClrLib.Comp;

type

TForm1 = class(TForm)

Panel2: TPanel;

btnLoadData: TButton;

ClrContainer1: TClrContainer;

procedure FormShow(Sender: TObject);

procedure btnLoadDataClick(Sender: TObject);

private

FDataGridView: _DataGridView;

FBindingSource: _BindingSource;

public

{ Public declarations }

procedure LoadData;

procedure AddHostControl;

end;

var

Form1: TForm1;

implementation

{$R *.dfm}

uses CNClrLib.Core;

{ TForm1 }

/// <summary>

/// Create and instance of the .Net DataGridView control and the .Net
BindingSource component

/// Set the Properties of the .Net DataGridView control and assign the
DataSource property to the .Net BindingSource component

270
.Net Runtime Library for Delphi

/// Add the .Net DatagridView control to the ClrContainer

/// </summary>

procedure TForm1.AddHostControl;

begin

///Create Instance of the DatagridView control and set it properties

FDataGridView := CoDataGridView.CreateInstance;

FDataGridView.Dock := DockStyle_Fill;

FDataGridView.AutoGenerateColumns := True;

///Create Instance of the BindingSource component and assign the


component to the Datasource property of the DataGridView control

FBindingSource:= CoBindingSource.CreateInstance;

FDataGridView.DataSource := FBindingSource.Unwrap;

///Temporarily suspends the layout logic for the control.

ClrContainer1.SuspendLayout;

//Add the DatagridView control to the host control container

ClrContainer1.AddClrControl(FDataGridView);

//Resumes usual layout logic.

ClrContainer1.ResumeLayout();

end;

/// <summary>

/// Click event which loads the data from database and display on the
DataGridView control

/// </summary>

procedure TForm1.btnLoadDataClick(Sender: TObject);

begin

LoadData;

end;

/// <summary>

271
.Net Runtime Library for Delphi

/// On Form show event will call the AddHostControl method

/// </summary>

procedure TForm1.FormShow(Sender: TObject);

begin

AddHostControl;

end;

/// <summary>

/// Load data using ADO.Net and bind the data retrieved from the
database to the .Net DataGridView control using the bindingsource

/// </summary>

procedure TForm1.LoadData;

var

conStr, SQL: String;

adapter: _SqlDataAdapter;

commandBuilder: _SqlCommandBuilder;

table: _DataTable;

begin

try

conStr := 'Data Source=MyDataSource; Initial Catalog=MyDatabase;


Integrated Security=true;';

SQL := 'Select * from My_Table';

adapter := CoSqlDataAdapter.CreateInstance(SQL, conStr);

commandBuilder := CoSqlCommandBuilder.CreateInstance(adapter);

table := CoDataTable.CreateInstance;

table.Locale :=
CoCultureInfoHelper.CreateInstance.InvariantCulture;

adapter.Fill_3(table);

FBindingSource.DataSource := table.Unwrap;

except

on E: Exception do

ShowMessage(E.Message);

end;

272
.Net Runtime Library for Delphi

end;

end.

273
.Net Runtime Library for Delphi

274
.Net Runtime Library for Delphi

275
.Net Runtime Library for Delphi

Form at Design Time

276
.Net Runtime Library for Delphi

Form at Run-Time

3.14 Format Types


Formatting is the process of converting an instance of a class, structure, or enumeration value to its string
representation, often so that the resulting string can be displayed to users or deserialized to restore the original data
type.
The Delphi Framework provides rich formatting support that enables developers to address these requirements.This
overview contains the following sections:

 Formatting in the Framework Library


 The ToString Method and Format Strings
o Standard Format Strings
o Custom Format Strings
o Format Strings and .NET Framework Class Library Types
Formatting in the Framework Library

The Framework library provides several ways to modify and extend its
default formatting support. These include the following:
 Defining format specifiers that enable the string representation of an object's value to
take multiple forms. For example, the "X" format specifier in the following statement
converts an integer to the string representation of a hexadecimal value.

Delphi

var

Console: _Console;

277
.Net Runtime Library for Delphi

AInt32: ClrInt32;

begin

Console := CoConsole.CreateInstance;

AInt32 := 60312;

Console.WriteLine_14(TClrInt32Helper.ToString(AInt32, 'X'));

// Displays EB98.

end.

 Using format providers to take advantage of the formatting conventions of a specific


culture. For example, the following statement displays a currency value by using the
formatting conventions of the en-US culture.

Delphi

var

Console: _Console;

ADouble: ClrDouble;

ACultureInfo: _CultureInfo;

begin

Console := CoConsole.CreateInstance;

278
.Net Runtime Library for Delphi

ADouble := 1632.54;

ACultureInfo := CoCultureInfo.CreateInstance('en-US');

Console.WriteLine_14(TClrDoubleHelper.ToString(ADouble, 'C',
ACultureInfo.AsIFormatProvider));

// The example displays the following output:

// $1,632.54

end.

The ToString Method and Format Strings


Relying on the default ToString method or overriding ToString is appropriate when an object has a single string
representation. However, the value of an object often has multiple representations. For example, a temperature can be
expressed in degrees Fahrenheit, degrees Celsius, or kelvins. Similarly, the integer value 10 can be represented in
numerous ways, including 10, 10.0, 1.0e01, or $10.00.
To enable a single value to have multiple string representations, the .NET Framework uses format strings. A format
string is a string that contains one or more predefined format specifiers, which are single characters or groups of
characters that define how the ToString method should format its output. The format string is then passed as a
parameter to the object's ToString method and determines how the string representation of that object's value should
appear.
All numeric types, date and time types, and enumeration types in the .NET Framework support a predefined set of
format specifiers. You can also use format strings to define multiple string representations of your application-defined
data types.

Standard Format Strings

279
.Net Runtime Library for Delphi

Standard format strings for numeric types usually define a result string whose precise appearance is controlled by one
or more property values. For example, the "C" format specifier formats a number as a currency value. When you call the
ToString method with the "C" format specifier as the only parameter, the following property values from the current
culture's NumberFormatInfo interface are used to define the string representation of the numeric value:
 The CurrencySymbol property, which specifies the current culture's currency symbol.
 The CurrencyNegativePattern or CurrencyPositivePattern property, which returns an integer that
determines the following:
o The placement of the currency symbol.
o Whether negative values are indicated by a leading negative sign, a trailing negative sign, or
parentheses.
o Whether a space appears between the numeric value and the currency symbol.
 The CurrencyDecimalDigits property, which defines the number of fractional digits in the result string.
 The CurrencyDecimalSeparator property, which defines the decimal separator symbol in the result string.
 The CurrencyGroupSeparator property, which defines the group separator symbol.
 The CurrencyGroupSizes property, which defines the number of digits in each group to the left of the
decimal.
 The NegativeSign property, which determines the negative sign used in the result string if parentheses are
not used to indicate negative values.
In addition, numeric format strings may include a precision specifier. The meaning of this specifier depends on the
format string with which it is used, but it typically indicates either the total number of digits or the number of fractional
digits that should appear in the result string. For example, the following example uses the "X4" standard numeric string
and a precision specifier to create a string value that has four hexadecimal digits.
Delphi

var

Console: _Console;

AByteValue: ClrByte;

AByteValues: array[0..2] of ClrByte;

begin

Console := CoConsole.CreateInstance;

AByteValues[0] := 12;

AByteValues[1] := 163;

AByteValues[2] := 255;

for AByteValue in AByteValues do

Console.WriteLine_14(TClrByteHelper.ToString(AByteValue, 'X4'));

end.

// The example displays the following output:

// 000C

// 00A3

// 00FF

280
.Net Runtime Library for Delphi

Standard format strings for date and time values are aliases for custom format strings stored by a particular
DateTimeFormatInfo property. For example, calling the ToString method of a date and time value with the "D" format
specifier displays the date and time by using the custom format string stored in the current culture's
DateTimeFormatInfo.LongDatePattern property. The following example illustrates this relationship.
Delphi

var

Console: _Console;

ADate1: TDateTime;

ACultureInfo: _CultureInfoHelper;

ALongPattern: string;

begin

Console := CoConsole.CreateInstance;

ADate1 := TClrDateTimeHelper.Parse('30/06/2009');

Console.WriteLine_15('D Format Specifier: {0:D}', ADate1);

ACultureInfo := CoCultureInfoHelper.CreateInstance;

ALongPattern :=
ACultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern;

281
.Net Runtime Library for Delphi

Console.WriteLine_17('''{0}'' custom format string: {1}',


ALongPattern,

TClrDateTimeHelper.ToString(ADate1, ALongPattern));

end.

// The example displays the following output when run on a system


whose

// current culture is en-US:

// D Format Specifier: Tuesday, June 30, 2009

// 'dddd, MMMM dd, yyyy' custom format string: Tuesday, June


30, 2009

For more information about standard date and time format strings, see Standard Date and Time Format Strings.
You can also use standard format strings to define the string representation of an application-defined object that is
produced by the object's ToString(String) method. You can define the specific standard format specifiers that your
object supports, and you can determine whether they are case-sensitive or case-insensitive. Your implementation of the
ToString(String) method should support the following:

282
.Net Runtime Library for Delphi

 A "G" format specifier that represents a customary or common format of the object. The parameterless
overload of your object's ToString method should call its ToString(String) overload and pass it the "G"
standard format string.
 Support for a format specifier that is equal to a null reference (Nothing in Visual Basic). A format specifier
that is equal to a null reference should be considered equivalent to the "G" format specifier.
Custom Format StringsIn addition to the standard format strings, the .NET Framework defines custom format
strings for both numeric values and date and time values. A custom format string consists of one or more custom
format specifiers that define the string representation of a value. For example, the custom date and time format string
"yyyy/mm/dd hh:mm:ss.ffff t zzz" converts a date to its string representation in the form "2008/11/15 07:45:00.0000 P -
08:00" for the en-US culture. Similarly, the custom format string "0000" converts the integer value 12 to "0012". For a
complete list of custom format strings, see Custom Date and Time Format Strings.
If a format string consists of a single custom format specifier, the format specifier should be preceded by the percent
(%) symbol to avoid confusion with a standard format specifier. The following example uses the "M" custom format
specifier to display a one-digit or two-digit number of the month of a particular date.
Delphi

var

Console: _Console;

ADate1: TDateTime;

begin

Console := CoConsole.CreateInstance;

ADate1 := TClrDateTimeHelper.Parse('08/09/2009');

Console.WriteLine_14(TClrDateTimeHelper.ToString(ADate1, '%M'));

end.

//Displays 9

Many standard format strings for date and time values are aliases for custom format strings that are defined by
properties of the DateTimeFormatInfo object. Custom format strings also offer considerable flexibility in providing
application-defined formatting for numeric values or date and time values. You can define your own custom result
strings for both numeric values and date and time values by combining multiple custom format specifiers into a single

283
.Net Runtime Library for Delphi

custom format string. The following example defines a custom format string that displays the day of the week in
parentheses after the month name, day, and year.
Delphi

var

Console: _Console;

ADate1: TDateTime;

ACustomFormat: string;

begin

Console := CoConsole.CreateInstance;

ACustomFormat := 'MMMM dd, yyyy (dddd)';

ADate1 := TClrDateTimeHelper.Parse('28/08/2009');

Console.WriteLine_14(TClrDateTimeHelper.ToString(ADate1,
ACustomFormat));

end.

// The example displays the following output if run on a system//


whose language is English:

// August 28, 2009 (Friday)

The following example defines a custom format string that displays an Int64 value as a standard, seven-digit U.S.
telephone number along with its area code.
Delphi

program Example;

284
.Net Runtime Library for Delphi

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

CNClrLib.Core.Intf,

CNClrLib.Host.Helper;

var

Console: _Console;

ANumber: ClrInt64;

AFmt: string;

begin

Console := CoConsole.CreateInstance;

ANumber := 8009999999;

AFmt := '000-000-0000';

Console.WriteLine_14(TClrInt64Helper.ToString(ANumber, AFmt));

Console.ReadKey;

end.

// The example displays the following output:

// 800-999-9999

285
.Net Runtime Library for Delphi

Although standard format strings can generally handle most of the formatting needs for your application-defined types,
you may also define custom format specifiers to format your types.

3.15 Perform Common I/O Tasks


The CNCrLib.IO and CNCrLib.Core orCNCrLib.Core.Intf namespaces provide several interfaces that allow for various
actions, such as reading and writing, to be performed on files, directories, and streams.

Common File Tasks

To do this... See the example in this topic...

Create a text file _File.CreateText method


_FileInfo.CreateText method
_File.Create method
_FileInfo.Create method

Write to a text file How to: Write Text to a File

Read from a text file How to: Read Text from a File

Append text to a file How to: Open and Append to a Log File
_File.AppendText method
_FileInfo.AppendText method

Rename or move a file _File.Move method


_FileInfo.MoveTo method

Delete a file _File.Delete method


_FileInfo.Delete method

Copy a file _File.Copy method


_FileInfo.CopyTo method

Get the size of a file _FileInfo.Length property

Get the attributes of a file _File.GetAttributes method

286
.Net Runtime Library for Delphi

Set the attributes of a file _File.SetAttributes method

Determine whether a file exists _File.Exists method

Read from a binary file How to: Read and Write to a Newly Created
Data File

Write to a binary file How to: Read and Write to a Newly Created
Data File

Retrieve a file name extension _Path.GetExtension method

Retrieve the fully qualified path of a _Path.GetFullPath method


file

Retrieve the file name and extension _Path.GetFileName method


from a path

Change the extension of a file _Path.ChangeExtension method

Common Directory Tasks

To do this... See the example in this topic...

Access a file in a special folder How to: Write Text to a File


such as My Documents

Create a directory _Directory.CreateDirectory method


_FileInfo.Directory property

Create a subdirectory _DirectoryInfo.CreateSubdirectory method

Rename or move a directory _Directory.Move method


_DirectoryInfo.MoveTo method

Copy a directory How to: Copy Directories

Delete a directory _Directory.Delete method


_DirectoryInfo.Delete method

See the files and subdirectories How to: Enumerate Directories and Files
in a directory

Find the size of a directory CNClrLib.Core._Directory or


CNClrLib.Core.Intf._Directory Interface

Determine whether a directory _Directory.Exists method


exists

287
.Net Runtime Library for Delphi

3.15.1 How to: Copy Directories


This example demonstrates how to use I/O interfaces to synchronously copy the contents of a directory to another
location. In this example, the user can specify whether to also copy the subdirectories. If the subdirectories are copied,
the method in this example recursively copies them by calling itself on each subsequent subdirectory until there are no
more to copy.
Example
Delphi

program DirectoryCopyExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.IO,

CNClrLib.Core,

CNClrLib.Host;

procedure DirectoryCopy(ASourceDirName, ADestDirName: string;


ACopySubDir: Boolean);

var

DirInfo: _DirectoryInfo;

DirInfos: _DirectoryInfoArray;

Dir: _Directory;

files: _FileInfoArray;

temppath: string;

Path: _Path;

I: Integer;

begin

// Get the subdirectories for the specified directory.

DirInfo := CoDirectoryInfo.CreateInstance(ASourceDirName);

if not DirInfo.Exists then

begin

288
.Net Runtime Library for Delphi

raise EClrException.Create('Source directory does not exist or


could not be found: '

+ ASourceDirName);

end;

DirInfos := DirInfo.GetDirectories;

// If the destination directory doesn't exist, create it.

Dir := CoDirectory.CreateInstance;

if not Dir.Exists(ADestDirName) then

Dir.CreateDirectory(ADestDirName);

// Get the files in the directory and copy them to the new
location.

files := DirInfo.GetFiles_2;

//Create Static Path Object

Path := CoPath.CreateInstance;

for I := 0 to files.Length - 1 do

begin

temppath := Path.Combine(ADestDirName, files[I].Name);

files[I].CopyTo_1(temppath, false);

end;

// If copying subdirectories, copy them and their contents to new


location.

if ACopySubDir then

begin

for I := 0 to DirInfos.Length - 1 do

begin

temppath := Path.Combine(ADestDirName, DirInfos[I].Name);

DirectoryCopy(DirInfos[I].FullName, temppath, ACopySubDir);

end;

end;

289
.Net Runtime Library for Delphi

end;

begin

// Copy from the current directory, include subdirectories.

DirectoryCopy('.', '.\temp', true);

end.

3.15.2 How to: Enumerate Directories and


Files
You can enumerate directories and files by using methods that return an enumerable collection
of strings of their names. You can also use methods that return an enumerable collection of
DirectoryInfo, FileInfo, or FileSystemInfo interface objects. Enumerable collections provide
better performance than arrays when you work with large collections of directories and files.

You can also use enumerable collections obtained from these methods to supply the GenericIEnumerable parameter for
constructors of collection classes such as the GenericList interface.
If you want to obtain only the names of directories or files, use the enumeration methods of the Directory interface. If
you want to obtain other properties of directories or files, use the DirectoryInfo and FileSystemInfo interfaces.
The following table provides a guide to the methods that return enumerable collections.

To Enumerable collection
Method to use
enumerate to return

Directories Directory names _Directory.EnumerateDirectories

Directory information _DirectoryInfo.EnumerateDirectories


(_DirectoryInfo)

Files File names _Directory.EnumerateFiles

File information _DirectoryInfo.EnumerateFiles


(_FileInfo)

File system File system entries _Directory.EnumerateFileSystemEntries


information

File system information _DirectoryInfo.EnumerateFileSystemInfos


(_FileSystemInfo)
Although you can immediately enumerate all the files in the subdirectories of a parent directory by using the
AllDirectories search option provided by the SearchOption enumeration, unauthorized access exceptions may cause the
enumeration to be incomplete. If these exceptions are possible, you can catch them and continue by first enumerating
directories and then enumerating files.
To enumerate directory names
 Use the _Directory.EnumerateDirectories(WideString) method to obtain a list of the top-level directory names
in a specified path.

290
.Net Runtime Library for Delphi

Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Collections,

CNClrLib.Core,

CNClrLib.Host,

System.Win.ComObj;

var

Console: _Console;

Directory: _Directory;

dirPath, dir: string;

dirs: _GenericList;

AException: _Exception;

UnauthorizedAccessException: _UnauthorizedAccessException;

PathTooLongException: _PathTooLongException;

I: Integer;

begin

Console := CoConsole.CreateInstance;

try

dirPath := '\\archives\2009\reports';

Directory := CoDirectory.CreateInstance;

291
.Net Runtime Library for Delphi

//Create generic string List

dirs :=
CoGenericList.CreateInstance(Directory.EnumerateDirectories(dirP
ath));

for I := 0 to dirs.Count - 1 do

begin

dir := dirs[0];

Console.WriteLine_15('{0}',
dir.Substring(dir.LastIndexOf('\\')+ 1));

end;

Console.WriteLine_15('{0} directories found.', dirs.Count);

except

on E: EOleSysError do

begin

AException := EClrException.GetExceptionIntf(E.ErrorCode);

if AException.GetType.Name = 'UnauthorizedAccessException'
then

begin

UnauthorizedAccessException :=
CoUnauthorizedAccessException.Wrap(AException);

Console.WriteLine_14(UnauthorizedAccessException.Message);

end

else if AException.GetType.Name = 'PathTooLongException'


then

begin

PathTooLongException :=
CoPathTooLongException.Wrap(AException);

Console.WriteLine_14(PathTooLongException.Message);

end

else

292
.Net Runtime Library for Delphi

Console.WriteLine_14(AException.Message);

end;

end;

Console.ReadLine();

end.

293
.Net Runtime Library for Delphi

To enumerate file names in a directory and subdirectories


 Use the _Directory.EnumerateFiles_2(WideString, WideString, SearchOption) method to search a
directory and (optionally) its subdirectories, and to obtain a list of file names that match a specified search
pattern.

Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Collections,

CNClrLib.Core,

CNClrLib.Enums,

CNClrLib.Host,

CNClrLib.Host.Helper,

System.Win.ComObj;

294
.Net Runtime Library for Delphi

var

Console: _Console;

Directory: _Directory;

fileNames: _GenericList;

AFile: _File;

fileName, line: string;

Lines: _StringArray;

AException: _Exception;

UnauthorizedAccessException: _UnauthorizedAccessException;

PathTooLongException: _PathTooLongException;

I, J: Integer;

begin

Console := CoConsole.CreateInstance;

try

Directory := CoDirectory.CreateInstance;

fileNames := CoGenericList.CreateInstance(

Directory.EnumerateFiles_2('C:\', '*.txt',
SearchOption_AllDirectories));

AFile := CoFile.CreateInstance;

for I := 0 to fileNames.Count - 1 do

begin

fileName := fileNames[I];

Lines := AFile.ReadAllLines(fileName);

for J := 0 to Lines.Length - 1 do

begin

if TClrStringHelper.Contains(Lines[I], 'Microsoft') then

Console.WriteLine_17('{0}\t{1}', fileName, Lines[J]);

295
.Net Runtime Library for Delphi

end;

end;

Console.WriteLine_15('{0} files found.',


fileNames.Count.ToString);

except

on E: EOleSysError do

begin

AException := EClrException.GetExceptionIntf(E.ErrorCode);

if AException.GetType.Name = 'UnauthorizedAccessException'
then

begin

UnauthorizedAccessException :=
CoUnauthorizedAccessException.Wrap(AException);

Console.WriteLine_14(UnauthorizedAccessException.Message);

end

else if AException.GetType.Name = 'PathTooLongException'


then

begin

PathTooLongException :=
CoPathTooLongException.Wrap(AException);

Console.WriteLine_14(PathTooLongException.Message);

end

else

Console.WriteLine_14(AException.Message);

end;

end;

Console.ReadLine();

end.

296
.Net Runtime Library for Delphi

3.15.3 How to: Read and Write to a Newly


Created Data File
The _BinaryWriter and _BinaryReader interfaces are used for writing and reading data rather than character strings.
The following example demonstrates how to write data to, and read data from, a new, empty file stream called
Test.data. After creating the data file in the current directory, the associated _BinaryWriterand _BinaryReaderobjects
are created, and the _BinaryWriterobject is used to write the integers 0 through 10 to Test.data, which leaves the file
pointer at the end of the file. After setting the file pointer back to the origin, the _BinaryReader object reads out the
specified content.
Example

Delphi

program MyStream;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Core,

CNClrLib.Enums,

CNClrLib.EnumTypes,

CNClrLib.Host;

const

FILE_NAME = 'Test.data';

var

297
.Net Runtime Library for Delphi

Console: _Console;

AFile: _File;

fstream: _FileStream;

writer: _BinaryWriter;

reader: _BinaryReader;

I: Integer;

begin

Console := CoConsole.CreateInstance;

AFile := CoFile.CreateInstance;

if AFile.Exists(FILE_NAME) then

begin
Console.WriteLine_15('{0} already exist!',
FILE_NAME);

Exit;

end;

fstream :=
CoFileStream.CreateInstance(FILE_NAME,
fmCreateNew);

try
writer :=
CoBinaryWriter.CreateInstance(fstream.AsStream);

try
for I := 0 to 11 do

writer.Write_12(I);

298
.Net Runtime Library for Delphi

finally
writer.Close;

writer.Dispose;

end;

finally
fstream.Close;

fstream.Dispose;

end;

fstream :=
CoFileStream.CreateInstance(FILE_NAME, fmOpen,
[faRead]);

try
reader :=
CoBinaryReader.CreateInstance(fstream.AsStream);

try
for I := 0 to 11 do

Console.WriteLine_8(reader.ReadInt32);

finally
reader.Close;

reader.Dispose;

end;

finally
fstream.Close;

fstream.Dispose;

end;

299
.Net Runtime Library for Delphi

Console.ReadLine();

end.

300
.Net Runtime Library for Delphi

Robust Programming
If Test.data already exists in the current directory, an exception is thrown. Use the file mode option FileMode.Create
when you initialize the file stream to always create a new file without throwing an exception.

3.15.4 How to: Open and Append to a Log


File
_StreamWriter and _StreamReader interfaces have methods which write characters to and
read characters from streams. The following code example opens the log.txt file for input, or
creates the file if it does not already exist, and appends information to the end of the file. The
contents of the file are then written to standard output for display. As an alternative to this
example, the information could be stored as a single string or string array, and the
WriteAllText or WriteAllLines method could be used to achieve the same functionality.

Example

Delphi

program MyStream;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Core,

301
.Net Runtime Library for Delphi

CNClrLib.Host,

CNClrLib.Host.Helper;

var

Console: _Console;

AFile: _File;

writer: _StreamWriter;

reader: _StreamReader;

procedure Log(ALogMessage: string; AWriter:


_TextWriter);

begin
AWriter.WriteLine;

AWriter.Write_11('Log Entry : ');

AWriter.WriteLine_17('{0} {1}',
TClrDateTimeHelper.ToLongTimeString(Now),

TClrDateTimeHelper.ToLongDateString(Now));

AWriter.WriteLine_12(' :');

AWriter.WriteLine_15(' :{0}', ALogMessage);

AWriter.WriteLine_12 ('-----------------------
--------');

end;

procedure DumpLog(AReader: _StreamReader);

var
line: string;

302
.Net Runtime Library for Delphi

begin
while not AReader.EndOfStream do

Console.WriteLine_14(AReader.ReadLine);

end;

begin

Console := CoConsole.CreateInstance;

AFile := CoFile.CreateInstance;

writer := AFile.AppendText('log.txt');

try
Log('Text1', CoTextWriter.Wrap(writer));

Log('Text2', CoTextWriter.Wrap(writer));

finally
writer.Close;

writer.Dispose;

end;

reader := AFile.OpenText('log.txt');

try
DumpLog(reader);

finally
reader.Close;

reader.Dispose;

end;

303
.Net Runtime Library for Delphi

Console.ReadLine;

end.

3.15.5 How to: Write Text to a File


This topic shows different ways you can write text to a file for delphi applications using the runtime library. The
following interface and methods are typically used to write text to a file:
 _StreamWriter - it contains methods to write to a file synchronously ( Write or WriteLine) or asynchronously
(WriteAsync and WriteLineAsync).
 _File - to be used with Delphi applications. It provides methods to write text to a file such as WriteAllLines
and WriteAllText, or to append text to a file (AppendAllLines, AppendAllText or AppendText).
The samples have been kept simple in order to focus on the task being performed. For this reason, the samples perform
minimal error checking and exception handling, if any. A real-world application generally provides more robust error
checking and exception handling.
Example 1
The following example shows how to synchronously write text to a new file using the _StreamWriter interface, one line
at a time. The new text file is saved to the user's My Documents folder.
Delphi

var

lines: TArray<string>;

Environment: _Environment;

mydocpath, line: string;

outputFile: _StreamWriter;

I: Integer;

begin

// Create a string array with the lines of text

Lines := TArray<string>.Create('First line', 'Second line', 'Third


line');

// Create static instance of the Environment interface

// (In C# Environment is a static class and you don't need to


instantiate

// before using the methods; however in the runtime library, all


static

// classes which is represented as interfaces have to be


instantiated

304
.Net Runtime Library for Delphi

// before their method can be used)

Environment := CoEnvironment.CreateInstance;

// Set a variable to the My Documents path.

mydocpath := Environment.GetFolderPath(SpecialFolder_MyDocuments);

// Write the string array to a new file named "WriteLines.txt".

outputFile := CoStreamWriter.CreateInstance(mydocpath +
'\WriteLines.txt');

try

for line in Lines do

outputFile.WriteLine_12(line);

finally

outputFile.Close;

outputFile.Dispose;

end;

end.

305
.Net Runtime Library for Delphi

Example 2
The following example shows how to append text to an existing file using the _StreamWriter interface. It uses the same
text file from the previous example.
Delphi

var

Environment: _Environment;

mydocpath: string;

outputFile: _StreamWriter;

begin

Environment := CoEnvironment.CreateInstance;

// Set a variable to the My Documents path.

mydocpath := Environment.GetFolderPath(SpecialFolder_MyDocuments);

// Append text to an existing file named "WriteLines.txt".

outputFile := CoStreamWriter.CreateInstance(mydocpath +
'\WriteLines.txt', True);

try

outputFile.WriteLine_12('Fourth Line');

finally

outputFile.Close;

306
.Net Runtime Library for Delphi

outputFile.Dispose;

end;

end.

See Also
How to: Enumerate Directories and Files
How to: Read and Write to a Newly Created Data File
How to: Open and Append to a Log File
How to: Read Text from a File

3.15.6 How to: Read Text from a File


The following examples show how to read text synchronously and asynchronously from a text file using .NET for
desktop apps. In both examples, when you create the instance of the _StreamReader interface, you provide the relative
or absolute path to the file. The following examples assume that the file named TestFile.txt is in the same folder as the
application.
Example
The first example shows a synchronous read operation within a console application. In this example, the text file is
opened using a stream reader, the contents are copied to a string and string is output to the console.
Delphi

307
.Net Runtime Library for Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Core,

CNClrLib.Host;

var

Console: _Console;

sr: _StreamReader;

line: string;

begin

Console := CoConsole.CreateInstance;

// Open the text file using a stream reader.

try

sr := CoStreamReader.CreateInstance('TestFile.txt');

try

// Read the stream to a string, and write the string to the


console.

line := sr.ReadToEnd();

Console.WriteLine_14(line);

finally

sr.Close;

sr.Dispose;

end;

except

on E: Exception do

308
.Net Runtime Library for Delphi

begin

Console.WriteLine_14('The file could not be read:');

Console.WriteLine_14(e.Message);

end;

end;

Console.ReadLine;

end.

309
.Net Runtime Library for Delphi

See Also

How to: Read and Write to a Newly Created Data File


How to: Open and Append to a Log File
How to: Write Text to a File
How to: Read Characters from a String
How to: Write Characters to a String

3.15.7 How to: Read Characters from a String


The following code examples show how to read characters synchronously and asynchronously from a string.
Example
This example reads 13 characters synchronously from a string, stores them in an array, and displays those characters. It
then reads the remaining characters in the string, stores them in the array starting at the sixth element, and displays the
contents of the array.
Delphi

program CharsFromStr;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Core,

CNClrLib.Host;

var

Console: _Console;

sr: _StringReader;

str: string;

b: _CharArray;

begin

Console := CoConsole.CreateInstance;

310
.Net Runtime Library for Delphi

str := 'Some number of characters';

b := CoCharArray.CreateInstance(str.Length);

sr := CoStringReader.CreateInstance(str);

try

// Read 13 characters from the string into the array.

sr.Read_1(b, 0, 13);

Console.WriteLine_3(b);

// Read the rest of the string starting at the current string


position.

// Put in the array starting at the 6th array member.

sr.Read_1(b, 5, str.Length - 13);

Console.WriteLine_3(b);

finally

sr.Close;

sr.Dispose;

end;

Console.ReadLine;

end.

// The example has the following output:

//

// Some number o

// Some f characters

311
.Net Runtime Library for Delphi

See Also

How to: Read and Write to a Newly Created Data File


How to: Open and Append to a Log File
How to: Write Text to a File
How to: Write Characters to a String

3.15.8 How to: Write Characters to a String


The following code examples write characters synchronously and asynchronously from a
character array into a string.

Example

312
.Net Runtime Library for Delphi

The following example writes 5 characters synchronously from an array to a string.


Delphi

program CharsToStr;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Core,

CNClrLib.Host;

var

Console: _Console;

sb: _StringBuilder;

sw: _StringWriter;

b: _CharArray;

begin

Console := CoConsole.CreateInstance;

sb := CoStringBuilder.CreateInstance('Start with a string and add


from ');

b := TClrArrayHelper.ToCharArray(['c', 'h', 'a', 'r', '.', ' ', 'B',


'u', 't', ' '

, 'n', 'o', 't', ' ', 'a', 'l', 'l']);

sw := CoStringWriter.CreateInstance(sb);

try

// Write five characters from the array into the StringBuilder.

sw.Write_1(b, 0, 5);

Console.WriteLine_12(sb);

finally

313
.Net Runtime Library for Delphi

sw.Close;

sw.Dispose;

end;

Console.ReadLine;

end.

// The example has the following output:

//

// Start with a string and add from char.

314
.Net Runtime Library for Delphi

See Also

How to: Read and Write to a Newly Created Data File


How to: Open and Append to a Log File
How to: Write Text to a File
How to: Read Characters from a String

3.15.9 How to: Compress and Extract Files


The CNClrLib.IO namespace contains the following types for compressing and decompressing files and streams. You can
also use these types to read and modify the contents of a compressed file:
 ZipFile
 ZipArchive
 ZipArchiveEntry
 DeflateStream
 GZipStream
The following examples show some of the functions you can perform when working with compressed files.
Example 1
This example shows how to create and extract a compressed file that has a .zip file name extension by using the ZipFile
interface. It compresses the contents of a folder into a new .zip file and then extracts that content to a new folder.
Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Core,

CNClrLib.IO,

315
.Net Runtime Library for Delphi

CNClrLib.Host;

var

startPath,

zipPath,

extractPath: string;

ZipFile: _ZipFile;

begin

startPath := 'c:\example\start';

zipPath := 'c:\example\result.zip';

extractPath := 'c:\example\extract';

ZipFile := CoZipFile.CreateInstance;

ZipFile.CreateFromDirectory(startPath, zipPath);

ZipFile.ExtractToDirectory(zipPath, extractPath);

end.

316
.Net Runtime Library for Delphi

Example 2
The next example shows how to iterate through the contents of an existing .zip file and extract files that have a .txt
extension. It uses the ZipArchive interface to access an existing .zip file, and the ZipArchiveEntry interface to inspect
the individual entries in the compressed file. It uses an extension method (ExtractToFile) for the ZipArchiveEntry
object.
Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Core,

CNClrLib.EnumTypes,

CNClrLib.Collections,

CNClrLib.IO,

CNClrLib.Host,

CNClrLib.Host.Helper;

var

zipPath,

extractPath: string;

ZipFile: _ZipFile;

317
.Net Runtime Library for Delphi

archive: _ZipArchive;

zipArchiveEntry: _ZipArchiveEntry;

ZipArchiveEntries: _GenericReadOnlyCollection;

entry: _ZipArchiveEntry;

zipFileExt: _ZipFileExtensions;

Path: _Path;

I: Integer;

begin

zipPath := 'c:\example\result.zip';

extractPath := 'c:\example\extract';

ZipFile := CoZipFile.CreateInstance;

archive := ZipFile.OpenRead(zipPath);

try

Path := CoPath.CreateInstance;

zipFileExt := CoZipFileExtensions.CreateInstance;

ZipArchiveEntries := archive.Entries;

for I := 0 to ZipArchiveEntries.Count - 1 do

begin

entry := CoZipArchiveEntry.Wrap(ZipArchiveEntries[I]);

if TClrStringHelper.EndsWith(entry.FullName, '.txt',
scOrdinalIgnoreCase) then

zipFileExt.ExtractToFile(entry, Path.Combine(extractPath,
entry.FullName));

end;

finally

archive.Dispose;

end;

end.

318
.Net Runtime Library for Delphi

319
.Net Runtime Library for Delphi

Example 3
The next example uses the ZipArchive interface to access an existing .zip file, and adds a new file to the compressed file.
The new file gets compressed when you add it to the existing .zip file.
Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Core,

CNClrLib.EnumTypes,

CNClrLib.IO,

CNClrLib.Host;

var

Console: _Console;

zipToOpen: _FileStream;

archive: _ZipArchive;

readmeEntry: _ZipArchiveEntry;

writer: _StreamWriter;

begin

Console := CoConsole.CreateInstance;

zipToOpen :=
CoFileStream.CreateInstance('c:\users\exampleuser\release.zip',
fmOpen);

try

archive := CoZipArchive.CreateInstance(zipToOpen, zamUpdate);

try

readmeEntry := archive.CreateEntry('Readme.txt');

writer := CoStreamWriter.CreateInstance(readmeEntry.Open);

try

320
.Net Runtime Library for Delphi

writer.WriteLine_12('Information about this package.');

writer.WriteLine_12('========================');

finally

writer.Close;

writer.Dispose;

end;

finally

archive.Dispose;

end;

finally

zipToOpen.Close;

zipToOpen.Dispose;

end;

Console.ReadLine;

end.

321
.Net Runtime Library for Delphi

Example 4
You can also use the GZipStream and DeflateStream interfaces to compress and decompress data. They use the same
compression algorithm. Compressed GZipStream objects that are written to a file that has an extension of .gz can be
decompressed by using many common tools in addition to the methods provided by GZipStream. This example shows
how to compress and decompress a directory of files by using the GZipStream interface.
Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Core,

CNClrLib.Enums,

CNClrLib.EnumTypes,

CNClrLib.IO,

CNClrLib.Host;

const

directoryPath = 'c:\temp';

322
.Net Runtime Library for Delphi

var

Console: _Console;

procedure Compress(directorySelected: _DirectoryInfo);

var

fileToCompress: _FileInfoArray;

originalFileStream,

compressedFileStream: _FileStream;

compressionStream: _GZipStream;

AFile: _File;

info: _FileInfo;

I: Integer;

begin

AFile := CoFile.CreateInstance;

fileToCompress := directorySelected.GetFiles_2;

for I := 0 to fileToCompress.Length - 1 do

begin

originalFileStream := fileToCompress[I].OpenRead;

try

if (AFile.GetAttributes(fileToCompress[I].FullName) <>
FileAttributes_Hidden) and

(fileToCompress[I].Extension <> '.gz') then

begin

compressedFileStream :=
AFile.Create(fileToCompress[I].FullName + '.gz');

try

compressionStream :=
CoGZipStream.CreateInstance(compressedFileStream.AsStream,
cmCompress);

try

originalFileStream.CopyTo(compressionStream.AsStream);

finally

compressionStream.Close;

compressionStream.Dispose;

end;

323
.Net Runtime Library for Delphi

finally

compressedFileStream.Close;

compressedFileStream.Dispose;

end;

info := CoFileInfo.CreateInstance(directoryPath + '\' +


fileToCompress[I].Name + '.gz');

Console.WriteLine_19('Compressed {0} from {1} to {2}


bytes.', fileToCompress[I].Name,

fileToCompress.Length.ToString(),
info.Length.ToString());

end;

finally

originalFileStream.Close;

originalFileStream.Dispose;

end;

end;

end;

procedure Decompress(fileToDecompress: _FileInfo);

var

originalFileStream,

decompressedFileStream: _FileStream;

decompressionStream: _GZipStream;

currentFileName,

newFileName: string;

AFile: _File;

begin

AFile := CoFile.CreateInstance;

originalFileStream := fileToDecompress.OpenRead;

try

currentFileName := fileToDecompress.FullName;

newFileName := currentFileName.Remove(currentFileName.Length -
string(fileToDecompress.Extension).Length);

decompressedFileStream := AFile.Create(newFileName);

324
.Net Runtime Library for Delphi

decompressionStream :=
CoGZipStream.CreateInstance(originalFileStream.AsStream,
cmDecompress);

try

decompressionStream.CopyTo(decompressedFileStream.AsStream);

Console.WriteLine_15('Decompressed: {0}',
fileToDecompress.Name);

finally

end;

finally

originalFileStream.Close;

originalFileStream.Dispose;

end;

end;

var

directorySelected: _DirectoryInfo;

fileInfoArray: _FileInfoArray;

I: Integer;

begin

Console := CoConsole.CreateInstance;

directorySelected := CoDirectoryInfo.CreateInstance(directoryPath);

Compress(directorySelected);

fileInfoArray := directorySelected.GetFiles('*.gz');

for I := 0 to fileInfoArray.Length - 1 do

Decompress(fileInfoArray[I]);

Console.ReadLine;

end.

325
.Net Runtime Library for Delphi

3.15.10 Composing Streams


A backing store is a storage medium, such as a disk or memory. Each different backing store
implements its own stream as an implementation of the _Stream interface. Each stream type
reads and writes bytes from and to its given backing store. Streams that connect to backing
stores are called base streams. Base streams have constructors that have the parameters
necessary to connect the stream to the backing store. For example, _FileStream has
constructors that specify a path parameter, which specifies how the file will be shared by
processes, and so on.

The following code example creates a FileStream around the existing MyFile.txt in order to buffer MyFile.txt.
(Note that FileStreams are buffered by default.) Next, a StreamReader is created to read characters from the
FileStream, which is passed to the StreamReader as its constructor argument. ReadLine reads until Peek finds no
more characters.
Delphi

program CompBuf;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Core,

CNClrLib.Enums,

CNClrLib.EnumTypes,

CNClrLib.Host;

const

FILE_NAME = 'MyFile.txt';

var

Console: _Console;

326
.Net Runtime Library for Delphi

AFile: _File;

fstream: _FileStream;

reader: _StreamReader;

I: Integer;

input: string;

begin

Console := CoConsole.CreateInstance;

AFile := CoFile.CreateInstance;

if AFile.Exists(FILE_NAME) then

begin

Console.WriteLine_15('{0} already exist!', FILE_NAME);

Exit;

end;

fstream := CoFileStream.CreateInstance(FILE_NAME, fmOpen, [faRead],


[fsRead]);

try

// Create an instance of StreamReader that can read

// characters from the FileStream.

reader := CoStreamReader.CreateInstance(fstream.AsStream);

try

// While not at the end of the file, read lines from the file.

while reader.Peek > -1 do

begin

input := reader.ReadLine;

Console.WriteLine_14(input);

end;

finally

reader.Close;

reader.Dispose;

end;

327
.Net Runtime Library for Delphi

finally

fstream.Close;

fstream.Dispose;

end;

Console.ReadLine();

end.

328
.Net Runtime Library for Delphi

The following code example creates a FileStream around the existing MyFile.txt in order to buffer MyFile.txt.
(Note that FileStreams are buffered by default.) Next, a BinaryReader is created to read bytes from the FileStream,
which is passed to the BinaryReader as its constructor argument. ReadByte reads until PeekChar finds no more bytes.
Delphi

program ReadBuf;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Core,

CNClrLib.Enums,

CNClrLib.EnumTypes,

CNClrLib.Host;

const

329
.Net Runtime Library for Delphi

FILE_NAME = 'MyFile.txt';

var

Console: _Console;

AFile: _File;

fstream: _FileStream;

breader: _BinaryReader;

I: Integer;

input: byte;

begin

Console := CoConsole.CreateInstance;

AFile := CoFile.CreateInstance;

if AFile.Exists(FILE_NAME) then

begin

Console.WriteLine_15('{0} already exist!', FILE_NAME);

Exit;

end;

fstream := CoFileStream.CreateInstance(FILE_NAME, fmOpen, [faRead],


[fsRead]);

try

// Create an instance of BinaryReader that can

// read bytes from the FileStream.

breader := CoBinaryReader.CreateInstance(fstream.AsStream);

try

// While not at the end of the file, read lines from the file.

while breader.PeekChar > -1 do

begin

input := breader.ReadByte;

Console.WriteLine_12(input);

end;

finally

330
.Net Runtime Library for Delphi

breader.Close;

breader.Dispose;

end;

finally

fstream.Close;

fstream.Dispose;

end;

Console.ReadLine();

end.

3.16 Globalization
Globalization involves designing and developing a world-ready app that supports localized interfaces and regional data
for users in multiple cultures. Before beginning the design phase, you should determine which cultures your app will
support. Although an app targets a single culture or region as its default, you can design and write it so that it can easily
be extended to users in other cultures or regions.
As developers, we all have assumptions about user interfaces and data that are formed by our cultures. For example, for
an English-speaking developer in the United States, serializing date and time data as a string in the format MM/dd/yyyy
hh:mm:ss seems perfectly reasonable. However, deserializing that string on a system in a different culture is likely to
throw a FormatException exception or produce inaccurate data. Globalization enables us to identify such culture-
specific assumptions and ensure that they do not affect our app's design or code.
The following sections discuss some of the major issues you should consider and the best practices you can follow
when handling strings, date and time values, and numeric values in a globalized app.
 Handling Strings
o Use Unicode Internally
o Testing Strings for Equality
 Handling Dates and Times
o Persisting Dates and Times
o Displaying Dates and Times
o Serialization and Time Zone Awareness
o Performing Date and Time Arithmetic
 Handling Numeric Values
o Displaying Numeric Values
o Persisting Numeric Values
 Working with Culture-Specific Settings

Handling Strings
The handling of characters and strings is a central focus of globalization, because each culture or region may use
different characters and character sets and sort them differently. This section provides recommendations for using
strings in globalized apps.

Use Unicode Internally


A Unicode string consists of zero, one, or more Char objects, each of which represents a UTF-16 code unit. There is a
Unicode representation for almost every character in every character set in use throughout the world.
Many applications and operating systems, including the Windows operating system, can use also use code pages to
represent character sets. Code pages typically contain the standard ASCII values from 0x00 through 0x7F and map other
characters to the remaining values from 0x80 through 0xFF. The interpretation of values from 0x80 through 0xFF
depends on the specific code page. Because of this, you should avoid using code pages in a globalized app if possible.
The following example illustrates the dangers of interpreting code page data when the default code page on a system is
different from the code page on which the data was saved. (To simulate this scenario, the example explicitly specifies

331
.Net Runtime Library for Delphi

different code pages.) First, the example defines an array that consists of the uppercase characters of the Greek
alphabet. It encodes them into a byte array by using code page 737 (also known as MS-DOS Greek) and saves the byte
array to a file. If the file is retrieved and its byte array is decoded by using code page 737, the original characters are
restored. However, if the file is retrieved and its byte array is decoded by using code page 1252 (or Windows-1252,
which represents characters in the Latin alphabet), the original characters are lost.
Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

Winapi.Windows,

System.SysUtils,

CNClrLib.EnumTypes,

CNClrLib.Core,

CNClrLib.Host,

CNClrLib.Host.Helper;

var

Console: _Console;

greekChars: _CharArray;

cp737, cp1252: _Encoding;

EncHelper: _EncodingHelper;

nBytes: Integer;

bytes737, bytes1: _ByteArray;

fs: _FileStream;

data: string;

begin

// Make sure this method is called to change the console's output


code page to UTF8

// in order to display the unicode characters

SetConsoleOutputCP(CP_UTF8);

Console := CoConsole.CreateInstance;

332
.Net Runtime Library for Delphi

// Represent Greek uppercase characters in code page 737.

greekChars := TClrArrayHelper.ToCharArray(['Α', 'Β', 'Γ', 'Δ', 'Ε',


'Ζ', 'Η', 'Θ',

'Ι', 'Κ', 'Λ', 'Μ', 'Ν',


'Ξ', 'Ο', 'Π',

'Ρ', 'Σ', 'Τ', 'Υ', 'Φ',


'Χ', 'Ψ', 'Ω']);

EncHelper := CoEncodingHelper.CreateInstance;

cp737 := EncHelper.GetEncoding(737);

nBytes := cp737.GetByteCount(greekChars);

// bytes737 := CoByteArray.CreateInstance(nBytes);

bytes737 := cp737.GetBytes(greekChars);

// Write the bytes to a file.

fs := CoFileStream.CreateInstance('.\\CodePageBytes.dat', fmCreate);

fs.Write(bytes737, 0, bytes737.Length);

fs.Close();

// Retrieve the byte data from the file.

fs := CoFileStream.CreateInstance('.\\CodePageBytes.dat', fmOpen);

bytes1 := CoByteArray.CreateInstance(fs.Length);

fs.Read(bytes1, 0, fs.Length);

fs.Close();

// Restore the data on a system whose code page is 737.

data := cp737.GetString(bytes1);

Console.WriteLine_13(CoClrObject.Wrap(data));

Console.WriteLine;

// Restore the data on a system whose code page is 1252.

cp1252 := EncHelper.GetEncoding(1252);

data := cp1252.GetString(bytes1);

Console.WriteLine_14(data);

Console.ReadLine();

333
.Net Runtime Library for Delphi

end.

// The example displays the following output:

// ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ

// €‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—

334
.Net Runtime Library for Delphi

The use of Unicode ensures that the same code units always map to the same characters, and that the same characters
always map to the same byte arrays.

Testing Strings for Equality


If you want to test two strings for equality rather than determining how they compare in the sort order, use the
TClrStringHelper.Equals method instead of a string comparison method such as TClrStringHelper.Compare or
_CompareInfo.Compare.
Comparisons for equality are typically performed to access some resource conditionally. For example, you might
perform a comparison for equality to verify a password or to confirm that a file exists. Such non-linguistic comparisons
should always be ordinal rather than culture-sensitive. In general, you should call the the static
TClrStringHelper.Equals(String, String, StringComparison) method with a value of TStringComparison.scOrdinal for
strings such as passwords, and a value of TStringComparison.scOrdinalIgnoreCase for strings such as file names or URIs.
Comparisons for equality sometimes involve searches or substring comparisons rather than calls to the
TClrStringHelper.Equals method. In some cases, you may use a substring search to determine whether that substring
equals another string. If the purpose of this comparison is non-linguistic, the search should also be ordinal rather than
culture-sensitive.
The following example illustrates the danger of a culture-sensitive search on non-linguistic data. The
AccessesFileSystem method is designed to prohibit file system access for URIs that begin with the substring "FILE".
To do this, it performs a culture-sensitive, case-insensitive comparison of the beginning of the URI with the string "FILE".
Because a URI that accesses the file system can begin with either "FILE:" or "file:", the implicit assumption is that that "i"
(U+0069) is always the lowercase equivalent of "I" (U+0049). However, in Turkish and Azerbaijani, the uppercase version
of "i" is "I" (U+0130). Because of this discrepancy, the culture-sensitive comparison allows file system access when it
should be prohibited.
Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

335
.Net Runtime Library for Delphi

uses

CNClrLib.Core,

CNClrLib.Host,

CNClrLib.Host.Helper;

var

Console: _Console;

cultureHelper: _CultureInfoHelper;

threadHelper: _ThreadHelper;

uri: string;

function AccessesFileSystem(uri: string): Boolean;

begin

Result := TClrStringHelper.StartsWith(uri, 'FILE', True,


cultureHelper.CurrentCulture);

end;

begin

Console := CoConsole.CreateInstance;

//NB: The Helper Class instance is created to access the static


methods of the CultureInfo

cultureHelper := CoCultureInfoHelper.CreateInstance;

threadHelper := CoThreadHelper.CreateInstance;

threadHelper.CurrentThread.CurrentCulture :=
cultureHelper.CreateSpecificCulture('tr-TR');

uri := 'file:\\c:\users\username\Documents\bio.txt';

if not AccessesFileSystem(uri) then

// Permit access to resource specified by URI

Console.WriteLine_14('Access is allowed.')

else

336
.Net Runtime Library for Delphi

// Prohibit access.

Console.WriteLine_14('Access is not allowed.');

Console.ReadLine();

end.

// The example displays the following output:

// Access is allowed.

337
.Net Runtime Library for Delphi

You can avoid this problem by performing an ordinal comparison that ignores case, as the following example shows.
Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.EnumTypes,

CNClrLib.Core,

CNClrLib.Host,

CNClrLib.Host.Helper;

var

Console: _Console;

cultureHelper: _CultureInfoHelper;

threadHelper: _ThreadHelper;

uri: string;

function AccessesFileSystem(uri: string): Boolean;

begin

Result := TClrStringHelper.StartsWith(uri, 'FILE',


scOrdinalIgnoreCase);

end;

begin

Console := CoConsole.CreateInstance;

338
.Net Runtime Library for Delphi

//NB: The Helper Class instance is created to access the static


methods of the CultureInfo

cultureHelper := CoCultureInfoHelper.CreateInstance;

threadHelper := CoThreadHelper.CreateInstance;

threadHelper.CurrentThread.CurrentCulture :=
cultureHelper.CreateSpecificCulture('tr-TR');

uri := 'file:\\c:\users\username\Documents\bio.txt';

if not AccessesFileSystem(uri) then

// Permit access to resource specified by URI

Console.WriteLine_14('Access is allowed.')

else

// Prohibit access.

Console.WriteLine_14('Access is not allowed.');

Console.ReadLine();

end.

// The example displays the following output:

// Access is not allowed.

339
.Net Runtime Library for Delphi

Handling Dates and Times


How you handle date and time values depends on whether they are displayed in the user interface or persisted. This
section examines both usages. It also discusses how you can handle time zone differences and arithmetic operations
when working with dates and times.

Displaying Dates and Times


Typically, when dates and times are displayed in the user interface, you should use the formatting conventions of the
user's culture, which is defined by the CultureInfoHelper.CurrentCulture property and by the DateTimeFormatInfo
interface returned by the CultureInfoHelper.CurrentCulture.DateTimeFormat property. The formatting conventions
of the current culture are automatically used when you format a date by using any of these methods:
 The TClrDateTimeHelper.ToString method. Accept as parameter only the datetime to convert to string.
 The TClrDateTimeHelper.ToString(String) method, which includes a format string
 The parameterless _DateTimeOffset.ToString() method
 The _DateTimeOffset.ToString(String), which includes a format string
 The composite formatting feature, when it is used with dates
The following example displays sunrise and sunset data twice for October 11, 2012. It first sets the current culture to
Croatian (Croatia), and then to English (Great Britain). In each case, the dates and times are displayed in the format that
is appropriate for that culture.
Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.Core,

CNClrLib.Host,

340
.Net Runtime Library for Delphi

CNClrLib.Host.Helper;

var

Console: _Console;

cultureHelper: _CultureInfoHelper;

threadHelper: _ThreadHelper;

dates: _DateTimeArray;

procedure ShowDayInfo;

begin

Console.WriteLine_15('Date: {0:D}', dates[0]);

Console.WriteLine_15(' Sunrise: {0:T}', dates[0]);

Console.WriteLine_15(' Sunset: {0:T}', dates[1]);

end;

begin

Console := CoConsole.CreateInstance;

dates :=
TClrArrayHelper.ToDateTimeArray([TClrDateTimeHelper.GetDateTime(2012,
10, 11, 7, 06, 0),

TClrDateTimeHelper.GetDateTime(2012, 10, 11, 18, 19, 0)]);

cultureHelper := CoCultureInfoHelper.CreateInstance;

threadHelper := CoThreadHelper.CreateInstance;

// Change thread to hr-HR.

threadHelper.CurrentThread.CurrentCulture :=
cultureHelper.CreateSpecificCulture('hr-HR');

ShowDayInfo;

Console.WriteLine;

// Change thread to en-GB.

341
.Net Runtime Library for Delphi

threadHelper.CurrentThread.CurrentCulture :=
cultureHelper.CreateSpecificCulture('en-GB');

ShowDayInfo;

Console.ReadLine();

end.

// The example displays the following output:

// Date: 11. listopada 2012.

// Sunrise: 7:06:00

// Sunset: 18:19:00

//

// Date: 11 October 2012

// Sunrise: 07:06:00

// Sunset: 18:19:00

342
.Net Runtime Library for Delphi

Persisting Dates and Times


You should never persist date and time data in a format that can vary by culture. This is a common programming error
that results in either corrupted data or a run-time exception. The following example serializes two dates, January 9, 2013
and August 18, 2013, as strings by using the formatting conventions of the English (United States) culture. When the
data is retrieved and parsed by using the conventions of the English (United States) culture, it is successfully restored.
However, when it is retrieved and parsed by using the conventions of the English (United Kingdom) culture, the first
date is wrongly interpreted as September 1, and the second fails to parse because the Gregorian calendar does not
have an eighteenth month.
Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.Core,

CNClrLib.Host,

CNClrLib.Host.Helper;

var

Console: _Console;

cultureHelper: _CultureInfoHelper;

threadHelper: _ThreadHelper;

dates: _DateTimeArray;

sw: _StreamWriter;

343
.Net Runtime Library for Delphi

sr: _StreamReader;

dateData, dateStr: string;

clrdateStrings: _StringArray;

dateStrings: TClrStringDynArray;

restoredDate: TDateTime;

begin

Console := CoConsole.CreateInstance;

cultureHelper := CoCultureInfoHelper.CreateInstance;

threadHelper := CoThreadHelper.CreateInstance;

// Persist two dates as strings.

// Change thread to hr-HR.

threadHelper.CurrentThread.CurrentCulture :=
cultureHelper.CreateSpecificCulture('en-US');

dates :=
TClrArrayHelper.ToDateTimeArray([TClrDateTimeHelper.GetDateTime(2013,
1, 9),

TClrDateTimeHelper.GetDateTime(2013, 8, 18)]);

sw := CoStreamWriter.CreateInstance('dateData.dat');

sw.Write_16('{0:d}|{1:d}', dates[0], dates[1]);

sw.Close();

// Read the persisted data.

sr := CoStreamReader.CreateInstance('dateData.dat');

dateData := sr.ReadToEnd();

sr.Close();

clrdateStrings := TClrStringHelper.Split(dateData, ['|']);

dateStrings := TClrArrayHelper.ToStringDynArray(clrdateStrings);

344
.Net Runtime Library for Delphi

// Restore and display the data using the conventions of the en-US
culture.

Console.WriteLine_15('Current Culture: {0}',

threadHelper.CurrentThread.CurrentCulture.DisplayName);

for dateStr in dateStrings do

begin

if TClrDateTimeHelper.TryParse(dateStr, restoredDate) then

Console.WriteLine_15('The date is {0:D}', restoredDate)

else

Console.WriteLine_15('ERROR: Unable to parse {0}', dateStr);

end;

Console.WriteLine();

// Restore and display the data using the conventions of the en-GB
culture.

threadHelper.CurrentThread.CurrentCulture :=
cultureHelper.CreateSpecificCulture('en-GB');

Console.WriteLine_15('Current Culture: {0}',

threadHelper.CurrentThread.CurrentCulture.DisplayName);

for dateStr in dateStrings do

begin

if TClrDateTimeHelper.TryParse(dateStr, restoredDate) then

Console.WriteLine_15('The date is {0:D}', restoredDate)

else

Console.WriteLine_15('ERROR: Unable to parse {0}', dateStr);

end;

Console.ReadLine();

end.

345
.Net Runtime Library for Delphi

// The example displays the following output:

// Current Culture: English (United States)

// The date is Wednesday, January 09, 2013

// The date is Sunday, August 18, 2013

//

// Current Culture: English (United Kingdom)

// The date is 01 September 2013

// ERROR: Unable to parse 8/18/2013

346
.Net Runtime Library for Delphi

You can avoid this problem in any of three ways:


 Serialize the date and time in binary format rather than as a string.
 Save and parse the string representation of the date and time by using a custom format string that is the
same regardless of the user's culture.
 Save the string by using the formatting conventions of the invariant culture.
The following example illustrates the last approach. It uses the formatting conventions of the invariant culture returned
by the static _CultureInfoHelper.InvariantCulture property.
Delphi

program ExampleApp;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.EnumTypes,

347
.Net Runtime Library for Delphi

CNClrLib.Core,

CNClrLib.Host,

CNClrLib.Host.Helper;

var

Console: _Console;

cultureHelper: _CultureInfoHelper;

threadHelper: _ThreadHelper;

dates: _DateTimeArray;

sw: _StreamWriter;

sr: _StreamReader;

dateData, dateStr: string;

clrdateStrings: _StringArray;

dateStrings: TClrStringDynArray;

restoredDate: TDateTime;

begin

Console := CoConsole.CreateInstance;

cultureHelper := CoCultureInfoHelper.CreateInstance;

threadHelper := CoThreadHelper.CreateInstance;

// Persist two dates as strings.

// Change thread to hr-HR.

threadHelper.CurrentThread.CurrentCulture :=
cultureHelper.CreateSpecificCulture('en-US');

dates :=
TClrArrayHelper.ToDateTimeArray([TClrDateTimeHelper.GetDateTime(2013,
1, 9),

TClrDateTimeHelper.GetDateTime(2013, 8, 18)]);

sw := CoStreamWriter.CreateInstance('dateData.dat');

sw.Write_16('{0:d}|{1:d}', dates[0], dates[1]);

sw.Close();

348
.Net Runtime Library for Delphi

// Read the persisted data.

sr := CoStreamReader.CreateInstance('dateData.dat');

dateData := sr.ReadToEnd();

sr.Close();

clrdateStrings := TClrStringHelper.Split(dateData, ['|']);

dateStrings := TClrArrayHelper.ToStringDynArray(clrdateStrings);

// Restore and display the data using the conventions of the en-US
culture.

Console.WriteLine_15('Current Culture: {0}',

threadHelper.CurrentThread.CurrentCulture.DisplayName);

for dateStr in dateStrings do

begin

if TClrDateTimeHelper.TryParse(dateStr, restoredDate) then

Console.WriteLine_15('The date is {0:D}', restoredDate)

else

Console.WriteLine_15('ERROR: Unable to parse {0}', dateStr);

end;

Console.WriteLine();

// Restore and display the data using the conventions of the en-GB
culture.

threadHelper.CurrentThread.CurrentCulture :=
cultureHelper.CreateSpecificCulture('en-GB');

Console.WriteLine_15('Current Culture: {0}',

threadHelper.CurrentThread.CurrentCulture.DisplayName);

for dateStr in dateStrings do

begin

349
.Net Runtime Library for Delphi

if TClrDateTimeHelper.TryParse(dateStr,

cultureHelper.InvariantCulture.AsIFormatProvider, dtsNone,
restoredDate) then

begin

Console.WriteLine_15('The date is {0:D}', restoredDate)

end

else

Console.WriteLine_15('ERROR: Unable to parse {0}', dateStr);

end;

Console.ReadLine();

end.

// The example displays the following output:

// Current Culture: English (United States)

// The date is Wednesday, January 09, 2013

// The date is Sunday, August 18, 2013

//

// Current Culture: English (United Kingdom)

// The date is 09 January 2013

// The date is 18 August 2013

350
.Net Runtime Library for Delphi

351
.Net Runtime Library for Delphi

352
.Net Runtime Library for Delphi

Working with Culture-Specific Settings


In the Runtime Library, the _CultureInfo interface represents a particular culture or region. Some of its properties return
objects that provide specific information about some aspect of a culture:
 The _CultureInfo.CompareInfo property returns a _CompareInfo interface that contains information about
how the culture compares and orders strings.
 The _CultureInfo.DateTimeFormat property returns a _DateTimeFormatInfo interface that provides
culture-specific information used in formatting date and time data.
 The _CultureInfo.NumberFormat property returns a _NumberFormatInfo interface that provides culture-
specific information used in formatting numeric data.
 The _CultureInfo.TextInfo property returns a _TextInfo interface that provides information about the
culture's writing system.

3.17 Use WideString instead of String in


DispInterfaces
The WideString type represents a dynamically allocated string of 16-bit Unicode characters. In some respects it is similar
to AnsiString. On Win32, WideString is compatible with the COM BSTR type. WideString is appropriate for use in
applications that uses .Net Runtime Library for Delphi.

Note

.Net String data type is equivalent to Widestring in Delphi and should be used when
creating dispatch interfaces that return string or string is a paramater.

Let consider the following example in C#:

C#

353
.Net Runtime Library for Delphi

//Assuming I have a C# Class which looks like this:;

// =================================================

//Compiled To: ClassLibraryTest.dll

namespace ClassLibraryTest

public class Class1

[DispId(0)]

public int Add(int a, int b)

return a + b;

[DispId(1)]

public string GetID(string ID)

return ID;

[DispId(2)]

public string GetID_(string ID)

return ID;

354
.Net Runtime Library for Delphi

The Delphi equivalent of the above C# code with dispatch IDs is shown below:

Delphi

program ClassLibraryTest;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils,

CNClrLib.Host;

type

_Class1 = dispinterface

['{10A4465E-8D4A-4AA4-B113-D1B4B37F3658}']

function Add(a, b : Integer) : Integer; dispid 0;

355
.Net Runtime Library for Delphi

function GetID(InString: WideString): WideString; dispid 1;

function GetID_(InString: String): String; dispid 2;

end;

// NB: Method GetID and GetID_ are the same excepts GetID accept
Widestring as

// parameter and GetID_ accepts string as parameter

var

oClass : _Class1;

begin

try

begin

// Assuming ClassLibraryTest.dll is in the same location as the


EXE.

TClrAssembly.LoadFrom('ClassLibraryTest.dll');

oClass :=
_Class1(TClrDispatchActivator.CreateInstance('ClassLibraryTest.Class1'
));

WriteLn('Add Method: ', oClass.Add(10, 20));

WriteLn('GetID Method: ', oClass.GetID('12345'));

WriteLn('GetID_ Method: ', oClass.GetID_('12345'));

end;

except

on E: Exception do

Writeln(E.ClassName, ': ', E.Message);

end;

end.

// Output

// Add Method: 30

// GetID Method: 12345

// GetID_ Method:

356
.Net Runtime Library for Delphi

Considering the output above, the GetID_ method which is the same as GetID method but
differ in the parameters (GetID_ method accept String as parameter whereas GetID accept

357
.Net Runtime Library for Delphi

WideString as parameter) did not return anything whereas GetID method returns the ID as
string. Because of this, it is highly recommended to use Widestring instead of string when
creating dispatch interfaces for C# codes with dispatch IDs where string is being used.

4. Dynamic Programming
This section of the documentation provides information about dynamic programming in the .NET Framework.
In This Section
Reflection using the Runtime Library

Describes how to use reflection to work with objects at run time.


Emitting Dynamic Methods and Assemblies

Describes how to create methods and assemblies at run time by using Reflection.Emit.
Dynamic Source Code Generation and Compilation

Describes how to generate and compile dynamic source code.


Related Sections
.NET Framework Development Guide
Advanced Reading for the .NET Framework

4.1 Reflection
The reflection interfaces are defined in CNClrLib.Core or CNClrLib.Core.Intf namespace which
enables you to obtain information about loaded .net assemblies and the types defined within
them, such as classes, interfaces, and value types. You can also use reflection to create type
instances at run time, and to invoke and access them.

The runtime library starts the common language runtime and the common language runtime
loader manages application domains, which constitute defined boundaries around objects that
have the same application scope. This management includes loading each assembly into the
appropriate application domain and controlling the memory layout of the type hierarchy within
each assembly.

Assemblies contain modules, modules contain types, and types contain members. Reflection
provides objects that encapsulate assemblies, modules, and types. You can use reflection to
dynamically create an instance of a type, bind the type to an existing object, or get the type
from an existing object. You can then invoke the type's methods or access its fields and
properties.

Typical uses of reflection include the following:

 Use _Assembly interface or TClrAssembly Classto define and load assemblies, load
modules that are listed in the assembly manifest, and locate a type from this assembly
and create an instance of it.
 Use _Module interface to discover information such as the assembly that contains the
module and the classes in the module. You can also get all global methods or other
specific, nonglobal methods defined on the module.

358
.Net Runtime Library for Delphi

 Use _ConstructorInfo interface to discover information such as the name, parameters,


access modifiers (such as public or private), and implementation details (such as
abstract or virtual) of a constructor. Use the GetConstructors or GetConstructor
method of a _Type to invoke a specific constructor.
 Use _MethodInfo interface to discover information such as the name, return type,
parameters, access modifiers (such as public or private), and implementation details
(such as abstract or virtual) of a method. Use the GetMethods or GetMethod method
of a _Type to invoke a specific method.
 Use _FieldInfo interface to discover information such as the name, access modifiers
(such as public or private) and implementation details (such as static) of a field, and to
get or set field values.
 Use _EventInfo interface to discover information such as the name, event-handler data
type, custom attributes, declaring type, and reflected type of an event, and to add or
remove event handlers.
 Use _PropertyInfo interface to discover information such as the name, data type,
declaring type, reflected type, and read-only or writable status of a property, and to get
or set property values.
 Use _ParameterInfo interface to discover information such as a parameter's name, data
type, whether a parameter is an input or output parameter, and the position of the
parameter in a method signature.
 Use _CustomAttributeData interface to discover information about custom attributes
when you are working in the reflection-only context of an application domain. It allows
you to examine attributes without creating instances of them.

There are other interfaces in the above namespace which provides a specialized form of
reflection that enables you to build types at runtime.

Related Topics
Viewing Type Information

Describes the _Type interface and provides code examples that illustrate how to use Type with
several reflection classes to obtain information about constructors, methods, fields,
properties, and events.

How to: Examine and Instantiate Generic Types with Reflection

Explains how reflection handles the type parameters and type arguments of generic types and
generic methods.

Accessing Custom Attributes

Demonstrates using reflection to query attribute existence and values.

How to: Hook Up a Delegate Using Reflection

Explains how to create a delegate for a method and hook the delegate up to an event. Explains
how to create an event-handling method at run time using DynamicMethod.

Reflection Using ClrObject

359
.Net Runtime Library for Delphi

Explains how to use ClrObject interface to smoothly access the fields and properties, trigger
the events and invoke the methods of object the interface is wrapping.

4.1.1 Viewing Type Information


The _Type interface is central to reflection. The common language runtime creates the Type for
a loaded type when reflection requests it. You can use a Type object's methods, fields,
properties, and nested classes to find out everything about that type.

Use TClrAssembly.GetType or TClrAssembly.GetTypes to obtain Type objects from assemblies that have not been
loaded, passing in the name of the type or types you want. Use _Type.GetType interface methodto get the Type objects
from an assembly that is already loaded. Use Module.GetType and Module.GetTypes to obtain module Type objects.
The following example shows the syntax necessary to get the Assembly object and module for an assembly.
Delphi

var

a: _Assembly;

varObject: Variant;

begin

//Get instance of .net Object

varObject := CoClrObject.CreateInstance.Unwrap;

// Gets the mscorlib assembly in which the object is defined.

a := TypeOf(varObject).Module.Assembly;

end.

The following example demonstrates getting Type objects from a loaded assembly.
Delphi

var

a: TClrAssembly;

types2: _TypeArray;

I: Integer;

360
.Net Runtime Library for Delphi

begin

// Loads an assembly using its file name.

a := TClrAssembly.LoadFrom('MyExe.exe');

// Gets the type names from the assembly.

types2 := a.GetTypes;

for I := 0 to types2.Length - 1 do

Writeln(types2[I].FullName);

end.

Once you obtain a Type, there are many ways you can discover information about the members of that type. For
example, you can find out about all the type's members by calling the Type.GetMembers method, which obtains an
array of MemberInfo interfaceobjects describing each of the members of the current type.
You can also use methods on the Type class to retrieve information about one or more constructors, methods, events,
fields, or properties that you specify by name. For example, Type.GetConstructor encapsulates a specific constructor of
the current class.
If you have a Type, you can use the Type.Module property to obtain an object that encapsulates the module
containing that type. Use the Module.Assembly property to locate an object that encapsulates the assembly containing
the module. You can obtain the assembly that encapsulates the type directly by using the Type.Assembly property.

System.Type and ConstructorInfo


The following example shows how to list the constructors for a class, in this case, the .net String class.
Delphi

// This program lists all the public constructors

// of the System.String class.

program ListMembers;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.Core,

361
.Net Runtime Library for Delphi

CNClrLib.Enums,

CNClrLib.Host;

var

Console: _Console;

procedure PrintMembers(ms: _ConstructorInfoArray);

var

I: Integer;

begin

for I := 0 to ms.Length - 1 do

begin

Console.WriteLine_17('{0}{1}', ' ', ms[I]);

end;

Console.WriteLine;

end;

var

t: _Type;

ci: _ConstructorInfoArray;

begin

Console := CoConsole.CreateInstance;

t := TClrAssembly.GetType('System.String');

Console.WriteLine_15('Listing all the public constructors of the {0}


type', t);

// Constructors.

ci := t.GetConstructors_1(BindingFlags_Public or
BindingFlags_Instance);

Console.WriteLine_14('//Constructors');

PrintMembers(ci);

end.

362
.Net Runtime Library for Delphi

MemberInfo, MethodInfo, FieldInfo, and PropertyInfo


Obtain information about the type's methods, properties, events, and fields using MemberInfo, MethodInfo, FieldInfo,
or PropertyInfo objects.
The following example uses MemberInfo to list the number of members in the System.IO.File class and uses the
System.Type.IsPublic property to determine the visibility of the class.
Delphi

program Mymemberinfo;

{$APPTYPE CONSOLE}

{$R *.res}

363
.Net Runtime Library for Delphi

uses

CNClrLib.Core,

CNClrLib.Host;

var

Console: _Console;

TypeHelper: _TypeHelper;

MyType: _Type;

Mymemberinfoarray: _MemberInfoArray;

begin

Console := CoConsole.CreateInstance;

Console.WriteLine;

Console.WriteLine_14('Reflection.MemberInfo');

// To use the static methods and properties of the type class,


create an instance of the

// Type Helper Interface.

TypeHelper := CoTypeHelper.CreateInstance;

// Gets the Type and MemberInfo.

MyType := TypeHelper.GetType_2('System.IO.File');

Mymemberinfoarray := MyType.GetMembers;

// Gets and displays the DeclaringType method.

Console.WriteLine;

Console.WriteLine_17('There are {0} members in {1}.',

Mymemberinfoarray.Length, MyType.FullName);

Console.WriteLine_15('{0}.', MyType.FullName);

if MyType.IsPublic then

Console.WriteLine_15('{0} is public.', MyType.FullName);

end.

364
.Net Runtime Library for Delphi

The following example investigates the type of the specified member. It performs reflection on a member of the
MemberInfo class, and lists its type.
Delphi

program MyMethodInfo;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.Enums,

CNClrLib.Core,

CNClrLib.Host,

Winapi.ActiveX;

var

Console: _Console;

365
.Net Runtime Library for Delphi

TypeHelper: _TypeHelper;

MyType: _Type;

Mymethodinfo: _MethodInfo;

Mymembertypes: TOleEnum;

begin

Console := CoConsole.CreateInstance;

Console.WriteLine_14('Reflection.MethodInfo');

TypeHelper := CoTypeHelper.CreateInstance;

// Gets and displays the Type.

MyType := TypeHelper.GetType_2('System.Reflection.FieldInfo');

// Specifies the member for which you want type information.

Mymethodinfo := MyType.GetMethod_5('GetValue');

Console.WriteLine_14(MyType.FullName + '.' + Mymethodinfo.Name);

// Gets and displays the MemberType property.

Mymembertypes := Mymethodinfo.MemberType;

if MemberTypes_Constructor = Mymembertypes then

begin

Console.WriteLine_14('MemberType is of type All');

end

else if MemberTypes_Custom = Mymembertypes then

begin

Console.WriteLine_14('MemberType is of type Custom');

end

else if MemberTypes_Event = Mymembertypes then

begin

Console.WriteLine_14('MemberType is of type Event');

end

else if MemberTypes_Field = Mymembertypes then

begin

Console.WriteLine_14('MemberType is of type Field');

end

else if MemberTypes_Method = Mymembertypes then

366
.Net Runtime Library for Delphi

begin

Console.WriteLine_14('MemberType is of type Method');

end

else if MemberTypes_Property = Mymembertypes then

begin

Console.WriteLine_14('MemberType is of type Property');

end

else if MemberTypes_TypeInfo = Mymembertypes then

begin

Console.WriteLine_14('MemberType is of type TypeInfo');

end;

Console.ReadKey;

end.

367
.Net Runtime Library for Delphi

The following example uses all the Reflection *Info interface along with BindingFlags to list all the members
(constructors, fields, properties, events, and methods) of the specified class, dividing the members into static and
instance categories.
Delphi

program ListMembers;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.Enums,

CNClrLib.Core,

CNClrLib.Host;

var

368
.Net Runtime Library for Delphi

Console: _Console;

procedure PrintMembers(ms: _IEnumerator);

begin

while ms.MoveNext do

Console.WriteLine_17('{0}{1}', ' ', ms.Current);

Console.WriteLine;

end;

var

t: _Type;

fi: _FieldInfoArray;

pi: _PropertyInfoArray;

ei: _EventInfoArray;

mi: _MethodInfoArray;

ci: _ConstructorInfoArray;

begin

Console := CoConsole.CreateInstance;

// Specifies the class.

t := TClrAssembly.GetType('System.IO.BufferedStream');

Console.WriteLine_15('Listing all the members (public and non


public) of the {0} type', t);

// Lists static fields first.

fi := t.GetFields_1(BindingFlags_Static or BindingFlags_NonPublic
or BindingFlags_Public);

Console.WriteLine_14('// Static Fields');

PrintMembers(fi.AsIEnumerator);

// Static properties.

pi := t.GetProperties_1(BindingFlags_Static or
BindingFlags_NonPublic or BindingFlags_Public);

Console.WriteLine_14('// Static Properties');

369
.Net Runtime Library for Delphi

PrintMembers(pi.AsIEnumerator);

// Static events.

ei := t.GetEvents_1(BindingFlags_Static or BindingFlags_NonPublic
or BindingFlags_Public);

Console.WriteLine_14('// Static Events');

PrintMembers(ei.AsIEnumerator);

// Static methods.

mi := t.GetMethods_1(BindingFlags_Static or BindingFlags_NonPublic
or BindingFlags_Public);

Console.WriteLine_14('// Static Methods');

PrintMembers(mi.AsIEnumerator);

// Constructors.

ci := t.GetConstructors_1(BindingFlags_Instance or
BindingFlags_NonPublic or BindingFlags_Public);

Console.WriteLine_14('// Constructors');

PrintMembers(ci.AsIEnumerator);

// Instance fields.

fi := t.GetFields_1(BindingFlags_Instance or BindingFlags_NonPublic
or BindingFlags_Public);

Console.WriteLine_14('// Instance Fields');

PrintMembers(fi.AsIEnumerator);

// Instance properites.

pi := t.GetProperties_1(BindingFlags_Instance or
BindingFlags_NonPublic or BindingFlags_Public);

Console.WriteLine_14('// Instance Properties');

PrintMembers(pi.AsIEnumerator);

// Instance events.

ei := t.GetEvents_1(BindingFlags_Instance or BindingFlags_NonPublic
or BindingFlags_Public);

Console.WriteLine_14('// Instance Events');

370
.Net Runtime Library for Delphi

PrintMembers(ei.AsIEnumerator);

// Instance methods.

mi := t.GetMethods_1(BindingFlags_Instance or BindingFlags_NonPublic
or BindingFlags_Public);

Console.WriteLine_14('// Instance Methods');

PrintMembers(mi.AsIEnumerator);

Console.WriteLine;

Console.WriteLine_14('Press ENTER to exit.');

Console.Read();

end.

4.1.2 How to: Examine and Instantiate


Generic Types with Reflection
Information about generic types is obtained in the same way as information about other types: by examining a Type
object that represents the generic type. The principle difference is that a generic type has a list of Type objects
representing its generic type parameters. The first procedure in this section examines generic types.
You can create a Type object that represents a constructed type by binding type arguments to the type parameters of a
generic type definition. The second procedure demonstrates this.
To examine a generic type and its type parameters
1. Get an instance of Type that represents the generic type. In the following code, the type is obtained using
theGetType . Note that in the rest of this procedure, the type is contained in a method parameter named t.

Delphi

var

Console: _Console;

t: _Type;

typeParameters: _TypeArray;

classConstraints: _TypeArray;

sConstraints: GenericParameterAttributes;

begin

Console := CoConsole.CreateInstance;

371
.Net Runtime Library for Delphi

//System.Collections.Generic.Dictionary<TKey, TValue>

t :=
TClrAssembly.GetType('System.Collections.Generic.Dictionary`2');

end.

2. Use the IsGenericType property to determine whether the type is generic, and use the
IsGenericTypeDefinition property to determine whether the type is a generic type definition.

Delphi

Console.WriteLine_15(' Is this a generic type? {0}',


t.IsGenericType);

Console.WriteLine_15(' Is this a generic type definition?


{0}', t.IsGenericTypeDefinition);

3. Get an array that contains the generic type arguments, using the GetGenericArguments method.

Delphi

typeParameters := t.GetGenericArguments;

4. For each type argument, determine whether it is a type parameter (for example, in a generic type definition)
or a type that has been specified for a type parameter (for example, in a constructed type), using the
IsGenericParameter property.

Delphi

Console.WriteLine_15(' List {0} type arguments:',


typeParameters.Length);

for I := 0 to typeParameters.Length - 1 do

begin

372
.Net Runtime Library for Delphi

if typeParameters[I].IsGenericParameter then

DisplayGenericParameter(typeParameters[I])

else

Console.WriteLine_15(' Type argument: {0}',


typeParameters[I]);

end;

5. In the type system, a generic type parameter is represented by an instance of Type, just as ordinary types are.
The following code displays the name and parameter position of a Type object that represents a generic type
parameter. The parameter position is trivial information here; it is of more interest when you are examining a
type parameter that has been used as a type argument of another generic type.

Delphi

procedure DisplayGenericParameter(tp: _Type);

begin

Console.WriteLine_17(' Type parameter: {0} position


{1}',

tp.Name, tp.GenericParameterPosition);

end;

373
.Net Runtime Library for Delphi

6. Determine the base type constraint and the interface constraints of a generic type parameter by using the
GetGenericParameterConstraints method to obtain all the constraints in a single array. Constraints are not
guaranteed to be in any particular order.

Delphi

classConstraints := t.GetGenericParameterConstraints;

for I := 0 to classConstraints.Length - 1 do

begin

if classConstraints[I].IsInterface then

Console.WriteLine_15(' Interface constraint: {0}',


classConstraints[I])

else

end;

Console.WriteLine_15(' Base type constraint: {0}',


t.BaseType);

7. Use the GenericParameterAttributes property to discover the special constraints on a type parameter, such as
requiring that it be a reference type. The property also includes values that represent variance, which you can
mask off as shown in the following code.

Delphi

sConstraints := t.GenericParameterAttributes and

374
.Net Runtime Library for Delphi

GenericParameterAttributes_SpecialConstraintMask;

8. The special constraint attributes are flags, and the same flag (GenericParameterAttributes_None) that
represents no special constraints also represents no covariance or contravariance. Thus, to test for either of
these conditions you must use the appropriate mask. In this case, use
GenericParameterAttributes_SpecialConstraintMask to isolate the special constraint flags.

Delphi

if sConstraints = GenericParameterAttributes_None then

Console.WriteLine_14(' No special constraints.')

else

begin

if GenericParameterAttributes_None <> (sConstraints and


GenericParameterAttributes_DefaultConstructorConstraint) then

begin

Console.WriteLine_14(' Must have a parameterless


constructor.');

end;

if GenericParameterAttributes_None <> (sConstraints and


GenericParameterAttributes_ReferenceTypeConstraint) then

begin

Console.WriteLine_14(' Must be a reference


type.');

end;

if GenericParameterAttributes_None <> (sConstraints and


GenericParameterAttributes_NotNullableValueTypeConstraint) then

begin

Console.WriteLine_14(' Must be a non-nullable


value type.');

end;

end;

375
.Net Runtime Library for Delphi

Constructing an Instance of a Generic Type


A generic type is like a template. You cannot create instances of it unless you specify real types for its generic type
parameters. To do this at run time, using reflection, requires the MakeGenericType method.
To construct an instance of a generic type
1. Get a Type object that represents the generic type. The following code gets the generic type Dictionary in
two different ways: by using the Type.GetType(String) method overload with a string describing the type, and
by calling the GetGenericTypeDefinition method on the constructed type Dictionary<String, Example> .
The MakeGenericType method requires a generic type definition.

Delphi

var

d1: _Type;

d2: _GenericDictionary;

d3: _Type;

d4: _Type;

begin

// Use the typeof operator to create the generic type

// definition directly. To specify the generic type


definition,

// omit the type arguments but retain the comma that separates

// them.

d1 :=
TClrAssembly.GetType('System.Collections.Generic.Dictionary`2');

376
.Net Runtime Library for Delphi

// You can also obtain the generic type definition from a

// constructed class. In this case, the constructed class

// is a dictionary of Example objects, with String keys.

d2 :=
CoGenericDictionary.CreateInstance(TClrAssembly.GetType('System.
String'),

TClrAssembly.GetType('OtherNamespace.Example'));

// Get a Type object that represents the constructed type,

// and from that get the generic type definition. The

// variables d1 and d4 contain the same type.

d3 := d2.GetType;

d4 := d3.GetGenericTypeDefinition;

end.

2. Construct an array of type arguments to substitute for the type parameters. The array must contain the
correct number of Type objects, in the same order as they appear in the type parameter list. In this case, the
key (first type parameter) is of type String, and the values in the dictionary are instances of a class named
Example.

377
.Net Runtime Library for Delphi

Delphi

var

typeArgs: _TypeArray;

begin

typeArgs :=
TClrArrayHelper.ToTypeArray([TClrAssembly.GetType('System.String
'),

TClrAssembly.GetType('OtherNamespace.Example')]);

end.

3. Call the MakeGenericType method to bind the type arguments to the type parameters and construct the type.

Delphi

var

...

constructed: _Type;

begin

...

constructed := d1.MakeGenericType(typeArgs);

end.

4. Use the CreateInstance(Type) method overload to create an object of the constructed type. The following
code stores two instances of the Example class in the resulting Dictionary<String, Example> object.

Delphi

378
.Net Runtime Library for Delphi

var

...

o: OleVariant;

begin

...

o := TClrActivator.CreateInstance(constructed);

end.

Example
The following code example defines a DisplayGenericType method to examine the generic type definitions and
constructed types used in the code and display their information. The DisplayGenericType method shows how to use
the IsGenericType, IsGenericParameter, and GenericParameterPosition properties and the GetGenericArguments
method.
The example also defines a DisplayGenericParameter method to examine a generic type parameter and display its
constraints.
The code example defines a set of test types, including a generic type that illustrates type parameter constraints, and
shows how to display information about these types.
The example constructs a type from the Dictionary<TKey, TValue> class by creating an array of type arguments and
calling the MakeGenericType method. The program compares the Type object constructed using MakeGenericType with
a Type object obtained using GetType , demonstrating that they are the same. Similarly, the program uses the
GetGenericTypeDefinition method to obtain the generic type definition of the constructed type, and compares it to the
Type object representing the Dictionary<TKey, TValue> class.
Delphi

program GenericExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.Enums,

CNClrLib.Core,

CNClrLib.Collections,

CNClrLib.Host;

379
.Net Runtime Library for Delphi

var

Console: _Console;

// The following method displays information about a generic

// type parameter. Generic type parameters are represented by

// instances of System.Type, just like ordinary types.

procedure DisplayGenericParameter(tp: _Type);

var

classConstraint: _Type;

iConstraints: _TypeArray;

sConstraints: GenericParameterAttributes;

I: Integer;

begin

Console.WriteLine_17(' Type parameter: {0} position {1}',

tp.Name, tp.GenericParameterPosition);

iConstraints := tp.GetGenericParameterConstraints;

for I := 0 to iConstraints.Length - 1 do

begin

if iConstraints[I].IsInterface then

Console.WriteLine_15(' Interface constraint: {0}',

iConstraints[I]);

end;

sConstraints := tp.GenericParameterAttributes and

GenericParameterAttributes_SpecialConstraintMask;

if sConstraints = GenericParameterAttributes_None then

begin

Console.WriteLine_14(' No special constraints.');

end

else

380
.Net Runtime Library for Delphi

begin

if (GenericParameterAttributes_None <> (sConstraints and

GenericParameterAttributes_DefaultConstructorConstraint))
then

begin

Console.WriteLine_14(' Must have a parameterless


constructor.');

end

else if (GenericParameterAttributes_None <> (sConstraints and

GenericParameterAttributes_ReferenceTypeConstraint)) then

begin

Console.WriteLine_14(' Must be a reference type.');

end

else if (GenericParameterAttributes_None <> (sConstraints and

GenericParameterAttributes_NotNullableValueTypeConstraint))
then

begin

Console.WriteLine_14(' Must be a non-nullable value


type.');

end;

end;

end;

// The following method displays information about a generic

// type.

procedure DisplayGenericType(t: _Type);

var

typeParameters: _TypeArray;

I: Integer;

begin

Console.WriteLine;

Console.WriteLine_15(' {0}', t);

Console.WriteLine_15(' Is this a generic type? {0}',

t.IsGenericType);

381
.Net Runtime Library for Delphi

Console.WriteLine_15(' Is this a generic type definition? {0}',

t.IsGenericTypeDefinition);

// Get the generic type parameters or type arguments.

typeParameters := t.GetGenericArguments;

Console.WriteLine_15(' List {0} type arguments:',

typeParameters.Length);

for I := 0 to typeParameters.Length - 1 do

begin

if typeParameters[I].IsGenericParameter then

DisplayGenericParameter(typeParameters[I])

else

Console.WriteLine_15(' Type argument: {0}',

typeParameters[I]);

end;

end;

var

d1: _Type;

d2: _GenericDictionary;

d3: _Type;

d4: _Type;

constructed: _Type;

typeArgs: _TypeArray;

o: OleVariant;

begin

Console := CoConsole.CreateInstance;

// Two ways to get a Type object that represents the generic

// type definition of the Dictionary class.

//

382
.Net Runtime Library for Delphi

// Use the typeof operator to create the generic type

// definition directly. To specify the generic type definition,

// omit the type arguments but retain the comma that separates

// them.

//C#: System.Collections.Generic.Dictionary<TKey, TValue>

d1 :=
TClrAssembly.GetType('System.Collections.Generic.Dictionary`2');

// You can also obtain the generic type definition from a

// constructed class. In this case, the constructed class

// is a dictionary of Int32, with String keys.

// C#: Dictionary<string, Int32> d2 = new Dictionary<string,


Int32>();

d2 :=
CoGenericDictionary.CreateInstance(TClrAssembly.GetType('System.String
'),

TClrAssembly.GetType('System.Int32'));

// Get a Type object that represents the constructed type,

// and from that get the generic type definition. The

// variables d1 and d4 contain the same type.

d3 := d2.GetType;

d4 := d3.GetGenericTypeDefinition;

// Display information for the generic type definition, and

// for the constructed type Dictionary<String, Example>.

DisplayGenericType(d1);

DisplayGenericType(d2.GetType());

// Construct an array of type arguments to substitute for

// the type parameters of the generic Dictionary class.

// The array must contain the correct number of types, in

// the same order that they appear in the type parameter

// list of Dictionary. The key (first type parameter)

383
.Net Runtime Library for Delphi

// is of type string, and the type to be contained in the

// dictionary is Integer.

typeArgs :=
TClrArrayHelper.ToTypeArray([TClrAssembly.GetType('System.String'),

TClrAssembly.GetType('System.Int32')]);

// Construct the type Dictionary<String, Int32>.

constructed := d1.MakeGenericType(typeArgs);

DisplayGenericType(constructed);

o := TClrActivator.CreateInstance(constructed);

Console.WriteLine;

Console.WriteLine_14('Compare types obtained by different


methods:');

Console.WriteLine_15(' Are the constructed types equal? {0}',


(d2.GetType = constructed));

Console.WriteLine_15(' Are the generic definitions equal? {0}',

(d1 = constructed.GetGenericTypeDefinition()));

Console.ReadKey;

end.

384
.Net Runtime Library for Delphi

385
.Net Runtime Library for Delphi

386
.Net Runtime Library for Delphi

See Also
Reflection and Generic Types
Viewing Type Information
Generics in the .NET Framework

4.1.3 Accessing Custom Attributes


After attributes have been associated with program elements, reflection can be used to query their existence and values.
Custom attributes are examined in the execution context.

The Execution Context


The main reflection methods to query attributes in the execution context are _MemberInfo.GetCustomAttributes and
_Attribute.GetCustomAttributes.
The accessibility of a custom attribute is checked with respect to the assembly in which it is attached. This is equivalent
to checking whether a method on a type in the assembly in which the custom attribute is attached can call the
constructor of the custom attribute.
Methods such as _Assembly.GetCustomAttributes(Boolean) check the visibility and accessibility of the type
argument. Only code in the assembly that contains the user-defined type can retrieve a custom attribute of that type
using GetCustomAttributes.
The custom attribute reflection model could leak instances of user-defined types outside the assembly in which the type
is defined. This is no different from the members in the runtime system library that return instances of user-defined
types, such as _Type.GetMethods returning an array of RuntimeMethodInfo objects. To prevent a client from
discovering information about a user-defined custom attribute type, define the type's members to be nonpublic.
The following example demonstrates the basic way of using reflection to get access to custom attributes.
Delphi

program CustomAttributeExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.Core,

CNClrLib.Host;

387
.Net Runtime Library for Delphi

var

Console: _Console;

info: _Type;

custAttr: _ObjectArray;

I: Integer;

begin

Console := CoConsole.CreateInstance;

//Assuming ClassWithAttributes class in c# has custom attributes

info :=
TClrAssembly.GetType('AttributeNamespace.ClassWithAttributes');

custAttr := info.GetCustomAttributes(True);

for I := 0 to custAttr.Length - 1 do

begin

Console.WriteLine_12(custAttr[I]);

end;

Console.ReadKey;

end.

388
.Net Runtime Library for Delphi

See Also
MemberInfo.GetCustomAttributes
Attribute.GetCustomAttributes
Viewing Type Information
Security Considerations for Reflection

4.1.4 How to: Hook Up a Delegate Using


Reflection
The following procedures show how to hook up an existing method to an event by getting all the necessary types
through reflection, and how to create a dynamic method using reflection emit and hook it up to an event.
To hook up a delegate using reflection
1. Load an assembly that contains a type that raises events. Assemblies are usually loaded with the
TClrAssembly.Load method or _Assembly.Load method. To keep this example simple, a derived form in the
current assembly is used, so the GetExecutingAssembly method is used to load the current assembly.

Delphi

var

assem: _Assembly;

assemHelper: _AssemblyHelper;

assemClass: TClrAssembly;

longName: string;

begin

//Get the type and access the assembly property of the loaded
type

assem :=
TClrAssembly.GetType('exampleNamespace.Example').Assembly;

//Or use Assembly Helper to load the Assembly

longName := 'exampleNamespace.Example, Version=1.0.0.0,


Culture=neutral, PublicKeyToken=b77a5c561934e089';

389
.Net Runtime Library for Delphi

assemHelper := CoAssemblyHelper.CreateInstance;

assem := assemHelper.Load(longName);

//Or use TClrAssembly Class to load the Assembly

assemClass := TClrAssembly.Load(longName);

end.

2. Get a Type object representing the type, and create an instance of the type. The CreateInstance(Type) method
is used in the following code because the form has a default constructor. There are several other overloads of
the CreateInstance method that you can use if the type you are creating does not have a default constructor.
The new instance is stored as type Object ( Unknown Variant in delphi) to maintain the fiction that nothing
is known about the assembly. (Reflection allows you to get the types in an assembly without knowing their
names in advance.)

Delphi

var

...

tExForm: _Type;

exFormAsObj: OleVariant;

exFormAsClrObj: _ClrObject;

begin

...

390
.Net Runtime Library for Delphi

tExForm := assem.GetType('ExampleForm');

exFormAsObj := TClrActivator.CreateInstance(tExForm);

//If the TClrActivator.CreateInstance generates an invocation


error the use the

//ClrCreateInstance method to return the object in a wrapper


called _ClrObject interface.

//Example:

exFormAsClrObj := TClrActivator.ClrCreateInstance(tExForm);

end.

3. Get an _EventInfo interface representing the event, and use the EventHandlerType property to get the type
of delegate used to handle the event. In the following code, an EventInfo for the Click event is obtained.

Delphi

var

...

evClick: _EventInfo;

tDelegate: _Type;

begin

...

evClick := tExForm.GetEvent('Click');

tDelegate := evClick.EventHandlerType;

end.

391
.Net Runtime Library for Delphi

4. Get a _MethodInfo interface representing the method that handles the event. The complete program code in
the Example section later in this topic contains a method that matches the signature of the EventHandler
delegate, which handles the Click event, but you can also generate dynamic methods at run time. For details,
see the accompanying procedure, for generating an event handler at run time by using a dynamic method.

Delphi

var

...

exType: _Type;

miHandler: _MethodInfo;

begin

...

exType := TClrAssembly.GetType('exampleNamespace.Example');

miHandler := exType.GetMethod_4('LuckyHandler',
BindingFlags_NonPublic or BindingFlags_Instance);

end.

5. Create an instance of the delegate, using the CreateDelegate method. This method is static and is defined in
the Helper inferface called _DelegateHelper , so the delegate type must be supplied. Using the overloads of
CreateDelegate that take a _MethodInfo interface is recommended.

Delphi

var

...

delegateHelper: _DelegateHelper;

392
.Net Runtime Library for Delphi

d: _Delegate;

begin

...

delegateHelper := CoDelegateHelper.CreateInstance;

d := delegateHelper.CreateDelegate_2(tDelegate, exFormAsObj,
miHandler);

end.

6. Get the add accessor method and invoke it to hook up the event. All events have an add accessor and a
remove accessor, which are hidden by the syntax of high-level languages. The following code gets the add
accessor of the Click event and invokes it late-bound, passing in the delegate instance. The arguments must
be passed as an array.

Delphi

var

...

addHandler: _MethodInfo;

addHandlerArgs: _ObjectArray;

begin

...

addHandler := evClick.GetAddMethod_1;

addHandlerArgs := TClrArrayHelper.ToObjectArray([d]);

addHandler.Invoke_2(exFormAsObj, addHandlerArgs);

end.

393
.Net Runtime Library for Delphi

To generate an event handler at run time by using a dynamic method


1. Event-handler methods can be generated at run time, using lightweight dynamic methods and reflection
emit. To construct an event handler, you need the return type and parameter types of the delegate. These can
be obtained by examining the delegate's Invoke method. The following code uses the
GetDelegateReturnType and GetDelegateParameterTypes methods to obtain this information. The code
for these methods can be found in the Example section later in this topic.
It is not necessary to name a DynamicMethod, so the empty string can be used. In the following code, the last
argument associates the dynamic method with the current type, giving the delegate access to all the public
and private members of the Example class.

Delphi

var

...

returnType: _Type;

voidType: _Type;

handler: _DynamicMethod;

begin

...

returnType := GetDelegateReturnType(tDelegate);

voidType := TClrAssembly.GetType('System.Void');

if not returnType.Equals_2(voidType) then

RaiseClrException('Delegate has a return type');

handler := CoDynamicMethod.CreateInstance('',

nil,

GetDelegateParameterTypes(tDelegate),

TClrAssembly.GetType('exampleNamespace.Example'));

end.

394
.Net Runtime Library for Delphi

2. Generate a method body. This method loads a string, calls the overload of the MessageBox.Show method
that takes a string, pops the return value off the stack (because the handler has no return type), and returns.
To learn more about emitting dynamic methods, see How to: Define and Execute Dynamic Methods.

Delphi

var

...

handler: _DynamicMethod;

ilgen: _ILGenerator;

showParameters: _TypeArray;

msgBoxType: _Type;

simpleShow: _MethodInfo;

opCode: _OpCodesHelper;

begin

...

ilgen := handler.GetILGenerator;

showParameters :=
TClrArrayHelper.ToTypeArray([TClrAssembly.GetType('System.String
')]);

msgBoxType :=
TClrAssembly.GetType('System.Windows.Forms.Form.MessageBox');

simpleShow := msgBoxType.GetMethod_3('Show', showParameters);

395
.Net Runtime Library for Delphi

ilgen.Emit_15(opCode.Ldstr, 'This event handler was


constructed at run time.');

ilgen.Emit_5(opCode.Call, simpleShow);

ilgen.Emit(opCode.Pop);

ilgen.Emit(opCode.Ret);

end.

3. Complete the dynamic method by calling its CreateDelegate method. Use the add accessor to add the
delegate to the invocation list for the event.

Delphi

var

...

dEmitted: _Delegate;

begin

...

dEmitted := handler.CreateDelegate(tDelegate);

addHandler.Invoke_2(exFormAsObj,
TClrArrayHelper.ToObjectArray([ dEmitted ]));

end.

396
.Net Runtime Library for Delphi

Example
The following code example shows how to hook up an existing method to an event using reflection, and also how to
use the DynamicMethod class to emit a method at run time and hook it up to an event.
C#

using System;

namespace exampleNamespace

class ExampleForm : Form

public ExampleForm()

this.Text = "Click me";

public void LuckyHandler(Object sender, EventArgs e)

MessageBox.Show("This event handler just happened to be


lying around.");

397
.Net Runtime Library for Delphi

Assuming the above c# is compiled into a library which is made accessible in delphi using the runtime library. The
following code example in delphi shows how to hook up the luckyhandler method to the click event using reflection.

Delphi

program HookUpEvent;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.Enums,

CNClrLib.Core,

CNClrLib.Host;

function GetDelegateParameterTypes(d: _Type): _TypeArray;

var

invoke: _MethodInfo;

parameters: _ParameterInfoArray;

I: Integer;

begin

if not
d.BaseType.Equals(TClrAssembly.GetType('System.MulticastDelegate'))
then

RaiseClrException('Not a delegate.');

invoke := d.GetMethod_5('Invoke');

398
.Net Runtime Library for Delphi

if invoke = nil then

RaiseClrException('Not a delegate.');

parameters := invoke.GetParameters;

Result := CoTypeArray.CreateInstance(parameters.Length);

for I := 0 to parameters.Length - 1 do

Result[I] := parameters[I].ParameterType;

end;

function GetDelegateReturnType(d: _Type): _Type;

var

invoke: _MethodInfo;

begin

if not
d.BaseType.Equals(TClrAssembly.GetType('System.MulticastDelegate'))
then

RaiseClrException('Not a delegate.');

invoke := d.GetMethod_5('Invoke');

if invoke = nil then

RaiseClrException('Not a delegate.');

Result := invoke.ReturnType;

end;

var

assem: _Assembly;

tExForm: _Type;

exFormAsObj: OleVariant;

exFormAsClrObj: _ClrObject;

evClick: _EventInfo;

tDelegate: _Type;

exType: _Type;

miHandler: _MethodInfo;

399
.Net Runtime Library for Delphi

delegateHelper: _DelegateHelper;

d: _Delegate;

addHandler: _MethodInfo;

addHandlerArgs: _ObjectArray;

returnType: _Type;

voidType: _Type;

handler: _DynamicMethod;

ilgen: _ILGenerator;

showParameters: _TypeArray;

msgBoxType: _Type;

simpleShow: _MethodInfo;

opCode: _OpCodesHelper;

dEmitted: _Delegate;

begin

// Load an assembly, for example using the Assembly.Load

// method. In this case, the executing assembly is loaded, to

// keep the demonstration simple.

//

assem := TClrAssembly.GetType('exampleNamespace.Example').Assembly;

// Get the type that is to be loaded, and create an instance

// of it. Activator.CreateInstance has other overloads, if

// the type lacks a default constructor. The new instance

// is stored as type Object, to maintain the fiction that

// nothing is known about the assembly. (Note that you can

// get the types in an assembly without knowing their names

// in advance.)

//

tExForm := assem.GetType('ExampleForm');

exFormAsObj := TClrActivator.CreateInstance(tExForm);

// If the TClrActivator.CreateInstance generates an invocation error


the use the

400
.Net Runtime Library for Delphi

// ClrCreateInstance method to return the object in a wrapper called


_ClrObject interface.

//

//Example:

exFormAsClrObj := TClrActivator.ClrCreateInstance(tExForm);

// Get an EventInfo representing the Click event, and get the

// type of delegate that handles the event.

//

evClick := tExForm.GetEvent('Click');

tDelegate := evClick.EventHandlerType;

// If you already have a method with the correct signature,

// you can simply get a MethodInfo for it.

//

exType := TClrAssembly.GetType('exampleNamespace.Example');

miHandler := exType.GetMethod_4('LuckyHandler',
BindingFlags_NonPublic or BindingFlags_Instance);

// Create an instance of the delegate. Using the overloads

// of CreateDelegate that take MethodInfo is recommended.

//

delegateHelper := CoDelegateHelper.CreateInstance;

d := delegateHelper.CreateDelegate_2(tDelegate, exFormAsObj,
miHandler);

// Get the "add" accessor of the event and invoke it late-

// bound, passing in the delegate instance.

// The instance on which the "add" accessor is invoked

// is the form; the arguments must be passed as an array.

//

addHandler := evClick.GetAddMethod_1;

addHandlerArgs := TClrArrayHelper.ToObjectArray([d]);

addHandler.Invoke_2(exFormAsObj, addHandlerArgs);

401
.Net Runtime Library for Delphi

// Event handler methods can also be generated at run time,

// using lightweight dynamic methods and Reflection.Emit.

// To construct an event handler, you need the return type

// and parameter types of the delegate. These can be obtained

// by examining the delegate's Invoke method.

//

// It is not necessary to name dynamic methods, so the empty

// string can be used. The last argument associates the

// dynamic method with the current type, giving the delegate

// access to all the public and private members of Example,

// as if it were an instance method.

//

returnType := GetDelegateReturnType(tDelegate);

voidType := TClrAssembly.GetType('System.Void');

if not returnType.Equals_2(voidType) then

RaiseClrException('Delegate has a return type');

handler := CoDynamicMethod.CreateInstance('',

nil,

GetDelegateParameterTypes(tDelegate),

TClrAssembly.GetType('exampleNamespace.Example'));

// Generate a method body. This method loads a string, calls

// the Show method overload that takes a string, pops the

// return value off the stack (because the handler has no

// return type), and returns.

//

ilgen := handler.GetILGenerator;

showParameters :=
TClrArrayHelper.ToTypeArray([TClrAssembly.GetType('System.String')]);

msgBoxType :=
TClrAssembly.GetType('System.Windows.Forms.Form.MessageBox');

402
.Net Runtime Library for Delphi

simpleShow := msgBoxType.GetMethod_3('Show', showParameters);

ilgen.Emit_15(opCode.Ldstr, 'This event handler was constructed at


run time.');

ilgen.Emit_5(opCode.Call, simpleShow);

ilgen.Emit(opCode.Pop);

ilgen.Emit(opCode.Ret);

// Complete the dynamic method by calling its CreateDelegate

// method. Use the "add" accessor to add the delegate to

// the invocation list for the event.

//

dEmitted := handler.CreateDelegate(tDelegate);

addHandler.Invoke_2(exFormAsObj, TClrArrayHelper.ToObjectArray([
dEmitted ]));

end.

403
.Net Runtime Library for Delphi

404
.Net Runtime Library for Delphi

405
.Net Runtime Library for Delphi

See Also
How to: Define and Execute Dynamic Methods
Reflection

4.1.5 Reflection Using ClrObject


ClrObject is an interface that is capable of containing almost any .net object as well as data
type value, along with type information for that value. It provides the ability to store the
value, and type information of an instance of any type. It is designed to ease the access to
fields, properties, methods and events of the stored value. For more information, see How to:
Use ClrObject Interface .

4.2 Emitting Dynamic Methods and


Assemblies
This section describes a set of managed types in the CNClrLib.Core.Intf namespace (In C#, these types will be defined in
System.Reflection.Emit namespace) that allow a compiler or tool to emit metadata and Microsoft intermediate language
(MSIL) at run time and optionally generate a portable executable (PE) file on disk. Script engines and compilers are the
primary users of this namespace. In this section, the functionality provided by the namespace is referred to as reflection
emit.
Reflection emit provides the following capabilities:
 Define lightweight global methods at run time, using the DynamicMethod class, and execute them using
delegates.
 Define assemblies at run time and then run them and/or save them to disk.
 Define assemblies at run time, run them, and then unload them and allow garbage collection to reclaim their
resources.
 Define modules in new assemblies at run time and then run and/or save them to disk.
 Define types in modules at run time, create instances of these types, and invoke their methods.
 Define symbolic information for defined modules that can be used by tools such as debuggers and code
profilers.
Reference
OpCodes

Catalogs the MSIL instruction codes you can use to build method bodies.
Security Issues in Reflection Emit

Describes security issues related to creating dynamic assemblies using reflection emit.
System.Reflection.Emit

Contains managed classes used to emit dynamic methods, assemblies, and types.
Related Sections
Reflection Overview

Explains how to explore metadata and managed code.

406
.Net Runtime Library for Delphi

4.2.1 How to: Define a Generic Type with


Reflection Emit
This topic shows how to create a simple generic type with two type parameters, how to apply class constraints, interface
constraints, and special constraints to the type parameters, and how to create members that use the type parameters of
the class as parameter types and return types.
To define a generic type
1. Define a dynamic assembly named GenericEmitExample1. In this example, the assembly is executed and
saved to disk, so AssemblyBuilderAccess.RunAndSave is specified.

Delphi

var

myDomain: TClrAppDomain;

myAsmName: _AssemblyName;

myAssembly: _AssemblyBuilder;

begin

myDomain := TClrAppDomain.GetCurrentDomain;

try

myAsmName :=
CoAssemblyName.CreateInstance('GenericEmitExample1');

myAssembly := myDomain.DefineDynamicAssembly(myAsmName,
abaRunAndSave);

finally

myDomain.Free;

end;

end.

407
.Net Runtime Library for Delphi

2. Define a dynamic module. An assembly is made up of executable modules. For a single-module assembly, the
module name is the same as the assembly name, and the file name is the module name plus an extension.

Delphi

var

...

myModule: _ModuleBuilder;

begin

...

myModule := myAssembly.DefineDynamicModule_2(myAsmName.Name,
myAsmName.Name + '.dll');

end.

3. Define a class. In this example, the class is named Sample.

Delphi

var

...

myType: _TypeBuilder;

begin

...

myType := myModule.DefineType_1('Sample',
TypeAttributes_Public);

end.

408
.Net Runtime Library for Delphi

4. Define the generic type parameters of Sample by passing an array of strings containing the names of the
parameters to the TypeBuilder.DefineGenericParameters method. This makes the class a generic type. The
return value is an array of GenericTypeParameterBuilder objects representing the type parameters, which can
be used in your emitted code.
In the following code, Sample becomes a generic type with type parameters TFirst and TSecond. To make
the code easier to read, each GenericTypeParameterBuilder is placed in a variable with the same name as
the type parameter.

Delphi

var

...

typeParamNames: _StringArray;

typeParams: _GenericTypeParameterBuilderArray;

TFirst: _GenericTypeParameterBuilder;

TSecond: _GenericTypeParameterBuilder;

begin

...

typeParamNames := TClrArrayHelper.ToStringArray(['TFirst',
'TSecond']);

typeParams := myType.DefineGenericParameters(typeParamNames);

TFirst := typeParams[0];

TSecond := typeParams[1];

end.

409
.Net Runtime Library for Delphi

5. Add special constraints to the type parameters. In this example, type parameter TFirst is constrained to
types that have parameterless constructors, and to reference types.

Delphi

TFirst.SetGenericParameterAttributes(

GenericParameterAttributes_DefaultConstructorConstraint
or

GenericParameterAttributes_ReferenceTypeConstraint);

6. Optionally add class and interface constraints to the type parameters. In this example, type parameter TFirst
is constrained to types that derive from the base class represented by the Type object contained in the
variable baseType, and that implement the interfaces whose types are contained in the variables interfaceA
and interfaceB. See the code example for the declaration and assignment of these variables.

Delphi

var

...

baseType: _Type;

interfaceTypes: _TypeArray;

interfaceA: _Type;

interfaceB: _Type;

begin

...

TSecond.SetBaseTypeConstraint(baseType);

interfaceTypes := TClrArrayHelper.ToTypeArray([interfaceA,
interfaceB]);

TSecond.SetInterfaceConstraints(interfaceTypes);

end.

410
.Net Runtime Library for Delphi

7. Define a field. In this example, the type of the field is specified by type parameter TFirst.
GenericTypeParameterBuilder derives from Type, so you can use generic type parameters anywhere a type
can be used.

Delphi

exField := myType.DefineField('ExampleField', TFirst.AsType,


FieldAttributes_Private);

8. Define a method that uses the type parameters of the generic type. Note that such methods are not generic
unless they have their own type parameter lists. The following code defines a static method that takes an
array of TFirst and returns a List<TFirst>(List(Of TFirst) in Visual Basic) containing all the elements
of the array. To define this method, it is necessary to create the type List<TFirst> by calling
MakeGenericType on the generic type definition, List<T>. (The T is omitted when you use the typeof
operator (GetType in Visual Basic) to get the generic type definition.) The parameter type is created by using
the MakeArrayType method.

Delphi

var

...

listOf: _Type;

listOfTFirst: _Type;

mParamTypes: _TypeArray;

exMethod: _MethodBuilder;

begin

...

listOf :=
TClrAssembly.GetType('System.Collections.Generic.List`1');

listOfTFirst :=
listOf.MakeGenericType(TClrArrayHelper.ToTypeArray([TFirst.AsTyp
e]));

mParamTypes :=
TClrArrayHelper.ToTypeArray([TFirst.MakeArrayType]);

exMethod := myType.DefineMethod('ExampleMethod',

411
.Net Runtime Library for Delphi

MethodAttributes_Public or
MethodAttributes_Static,

listOfTFirst,

mParamTypes);

end.

9. Emit the method body. The method body consists of three opcodes that load the input array onto the stack,
call the List<TFirst> constructor that takes IEnumerable<TFirst> (which does all the work of putting the
input elements into the list), and return (leaving the new List<T> object on the stack). The difficult part of
emitting this code is getting the constructor.
The GetConstructor method is not supported on a GenericTypeParameterBuilder, so it is not possible to get
the constructor of List<TFirst>directly. First, it is necessary to get the constructor of the generic type
definition List<T> and then to call a method that converts it to the corresponding constructor of
List<TFirst>.
The constructor used for this code example takes an IEnumerable<T>. Note, however, that this is not the
generic type definition of the IEnumerable<T> generic interface; instead, the type parameter T from List<T>
must be substituted for the type parameter T of IEnumerable<T>. (This seems confusing only because both
types have type parameters named T. That is why this code example uses the names TFirst and TSecond.)
To get the type of the constructor argument, start with the generic type definition IEnumerable<T> and call
MakeGenericType with the first generic type parameter of List<T>. The constructor argument list must be
passed as an array, with just one argument in this case.
Now it is possible to get the constructor of List<T> by calling GetConstructor on the generic type
definition. To convert this constructor to the corresponding constructor of List<TFirst>, pass
List<TFirst> and the constructor from List<T> to the static TypeBuilder.GetConstructor(Type,
ConstructorInfo) method.

Delphi

var

...

ilgen: _ILGenerator;

ienumOf: _Type;

TfromListOf: _Type;

412
.Net Runtime Library for Delphi

ienumOfT: _Type;

ctorArgs: _TypeArray;

ctorPrep: _ConstructorInfo;

ctor: _ConstructorInfo;

OpCodes: _OpCodesHelper;

TypeBuilder: _TypeBuilderHelper;

begin

...

ilgen := exMethod.GetILGenerator;

ienumOf :=
TClrAssembly.GetType('System.Collections.Generic.IEnumerable`1')
;

TfromListOf := listOf.GetGenericArguments()[0];

ienumOfT :=
ienumOf.MakeGenericType(TClrArrayHelper.ToTypeArray([TfromListOf
]));

ctorArgs := TClrArrayHelper.ToTypeArray([ienumOfT]);

TypeBuilder := CoTypeBuilderHelper.CreateInstance;

ctorPrep := listOf.GetConstructor_2(ctorArgs);

ctor := TypeBuilder.GetConstructor(listOfTFirst, ctorPrep);

OpCodes := CoOpCodesHelper.CreateInstance;

ilgen.Emit(OpCodes.Ldarg_0);

ilgen.Emit_7(OpCodes.Newobj, ctor);

end.

413
.Net Runtime Library for Delphi

10. Create the type and save the file.

Delphi

var

...

finished: _Type;

begin

...

finished := myType.CreateType;

myAssembly.Save(myAsmName.Name + '.dll');

end.

414
.Net Runtime Library for Delphi

11. Invoke the method. ExampleMethod is not generic, but the type it belongs to is generic, so in order to get a
MethodInfo that can be invoked it is necessary to create a constructed type from the type definition for
Sample. The constructed type uses the Example class, which satisfies the constraints on TFirst because it is
a reference type and has a default parameterless constructor, and the ExampleDerived class which satisfies
the constraints on TSecond. (The code for ExampleDerived can be found in the example code section.)
These two types are passed to MakeGenericType to create the constructed type. The MethodInfo is then
obtained using the GetMethod method.

Delphi

var

...

typeArgs: _TypeArray;

constructed: _Type;

mi: _MethodInfo;

begin

...

typeArgs := TClrArrayHelper.ToTypeArray([

TClrAssembly.GetType('Example'),

TClrAssembly.GetType('ExampleDerived')]);

constructed := finished.MakeGenericType(typeArgs);

mi := constructed.GetMethod_5('ExampleMethod');

end.

12. The following code creates an array of Example objects, places that array in an array of type Object
representing the arguments of the method to be invoked, and passes them to the Invoke(Object, Object[])
method. The first argument of the Invoke method is a null reference because the method is static.

Delphi

var

415
.Net Runtime Library for Delphi

...

input: _ObjectArray;

arguments: _ObjectArray;

List_Example: OleVariant;

begin

...

input :=
TClrArrayHelper.ToObjectArray([TClrActivator.CreateInstance('Exa
mple'),

TClrActivator.CreateInstance('Example')]);

arguments := TClrArrayHelper.ToObjectArray([input]);

//List<Example>

List_Example := mi.Invoke_2(null, arguments);

end.

Example
The following code example defines a class named Sample, along with a base class and two interfaces. The program
defines two generic type parameters for Sample, turning it into a generic type. Type parameters are the only thing that
makes a type generic. The program shows this by displaying a test message before and after the definition of the type
parameters.
The type parameter TSecond is used to demonstrate class and interface constraints, using the base class and interfaces,
and the type parameter TFirstis used to demonstrate special constraints.
The code example defines a field and a method using the class's type parameters for the field type and for the
parameter and return type of the method.
After the Sample class has been created, the method is invoked.

416
.Net Runtime Library for Delphi

The program includes a method that lists information about a generic type, and a method that lists the special
constraints on a type parameter. These methods are used to display information about the finished Sample class.
The program saves the finished module to disk as GenericEmitExample1.dll.
Delphi

program Example;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.Enums,

CNClrLib.EnumTypes,

CNClrLib.Core,

CNClrLib.Host,

System.Variants,

Winapi.ActiveX;

var

Console: _Console;

// List the constraint flags. The GenericParameterAttributes

// enumeration contains two sets of attributes, variance and

// constraints. For this example, only constraints are used.

//

procedure ListConstraintAttributes(t: _Type);

var

constraints: TOleEnum;

begin

// Mask off the constraint flags.

constraints := t.GenericParameterAttributes and


GenericParameterAttributes_SpecialConstraintMask;

if ((constraints and
GenericParameterAttributes_ReferenceTypeConstraint)

<> GenericParameterAttributes_None) then

417
.Net Runtime Library for Delphi

begin

Console.WriteLine_14(' ReferenceTypeConstraint');

end;

if ((constraints and
GenericParameterAttributes_NotNullableValueTypeConstraint)

<> GenericParameterAttributes_None) then

begin

Console.WriteLine_14(' NotNullableValueTypeConstraint');

end;

if ((constraints and
GenericParameterAttributes_DefaultConstructorConstraint)

<> GenericParameterAttributes_None) then

begin

Console.WriteLine_14(' DefaultConstructorConstraint');

end;

end;

procedure DisplayGenericParameters(t: _Type);

var

typeParameters, constraints: _TypeArray;

I, J: Integer;

begin

if not t.IsGenericType then

begin

Console.WriteLine_15('Type ''{0}'' is not generic.', t);

Exit;

end;

if not t.IsGenericTypeDefinition then

begin

t := t.GetGenericTypeDefinition;

end;

418
.Net Runtime Library for Delphi

typeParameters := t.GetGenericArguments;

Console.WriteLine;

Console.WriteLine_17('Listing {0} type parameters for type


''{1}''.',

typeParameters.Length, t);

for I := 0 to typeParameters.Length - 1 do

begin

Console.WriteLine;

Console.WriteLine_15('Type parameter {0}:',


typeParameters[I].ToString);

constraints := typeParameters[I].GetGenericParameterConstraints;

for J := 0 to constraints.Length - 1 do

begin

if constraints[J].IsInterface then

Console.WriteLine_15(' Interface constraint: {0}',


constraints[J])

else

Console.WriteLine_15(' Base type: {0}', constraints[J])

end;

ListConstraintAttributes(typeParameters[I]);

end;

end;

var

myDomain: TClrAppDomain;

myAsmName: _AssemblyName;

myAssembly: _AssemblyBuilder;

myModule: _ModuleBuilder;

myType: _TypeBuilder;

typeParamNames: _StringArray;

419
.Net Runtime Library for Delphi

typeParams: _GenericTypeParameterBuilderArray;

TFirst: _GenericTypeParameterBuilder;

TSecond: _GenericTypeParameterBuilder;

baseType: _Type;

interfaceTypes: _TypeArray;

interfaceA: _Type;

interfaceB: _Type;

exField: _FieldBuilder;

listOf: _Type;

listOfTFirst: _Type;

mParamTypes: _TypeArray;

exMethod: _MethodBuilder;

ilgen: _ILGenerator;

ienumOf: _Type;

TfromListOf: _Type;

ienumOfT: _Type;

ctorArgs: _TypeArray;

ctorPrep: _ConstructorInfo;

ctor: _ConstructorInfo;

OpCodes: _OpCodesHelper;

TypeBuilder: _TypeBuilderHelper;

finished: _Type;

typeArgs: _TypeArray;

constructed: _Type;

mi: _MethodInfo;

input: _ObjectArray;

arguments: _ObjectArray;

List_Example: OleVariant;

begin

Console := CoConsole.CreateInstance;

myDomain := TClrAppDomain.GetCurrentDomain;

try

// Define a dynamic assembly to contain the sample type. The

420
.Net Runtime Library for Delphi

// assembly will not be run, but only saved to disk, so

// AssemblyBuilderAccess.Save is specified.

//

myAsmName := CoAssemblyName.CreateInstance('GenericEmitExample1');

myAssembly := myDomain.DefineDynamicAssembly(myAsmName,
abaRunAndSave);

// An assembly is made up of executable modules. For a single-

// module assembly, the module name and file name are the same

// as the assembly name.

//

myModule := myAssembly.DefineDynamicModule_2(myAsmName.Name,
myAsmName.Name + '.dll');

// Get type objects for the base class trivial interfaces to

// be used as constraints.

//

baseType := TClrAssembly.GetType('ExampleBase'); //An Empty base


class

interfaceA := TClrAssembly.GetType('IExampleA'); //An Empty


interface

interfaceB := TClrAssembly.GetType('IExampleB'); //An Empty


interface

// Define the sample type.

//

myType := myModule.DefineType_1('Sample', TypeAttributes_Public);

Console.WriteLine_15('Type ''Sample'' is generic: {0}',


myType.IsGenericType);

// Define type parameters for the type. Until you do this,

// the type is not generic, as the preceding and following

// WriteLine statements show. The type parameter names are

// specified as an array of strings. To make the code

// easier to read, each GenericTypeParameterBuilder is placed

421
.Net Runtime Library for Delphi

// in a variable with the same name as the type parameter.

//

typeParamNames := TClrArrayHelper.ToStringArray(['TFirst',
'TSecond']);

typeParams := myType.DefineGenericParameters(typeParamNames);

TFirst := typeParams[0];

TSecond := typeParams[1];

Console.WriteLine_15('Type ''Sample'' is generic: {0}',


myType.IsGenericType);

// Apply constraints to the type parameters.

//

// A type that is substituted for the first parameter, TFirst,

// must be a reference type and must have a parameterless

// constructor.

TFirst.SetGenericParameterAttributes(

GenericParameterAttributes_DefaultConstructorConstraint or

GenericParameterAttributes_ReferenceTypeConstraint);

// A type that is substituted for the second type

// parameter must implement IExampleA and IExampleB, and

// inherit from the trivial test class ExampleBase. The

// interface constraints are specified as an array

// containing the interface types.

TSecond.SetBaseTypeConstraint(baseType);

interfaceTypes := TClrArrayHelper.ToTypeArray([interfaceA,
interfaceB]);

TSecond.SetInterfaceConstraints(interfaceTypes);

// The following code adds a private field named ExampleField,

// of type TFirst.

exField := myType.DefineField('ExampleField', TFirst.AsType,


FieldAttributes_Private);

422
.Net Runtime Library for Delphi

// Define a static method that takes an array of TFirst and

// returns a List<TFirst> containing all the elements of

// the array. To define this method it is necessary to create

// the type List<TFirst> by calling MakeGenericType on the

// generic type definition, List<T>. (The T is omitted with

// the typeof operator when you get the generic type

// definition.) The parameter type is created by using the

// MakeArrayType method.

//

listOf :=
TClrAssembly.GetType('System.Collections.Generic.List`1');

listOfTFirst :=
listOf.MakeGenericType(TClrArrayHelper.ToTypeArray([TFirst.AsType]));

mParamTypes :=
TClrArrayHelper.ToTypeArray([TFirst.MakeArrayType]);

exMethod := myType.DefineMethod('ExampleMethod',

MethodAttributes_Public or
MethodAttributes_Static,

listOfTFirst,

mParamTypes);

// Emit the method body.

// The method body consists of just three opcodes, to load

// the input array onto the execution stack, to call the

// List<TFirst> constructor that takes IEnumerable<TFirst>,

// which does all the work of putting the input elements into

// the list, and to return, leaving the list on the stack. The

// hard work is getting the constructor.

//

// The GetConstructor method is not supported on a

// GenericTypeParameterBuilder, so it is not possible to get

// the constructor of List<TFirst> directly. There are two

// steps, first getting the constructor of List<T> and then

423
.Net Runtime Library for Delphi

// calling a method that converts it to the corresponding

// constructor of List<TFirst>.

//

// The constructor needed here is the one that takes an

// IEnumerable<T>. Note, however, that this is not the

// generic type definition of IEnumerable<T>; instead, the

// T from List<T> must be substituted for the T of

// IEnumerable<T>. (This seems confusing only because both

// types have type parameters named T. That is why this example

// uses the somewhat silly names TFirst and TSecond.) To get

// the type of the constructor argument, take the generic

// type definition IEnumerable<T> (expressed as

// IEnumerable<> when you use the typeof operator) and

// call MakeGenericType with the first generic type parameter

// of List<T>. The constructor argument list must be passed

// as an array, with just one argument in this case.

//

// Now it is possible to get the constructor of List<T>,

// using GetConstructor on the generic type definition. To get

// the constructor of List<TFirst>, pass List<TFirst> and

// the constructor from List<T> to the static

// TypeBuilder.GetConstructor method.

//

ilgen := exMethod.GetILGenerator;

ienumOf :=
TClrAssembly.GetType('System.Collections.Generic.IEnumerable`1');

TfromListOf := listOf.GetGenericArguments()[0];

ienumOfT :=
ienumOf.MakeGenericType(TClrArrayHelper.ToTypeArray([TfromListOf]));

ctorArgs := TClrArrayHelper.ToTypeArray([ienumOfT]);

TypeBuilder := CoTypeBuilderHelper.CreateInstance;

ctorPrep := listOf.GetConstructor_2(ctorArgs);

424
.Net Runtime Library for Delphi

ctor := TypeBuilder.GetConstructor(listOfTFirst, ctorPrep);

OpCodes := CoOpCodesHelper.CreateInstance;

ilgen.Emit(OpCodes.Ldarg_0);

ilgen.Emit_7(OpCodes.Newobj, ctor);

ilgen.Emit(OpCodes.Ret);

// Create the type and save the assembly.

finished := myType.CreateType;

myAssembly.Save(myAsmName.Name + '.dll');

// Invoke the method.

// ExampleMethod is not generic, but the type it belongs to is

// generic, so in order to get a MethodInfo that can be invoked

// it is necessary to create a constructed type. The Example

// class satisfies the constraints on TFirst, because it is a

// reference type and has a default constructor. In order to

// have a class that satisfies the constraints on TSecond,

// this code example defines the ExampleDerived type. These

// two types are passed to MakeGenericMethod to create the

// constructed type.

//

typeArgs := TClrArrayHelper.ToTypeArray([

TClrAssembly.GetType('Example'),

TClrAssembly.GetType('ExampleDerived')]);

constructed := finished.MakeGenericType(typeArgs);

mi := constructed.GetMethod_5('ExampleMethod');

// Create an array of Example objects, as input to the generic

// method. This array must be passed as the only element of an

// array of arguments. The first argument of Invoke is

// null, because ExampleMethod is static. Display the count

// on the resulting List<Example>.

425
.Net Runtime Library for Delphi

//

input :=
TClrArrayHelper.ToObjectArray([TClrActivator.CreateInstance('Example')
,

TClrActivator.CreateInstance('Example')]);

arguments := TClrArrayHelper.ToObjectArray([input]);

//List<Example>

List_Example := mi.Invoke_2(null, arguments);

finally

myDomain.Free;

end;

end.

426
.Net Runtime Library for Delphi

427
.Net Runtime Library for Delphi

428
.Net Runtime Library for Delphi

429
.Net Runtime Library for Delphi

430
.Net Runtime Library for Delphi

See Also

431
.Net Runtime Library for Delphi

Using Reflection Emit


Reflection Emit Dynamic Assembly Scenarios

4.3 Dynamic Source Code Generation and


Compilation
The .NET Framework includes a mechanism called the Code Document Object Model (CodeDOM) that enables
developers of programs that emit source code to generate source code in multiple programming languages at run time,
based on a single model that represents the code to render.
To represent source code, CodeDOM elements are linked to each other to form a data structure known as a CodeDOM
graph, which models the structure of some source code.
The CNClrLib.CodeDom namespace defines types that can represent the logical structure of source code, independent
of a specific programming language. The CNClrLib.CodeDom namespace defines types for generating source code from
CodeDOM graphs and managing the compilation of source code in supported languages. Compiler vendors or
developers can extend the set of supported languages.
Language-independent source code modeling can be valuable when a program needs to generate source code for a
program model in multiple languages or for an uncertain target language. For example, some designers use the
CodeDOM as a language abstraction interface to produce source code in the correct programming language, if
CodeDOM support for the language is available.
The .NET Framework includes code generators and code compilers for C#, JScript, and Visual Basic.
In This Section
Using the CodeDOM

Describes common uses, and demonstrates building a simple object graph using the CodeDOM.
Generating Source Code and Compiling a Program from a CodeDOM Graph

Describes how to generate source code and compile the generated code with an external compiler using
classes defined in the CNClrLib.CodeDom namespace.
How to: Create a Class Using CodeDOM

Describes how to use CodeDOM to generate a class containing fields, properties, a method, a constructor,
and an entry point.
Reference
System.CodeDom

Defines elements that represent code elements in programming languages that target the common language
runtime.
System.CodeDom.Compiler

Defines interfaces for generating and compiling code at run time.

4.3.1 Using the CodeDOM


The CodeDOM provides types that represent many common types of source code elements. You can design a program
that builds a source code model using CodeDOM elements to assemble an object graph. This object graph can be
rendered as source code using a CodeDOM code generator for a supported programming language. The CodeDOM
can also be used to compile source code into a binary assembly.
Some common uses for the CodeDOM include:
 Templated code generation: generating code for ASP.NET, XML Web services client proxies, code wizards,
designers, or other code-emitting mechanisms.
 Dynamic compilation: supporting code compilation in single or multiple languages.

432
.Net Runtime Library for Delphi

Building a CodeDOM Graph


The CNClrLib.CodeDom namespace provides classes for representing the logical structure of source code, independent
of language syntax.

The Structure of a CodeDOM Graph


The structure of a CodeDOM graph is like a tree of containers. The top-most, or root, container of each compilable
CodeDOM graph is a CodeCompileUnit. Every element of your source code model must be linked into the graph
through a property of a CodeObject in the graph.

Building a Source Code Model for a Sample Hello World Program


The following walkthrough provides an example of how to build a CodeDOM object graph that represents the code for
a simple Hello World application.
Creating a compile unit

The CodeDOM defines an object called a CodeCompileUnit, which can reference a CodeDOM object graph that models
the source code to compile. A CodeCompileUnit has properties for storing references to attributes, namespaces, and
assemblies.
The CodeDom providers that derive from the CodeDomProvider class contain methods that process the object graph
referenced by a CodeCompileUnit.
To create an object graph for a simple application, you must assemble the source code model and reference it from a
CodeCompileUnit.
You can create a new compile unit with the syntax demonstrated in this example:
Delphi

var

compileUnit: _CodeCompileUnit;

begin

compileUnit := CoCodeCompileUnit.CreateInstance;

end.

A CodeSnippetCompileUnit can contain a section of source code that is already in the target language, but cannot be
rendered to another language.
Defining a namespace

To define a namespace, create a CodeNamespace and assign a name for it using the appropriate constructor or by
setting its Name property.
Delphi

433
.Net Runtime Library for Delphi

var

...

samples: _CodeNamespace;

begin

...

samples := CoCodeNamespace.CreateInstance('Samples');

end.

Importing a namespace

To add a namespace import directive to the namespace, add a CodeNamespaceImport that indicates the namespace to
import to the CodeNamespace.Imports collection.
The following code adds an import for the System namespace to the Imports collection of a CodeNamespace named
samples:
Delphi

samples.Imports.Add(CoCodeNamespaceImport.CreateInstance('System'));

Linking code elements into the object graph

All code elements that form a CodeDOM graph must be linked to the CodeCompileUnit that is the root element of the
tree by a series of references between elements directly referenced from the properties of the root object of the graph.
Set an object to a property of a container object to establish a reference from the container object.
The following statement adds the samples CodeNamespace to the Namespaces collection property of the root
CodeCompileUnit.
Delphi

compileUnit.Namespaces.Add(samples);

434
.Net Runtime Library for Delphi

Defining a type

To declare a class, structure, interface, or enumeration using the CodeDOM, create a new CodeTypeDeclaration, and
assign it a name. The following example demonstrates this using a constructor overload to set the Name property:
Delphi

var

...

class1: _CodeTypeDeclaration;

begin

...

class1 := CoCodeTypeDeclaration.CreateInstance('Class1');

end.

To add a type to a namespace, add a CodeTypeDeclaration that represents the type to add to the namespace to the
Types collection of a CodeNamespace.
The following example demonstrates how to add a class named class1 to a CodeNamespace named samples:
Delphi

samples.Types.Add(class1);

Adding class members to a class

The CNClrLib.CodeDom namespace provides a variety of elements that can be used to represent class members. Each
class member can be added to the Members collection of a CodeTypeDeclaration.
Defining a code entry point method for an executable

If you are building code for an executable program, it is necessary to indicate the entry point of a program by creating a
CodeEntryPointMethod to represent the method at which program execution should begin.
The following example demonstrates how to define an entry point method that contains a
CodeMethodInvokeExpression that calls System.Console.WriteLine to print "Hello World!":

435
.Net Runtime Library for Delphi

Delphi

var

...

start: _CodeEntryPointMethod;

cs1: _CodeMethodInvokeExpression;

typeExprRef: _CodeTypeReferenceExpression;

Parameters: _CodeExpressionArray

begin

...

start := CoCodeEntryPointMethod.CreateInstance;

typeExprRef :=
CoCodeTypeReferenceExpression.CreateInstance('System.Console');

Parameters := CoCodeExpressionArray.CreateInstance(1);

Parameters[0] := CoCodePrimitiveExpression.CreateInstance('Hello
World!').AsCodeExpression;

cs1 :=
CoCodeMethodInvokeExpression.CreateInstance(typeExprRef.AsCodeExpressi
on, 'WriteLine', Parameters);

start.Statements.Add_1(cs1.AsCodeExpression);

end.

436
.Net Runtime Library for Delphi

The following statement adds the entry point method named Start to the Members collection of class1:
Delphi

class1.Members.Add(CoCodeTypeMember.Wrap(start));

Now the CodeCompileUnit named compileUnit contains the CodeDOM graph for a simple Hello World program. For
information on generating and compiling code from a CodeDOM graph, see Generating Source Code and Compiling a
Program from a CodeDOM Graph.
Example
The following code example demonstrates how to build a CodeDOM object graph that represents the code for a simple
Hello World application.
Delphi

program HelloWorldExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.CodeDom,

SysUtils;

var

compileUnit: _CodeCompileUnit;

samples: _CodeNamespace;

class1: _CodeTypeDeclaration;

start: _CodeEntryPointMethod;

cs1: _CodeMethodInvokeExpression;

typeExprRef: _CodeTypeReferenceExpression;

Parameters: _CodeExpressionArray;

begin

compileUnit := CoCodeCompileUnit.CreateInstance;

samples := CoCodeNamespace.CreateInstance('Samples');

437
.Net Runtime Library for Delphi

samples.Imports.Add(CoCodeNamespaceImport.CreateInstance('System'));

compileUnit.Namespaces.Add(samples);

class1 := CoCodeTypeDeclaration.CreateInstance('Class1');

samples.Types.Add(class1);

start := CoCodeEntryPointMethod.CreateInstance;

typeExprRef :=
CoCodeTypeReferenceExpression.CreateInstance('System.Console');

Parameters := CoCodeExpressionArray.CreateInstance(1);

Parameters[0] := CoCodePrimitiveExpression.CreateInstance('Hello
World!').AsCodeExpression;

cs1 :=
CoCodeMethodInvokeExpression.CreateInstance(typeExprRef.AsCodeExpressi
on, 'WriteLine', Parameters);

start.Statements.Add_1(cs1.AsCodeExpression);

class1.Members.Add(CoCodeTypeMember.Wrap(start));

end.

438
.Net Runtime Library for Delphi

More information on building a CodeDOM graph


The CodeDOM supports the many common types of code elements found in programming languages that support the
common language runtime. The CodeDOM was not designed to provide elements to represent all possible
programming language features. Code that cannot be represented easily with CodeDOM elements can be encapsulated
in a CodeSnippetExpression, a CodeSnippetStatement, a CodeSnippetTypeMember, or a CodeSnippetCompileUnit.
However, snippets cannot be translated to other languages automatically by the CodeDOM.
For documentation for the each of the CodeDOM types, see the reference documentation for the System.CodeDom
namespace.

4.3.2 Generating Source Code and Compiling


a Program from a CodeDOM Graph
The CNClrLib.CodeDom namespace provides interfaces for generating source code from CodeDOM object graphs and
for managing compilation with supported compilers. A code provider can produce source code in a particular
programming language according to a CodeDOM graph. A class that derives from CodeDomProvider can typically
provide methods for generating and compiling code for the language the provider supports.

Using a CodeDOM code provider to generate source code


To generate source code in a particular language, you need a CodeDOM graph that represents the structure of the
source code to generate.
The following example demonstrate how to create an instance of a CSharpCodeProvider(This interface can be found in
CNClrLib.CSharp namespace):
Delphi

uses

CNClrLib.CSharp;

var

439
.Net Runtime Library for Delphi

provider: _CSharpCodeProvider;

begin

provider := CoCSharpCodeProvider.CreateInstance;

end.

The graph for code generation is typically contained in a CodeCompileUnit. To generate code for a CodeCompileUnit
that contains a CodeDOM graph, call the GenerateCodeFromCompileUnit method of the code provider. This method
has a parameter for a TextWriter that it uses to generate the source code, so it is sometimes necessary to first create a
TextWriter that can be written to. The following example demonstrates generating code from a CodeCompileUnit and
writing the generated source code to a file named HelloWorld.cs.
Delphi

function GenerateCSharpCode(compileunit: _CodeCompileUnit): string;

var

provider: _CSharpCodeProvider;

sourceFile: string;

sw: _StreamWriter;

tw: _IndentedTextWriter;

begin

// Generate the code with the C# code provider.

provider := CoCSharpCodeProvider.CreateInstance;

// Build the output file name.

if provider.FileExtension[1] = '.' then

sourceFile := 'HelloWorld' + provider.FileExtension

else

sourceFile := 'HelloWorld.' + provider.FileExtension;

sw := CoStreamWriter.CreateInstance(sourceFile, false);

try

440
.Net Runtime Library for Delphi

tw := CoIndentedTextWriter.CreateInstance(sw.AsTextWriter, '
');

// Generate source code using the code provider.

provider.GenerateCodeFromCompileUnit(compileunit, tw.AsTextWriter,

CoCodeGeneratorOptions.CreateInstance);

// Close the output file.

tw.Close();

finally

sw.Close;

sw.Dispose;

end;

Result := sourceFile;

end;

441
.Net Runtime Library for Delphi

Using a CodeDOM code provider to compile assemblies

Invoking compilation
To compile an assembly using a CodeDom provider, you must have either source code to compile in a language for
which you have a compiler, or a CodeDOM graph that source code to compile can be generated from.
If you are compiling from a CodeDOM graph, pass the CodeCompileUnit containing the graph to the
CompileAssemblyFromDom method of the code provider. If you have a source code file in a language that the
compiler understands, pass the name of the file containing the source code to the CompileAssemblyFromFile method
of the CodeDom provider. You can also pass a string containing source code in a language that the compiler
understands to the CompileAssemblyFromSource method of the CodeDom provider.

Configuring compilation parameters


All of the standard compilation-invoking methods of a CodeDom provider have a parameter of type
CompilerParameters that indicates the options to use for compilation.
You can specify a file name for the output assembly in the OutputAssembly property of the CompilerParameters.
Otherwise, a default output file name will be used.
By default, a new CompilerParameters is initialized with its GenerateExecutable property set to false. If you are
compiling an executable program, you must set the GenerateExecutable property to true. When the
GenerateExecutable is set to false, the compiler will generate a class library.
If you are compiling an executable from a CodeDOM graph, a CodeEntryPointMethod must be defined in the graph. If
there are multiple code entry points, it may be necessary to set the MainClass property of the CompilerParameters to
the name of the class that defines the entry point to use.
To include debug information in a generated executable, set the IncludeDebugInformation property to true.
If your project references any assemblies, you must specify the assembly names as items in a StringCollection as the
ReferencedAssemblies property of the CompilerParameters you use when invoking compilation.
You can compile an assembly that is written to memory rather than disk by setting the GenerateInMemory property to
true. When an assembly is generated in memory, your code can obtain a reference to the generated assembly from the
CompiledAssembly property of a CompilerResults. If an assembly is written to disk, you can obtain the path to the
generated assembly from the PathToAssembly property of a CompilerResults.
To specify a custom command-line arguments string to use when invoking the compilation process, set the string in the
CompilerOptions property.
If a Win32 security token is required to invoke the compiler process, specify the token in the UserToken property.
To link a Win32 resource file into the compiled assembly, specify the name of the Win32 resource file in the
Win32Resource property.
To specify a warning level at which to halt compilation, set the WarningLevel property to an integer that represents the
warning level at which to halt compilation. You can also configure the compiler to halt compilation if warnings are
encountered by setting the TreatWarningsAsErrors property to true.
The following code example demonstrates compiling a source file using a CodeDom provider derived from the
CodeDomProvider interface.
Delphi

function CompileCSharpCode(sourceFile, exeFile: string): Boolean;

var

provider: _CSharpCodeProvider;

cp: _CompilerParameters;

cr: _CompilerResults;

I: Integer;

begin

provider := CoCSharpCodeProvider.CreateInstance;

442
.Net Runtime Library for Delphi

// Build the parameters for source compilation.

cp := CoCompilerParameters.CreateInstance;

// Add an assembly reference.

cp.ReferencedAssemblies.Add('System.dll');

// Generate an executable instead of

// a class library.

cp.GenerateExecutable := true;

// Set the assembly file name to generate.

cp.OutputAssembly := exeFile;

// Save the assembly as a physical file.

cp.GenerateInMemory := false;

// Invoke compilation.

cr := provider..CompileAssemblyFromFile(cp,
TClrArrayHelper.ToStringArray([sourceFile]));

if cr.Errors.Count > 0 then

begin

// Display compilation errors.

Console.WriteLine_17('Errors building {0} into {1}', sourceFile,


cr.PathToAssembly);

for I := 0 to cr.Errors.Count - 1 do

begin

Console.WriteLine_15(' {0}', cr.Errors[I].ToString());

Console.WriteLine;

end;

end

else

begin

443
.Net Runtime Library for Delphi

Console.WriteLine_17('Source {0} built into {1} successfully.',


sourceFile, cr.PathToAssembly);

end;

// Return the results of compilation.

Result := cr.Errors.Count = 0;

end;

4.3.3 How to: Create a Class Using CodeDOM


The following procedures illustrate how to create and compile a CodeDOM graph that
generates a class containing two fields, three properties, a method, a constructor, and an entry
point.

1. Create a console application that will use CodeDOM code to generate the source code for a class.
In this example, the generating class is named Sample, and the generated code is a class named
CodeDOMCreatedClass in a file named SampleCode.
2. In the generating class, initialize the CodeDOM graph and use CodeDOM methods to define the members,
constructor, and entry point (Mainmethod) of the generated class.
In this example, the generated class has two fields, three properties, a constructor, a method, and a Main
method.
3. In the generating class, create a language-specific code provider and call its GenerateCodeFromCompileUnit
method to generate the code from the graph.
4. Compile and execute the application to generate the code.
In this example, the generated code is in a file named SampleCode. Compile and execute that code to see the
sample output.
To create the application that will execute the CodeDOM code
 Create a console application class to contain the CodeDOM code. Define the global fields that are to be used
in the class to reference the assembly (CodeCompileUnit) and class (CodeTypeDeclaration), specify the
name of the generated source file.

Delphi

program SampleCodeDom;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.CodeDom,

CNClrLib.CSharp,

CNClrLib.Core,

444
.Net Runtime Library for Delphi

CNClrLib.Host;

const

outputFileName = 'SampleCode.cs';

var

targetUnit: _CodeCompileUnit;

targetClass: _CodeTypeDeclaration;

begin

end.

To initialize the CodeDOM graph


 Initialize the assembly and class, and add the appropriate declarations to the CodeDOM graph.

Delphi

var

samples: _CodeNamespace;

begin

445
.Net Runtime Library for Delphi

targetUnit := CoCodeCompileUnit.CreateInstance;

samples := CoCodeNamespace.CreateInstance('CodeDOMSample');

samples.Imports.Add(CoCodeNamespaceImport.CreateInstance('System
'));

targetClass :=
CoCodeTypeDeclaration.CreateInstance('CodeDOMCreatedClass');

targetClass.IsClass := true;

targetClass.TypeAttributes := TypeAttributes_Public or
TypeAttributes_Sealed;

samples.Types.Add(targetClass);

targetUnit.Namespaces.Add(samples);

end.

To add members to the CodeDOM graph


 Add fields to the CodeDOM graph by adding CodeMemberField objects to the Members property of the
class.

Delphi

procedure AddFields;

var

widthValueField: _CodeMemberField;

heightValueField: _CodeMemberField;

begin

// Declare the widthValue field.

446
.Net Runtime Library for Delphi

widthValueField := CoCodeMemberField.CreateInstance;

widthValueField.Attributes := MemberAttributes_Private;

widthValueField.Name := 'widthValue';

widthValueField.Type_ :=
CoCodeTypeReference.CreateInstance(TClrAssembly.GetType('System.
Double'));

widthValueField.Comments.Add(CoCodeCommentStatement.CreateInstan
ce('The width of the object.'));

targetClass.Members.Add(widthValueField.AsCodeTypeMember);

// Declare the heightValue field

heightValueField := CoCodeMemberField.CreateInstance;

heightValueField.Attributes := MemberAttributes_Private;

heightValueField.Name := 'heightValue';

heightValueField.Type_ :=
CoCodeTypeReference.CreateInstance(TClrAssembly.GetType('System.
Double'));

heightValueField.Comments.Add(CoCodeCommentStatement.CreateInsta
nce('The height of the object.'));

targetClass.Members.Add(heightValueField.AsCodeTypeMember);

end;

447
.Net Runtime Library for Delphi

 Add properties to the CodeDOM graph by adding CodeMemberProperty objects to the Members property
of the class.

Delphi

procedure AddProperties;

var

widthProperty: _CodeMemberProperty;

heightProperty: _CodeMemberProperty;

areaProperty: _CodeMemberProperty;

areaExpression: _CodeBinaryOperatorExpression;

begin

// Declare the read-only Width property.

widthProperty := CoCodeMemberProperty.CreateInstance;

widthProperty.Attributes := MemberAttributes_Public or
MemberAttributes_Final;

widthProperty.Name := 'Width';

widthProperty.HasGet := true;

widthProperty.Type_ :=
CoCodeTypeReference.CreateInstance(TClrAssembly.GetType('System.
Double'));

widthProperty.Comments.Add(CoCodeCommentStatement.CreateInstance
('The Width property for the object.'));

widthProperty.GetStatements.Add(CoCodeMethodReturnStatement.Crea
teInstance(

CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,

'widthValue').AsCodeExpression).AsCodeStatement);

targetClass.Members.Add(widthProperty.AsCodeTypeMember);

448
.Net Runtime Library for Delphi

// Declare the read-only Height property.

heightProperty := CoCodeMemberProperty.CreateInstance;

heightProperty.Attributes := MemberAttributes_Public or
MemberAttributes_Final;

heightProperty.Name := 'Height';

heightProperty.HasGet := true;

heightProperty.Type_ :=
CoCodeTypeReference.CreateInstance(TClrAssembly.GetType('System.
Double'));

heightProperty.Comments.Add(CoCodeCommentStatement.CreateInstanc
e('The Height property for the object.'));

heightProperty.GetStatements.Add(CoCodeMethodReturnStatement.Cre
ateInstance(

CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,

'heightValue').AsCodeExpression).AsCodeStatement);

targetClass.Members.Add(heightProperty.AsCodeTypeMember);

// Declare the read only Area property.

areaProperty := CoCodeMemberProperty.CreateInstance;

areaProperty.Attributes := MemberAttributes_Public or
MemberAttributes_Final;

areaProperty.Name := 'Area';

areaProperty.HasGet := true;

areaProperty.Type_ :=
CoCodeTypeReference.CreateInstance(TClrAssembly.GetType('System.
Double'));

areaProperty.Comments.Add(CoCodeCommentStatement.CreateInstance(
'The Area property for the object.'));

449
.Net Runtime Library for Delphi

// Create an expression to calculate the area for the get


accessor

// of the Area property.

areaExpression :=
CoCodeBinaryOperatorExpression.CreateInstance(

CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,
'widthValue').AsCodeExpression,

cbotMultiply,

CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,
'heightValue').AsCodeExpression);

areaProperty.GetStatements.Add(

CoCodeMethodReturnStatement.CreateInstance(areaExpression.AsCode
Expression).AsCodeStatement);

targetClass.Members.Add(areaProperty.AsCodeTypeMember);

end;

450
.Net Runtime Library for Delphi

 Add a method to the CodeDOM graph by adding a CodeMemberMethod object to the Members property
of the class.

Delphi

procedure AddMethod;

var

toStringMethod: _CodeMemberMethod;

widthReference: _CodeFieldReferenceExpression;

heightReference: _CodeFieldReferenceExpression;

areaReference: _CodeFieldReferenceExpression;

returnStatement: _CodeMethodReturnStatement;

formattedOutput: string;

Environment: _Environment;

Parameters: _CodeExpressionArray;

begin

// Declaring a ToString method

451
.Net Runtime Library for Delphi

toStringMethod := CoCodeMemberMethod.CreateInstance;

toStringMethod.Attributes := MemberAttributes_Public or
MemberAttributes_Override;

toStringMethod.Name := 'ToString';

toStringMethod.ReturnType :=
CoCodeTypeReference.CreateInstance(TClrAssembly.GetType('System.
String'));

widthReference :=
CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,
'Width');

heightReference :=
CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,
'Height');

areaReference :=
CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,
'Area');

// Declaring a return statement for method ToString.

returnStatement :=
CoCodeMethodReturnStatement.CreateInstance;

Environment := CoEnvironment.CreateInstance;

// This statement returns a string representation of the


width,

// height, and area.

formattedOutput := 'The object:' + Environment.NewLine +

' width = {0},' + Environment.NewLine +

' height = {1},' + Environment.NewLine +

452
.Net Runtime Library for Delphi

' area = {2}';

Parameters := CoCodeExpressionArray.CreateInstance(4);

Parameters[0] :=
CoCodePrimitiveExpression.CreateInstance(formattedOutput).AsCode
Expression;

Parameters[1] := widthReference.AsCodeExpression;

Parameters[2] := heightReference.AsCodeExpression;

Parameters[3] := areaReference.AsCodeExpression;

returnStatement.Expression :=

CoCodeMethodInvokeExpression.CreateInstance(

CoCodeTypeReferenceExpression.CreateInstance('System.String').As
CodeExpression,

'Format', Parameters).AsCodeExpression;

toStringMethod.Statements.Add(returnStatement.AsCodeStatement);

targetClass.Members.Add(toStringMethod.AsCodeTypeMember);

end;

453
.Net Runtime Library for Delphi

 Add a constructor to the CodeDOM graph by adding a CodeConstructor object to the Members property of
the class.

Delphi

procedure AddConstructor;

var

constructorA: _CodeConstructor;

widthReference: _CodeFieldReferenceExpression;

heightReference: _CodeFieldReferenceExpression;

begin

// Declare the constructor

constructorA := CoCodeConstructor.CreateInstance;

constructorA.Attributes := MemberAttributes_Public or
MemberAttributes_Final;

// Add parameters.

454
.Net Runtime Library for Delphi

constructorA.Parameters.Add(

CoCodeParameterDeclarationExpression.CreateInstance(

TClrAssembly.GetType(tcDouble),

'width'));

constructorA.Parameters.Add(

CoCodeParameterDeclarationExpression.CreateInstance(

TClrAssembly.GetType(tcDouble),

'height'));

// Add field initialization logic

widthReference :=

CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,
'widthValue');

constructorA.Statements.Add(CoCodeAssignStatement.CreateInstance
(widthReference.AsCodeExpression,

CoCodeArgumentReferenceExpression.CreateInstance('width').AsCode
Expression).AsCodeStatement);

heightReference :=
CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,
'heightValue');

constructorA.Statements.Add(CoCodeAssignStatement.CreateInstance
(heightReference.AsCodeExpression,

CoCodeArgumentReferenceExpression.CreateInstance('height').AsCod
eExpression).AsCodeStatement);

455
.Net Runtime Library for Delphi

targetClass.Members.Add(constructorA.AsCodeMemberMethod.AsCodeTy
peMember);

end;

 Add an entry point to the CodeDOM graph by adding a CodeEntryPointMethod object to the Members
property of the class.

Delphi

procedure AddEntryPoint;

var

start: _CodeEntryPointMethod;

objectCreate: _CodeObjectCreateExpression;

Parameters: _CodeExpressionArray;

toStringInvoke: _CodeMethodInvokeExpression;

456
.Net Runtime Library for Delphi

begin

start := CoCodeEntryPointMethod.CreateInstance;

Parameters:= CoCodeExpressionArray.CreateInstance(2);

Parameters[0] :=
CoCodePrimitiveExpression.CreateInstance(5.3).AsCodeExpression;

Parameters[1] :=
CoCodePrimitiveExpression.CreateInstance(6.9).AsCodeExpression;

objectCreate := CoCodeObjectCreateExpression.CreateInstance(

CoCodeTypeReference.CreateInstance('CodeDOMCreatedClass'),

Parameters);

// Add the statement:

// "CodeDOMCreatedClass testClass =

// new CodeDOMCreatedClass(5.3, 6.9);"

start.Statements.Add(CoCodeVariableDeclarationStatement.CreateIn
stance(

CoCodeTypeReference.CreateInstance('CodeDOMCreatedClass'),

'testClass',

objectCreate.AsCodeExpression).AsCodeStatement);

// Creat the expression:

// "testClass.ToString()"

toStringInvoke :=
CoCodeMethodInvokeExpression.CreateInstance(

CoCodeVariableReferenceExpression.CreateInstance('testClass').As
CodeExpression,

'ToString', nil);

// Add a System.Console.WriteLine statement with the


previous

457
.Net Runtime Library for Delphi

// expression as a parameter.

Parameters:= CoCodeExpressionArray.CreateInstance(1);

Parameters[0] := toStringInvoke.AsCodeExpression;

start.Statements.Add(CoCodeStatement.Wrap(

CoCodeMethodInvokeExpression.CreateInstance(

CoCodeTypeReferenceExpression.CreateInstance('System.Console').A
sCodeExpression,

'WriteLine', Parameters)));

targetClass.Members.Add(start.AsCodeMemberMethod.AsCodeTypeMembe
r);

end;

458
.Net Runtime Library for Delphi

To generate the code from the CodeDOM graph


 Generate source code from the CodeDOM graph by calling the GenerateCodeFromCompileUnit method.

Delphi

procedure GenerateCSharpCode(fileName: string);

var

provider: _CodeDomProvider;

providerHelper: _CodeDomProviderHelper;

options: _CodeGeneratorOptions;

sourceWriter: _StreamWriter;

begin

providerHelper := CoCodeDomProviderHelper.CreateInstance;

provider := providerHelper.CreateProvider_1('CSharp');

options := CoCodeGeneratorOptions.CreateInstance;

options.BracingStyle := 'C';

sourceWriter := CoStreamWriter.CreateInstance(fileName);

try

provider.GenerateCodeFromCompileUnit(targetUnit,
sourceWriter.AsTextWriter, options);

finally

sourceWriter.Close;

sourceWriter.Dispose;

end;

end;

459
.Net Runtime Library for Delphi

To create the graph and generate the code


1. Add the methods created in the preceding steps to the Main method defined in the first step.

Delphi

var

sample: TSample;

begin

sample := TSample.Create;

sample.AddFields;

sample.AddProperties;

sample.AddMethod;

sample.AddConstructor;

sample.AddEntryPoint;

sample.GenerateCSharpCode(outputFileName);

end.

460
.Net Runtime Library for Delphi

2. Compile and execute the generating class.


Example
The following code example shows the code from the preceding steps.
Delphi

program SampleCodeDom;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.Enums,

CNClrLib.EnumTypes,

CNClrLib.CodeDom,

CNClrLib.CSharp,

CNClrLib.Core,

CNClrLib.Host;

const

/// <summary>

/// The name of the file to contain the source code.

/// </summary>

outputFileName = 'SampleCode.cs';

var

/// <summary>

/// Define the compile unit to use for code generation.

/// </summary>

targetUnit: _CodeCompileUnit;

/// <summary>

461
.Net Runtime Library for Delphi

/// The only class in the compile unit. This class contains 2
fields,

/// 3 properties, a constructor, an entry point, and 1 simple


method.

/// </summary>

targetClass: _CodeTypeDeclaration;

type

/// <summary>

/// This code example creates a graph using a CodeCompileUnit and

/// generates source code for the graph using the


CSharpCodeProvider.

/// </summary>

TSample = class

public

constructor Create;

procedure AddFields;

procedure AddProperties;

procedure AddMethod;

procedure AddConstructor;

procedure AddEntryPoint;

procedure GenerateCSharpCode(fileName: string);

end;

/// <summary>

/// Define the class.

/// </summary>

constructor TSample.Create;

var

samples: _CodeNamespace;

begin

targetUnit := CoCodeCompileUnit.CreateInstance;

samples := CoCodeNamespace.CreateInstance('CodeDOMSample');

462
.Net Runtime Library for Delphi

samples.Imports.Add(CoCodeNamespaceImport.CreateInstance('System'));

targetClass :=
CoCodeTypeDeclaration.CreateInstance('CodeDOMCreatedClass');

targetClass.IsClass := true;

targetClass.TypeAttributes := TypeAttributes_Public or
TypeAttributes_Sealed;

samples.Types.Add(targetClass);

targetUnit.Namespaces.Add(samples);

end;

/// <summary>

/// Adds two fields to the class.

/// </summary>

procedure TSample.AddFields;

var

widthValueField: _CodeMemberField;

heightValueField: _CodeMemberField;

begin

// Declare the widthValue field.

widthValueField := CoCodeMemberField.CreateInstance;

widthValueField.Attributes := MemberAttributes_Private;

widthValueField.Name := 'widthValue';

widthValueField.Type_ :=
CoCodeTypeReference.CreateInstance(TClrAssembly.GetType('System.Double
'));

widthValueField.Comments.Add(CoCodeCommentStatement.CreateInstance('Th
e width of the object.'));

targetClass.Members.Add(widthValueField.AsCodeTypeMember);

// Declare the heightValue field

heightValueField := CoCodeMemberField.CreateInstance;

heightValueField.Attributes := MemberAttributes_Private;

heightValueField.Name := 'heightValue';

463
.Net Runtime Library for Delphi

heightValueField.Type_ :=
CoCodeTypeReference.CreateInstance(TClrAssembly.GetType('System.Double
'));

heightValueField.Comments.Add(CoCodeCommentStatement.CreateInstance('T
he height of the object.'));

targetClass.Members.Add(heightValueField.AsCodeTypeMember);

end;

/// <summary>

/// Add three properties to the class.

/// </summary>

procedure TSample.AddProperties;

var

widthProperty: _CodeMemberProperty;

heightProperty: _CodeMemberProperty;

areaProperty: _CodeMemberProperty;

areaExpression: _CodeBinaryOperatorExpression;

begin

// Declare the read-only Width property.

widthProperty := CoCodeMemberProperty.CreateInstance;

widthProperty.Attributes := MemberAttributes_Public or
MemberAttributes_Final;

widthProperty.Name := 'Width';

widthProperty.HasGet := true;

widthProperty.Type_ :=
CoCodeTypeReference.CreateInstance(TClrAssembly.GetType('System.Double
'));

widthProperty.Comments.Add(CoCodeCommentStatement.CreateInstance('The
Width property for the object.'));

widthProperty.GetStatements.Add(CoCodeMethodReturnStatement.CreateInst
ance(

CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,

'widthValue').AsCodeExpression).AsCodeStatement);

464
.Net Runtime Library for Delphi

targetClass.Members.Add(widthProperty.AsCodeTypeMember);

// Declare the read-only Height property.

heightProperty := CoCodeMemberProperty.CreateInstance;

heightProperty.Attributes := MemberAttributes_Public or
MemberAttributes_Final;

heightProperty.Name := 'Height';

heightProperty.HasGet := true;

heightProperty.Type_ :=
CoCodeTypeReference.CreateInstance(TClrAssembly.GetType('System.Double
'));

heightProperty.Comments.Add(CoCodeCommentStatement.CreateInstance('The
Height property for the object.'));

heightProperty.GetStatements.Add(CoCodeMethodReturnStatement.CreateIns
tance(

CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,

'heightValue').AsCodeExpression).AsCodeStatement);

targetClass.Members.Add(heightProperty.AsCodeTypeMember);

// Declare the read only Area property.

areaProperty := CoCodeMemberProperty.CreateInstance;

areaProperty.Attributes := MemberAttributes_Public or
MemberAttributes_Final;

areaProperty.Name := 'Area';

areaProperty.HasGet := true;

areaProperty.Type_ :=
CoCodeTypeReference.CreateInstance(TClrAssembly.GetType('System.Double
'));

areaProperty.Comments.Add(CoCodeCommentStatement.CreateInstance('The
Area property for the object.'));

// Create an expression to calculate the area for the get accessor

// of the Area property.

areaExpression := CoCodeBinaryOperatorExpression.CreateInstance(

465
.Net Runtime Library for Delphi

CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,
'widthValue').AsCodeExpression,

cbotMultiply,

CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,
'heightValue').AsCodeExpression);

areaProperty.GetStatements.Add(

CoCodeMethodReturnStatement.CreateInstance(areaExpression.AsCodeExpres
sion).AsCodeStatement);

targetClass.Members.Add(areaProperty.AsCodeTypeMember);

end;

/// <summary>

/// Adds a method to the class. This method multiplies values stored

/// in both fields.

/// </summary>

procedure TSample.AddMethod;

var

toStringMethod: _CodeMemberMethod;

widthReference: _CodeFieldReferenceExpression;

heightReference: _CodeFieldReferenceExpression;

areaReference: _CodeFieldReferenceExpression;

returnStatement: _CodeMethodReturnStatement;

formattedOutput: string;

Environment: _Environment;

Parameters: _CodeExpressionArray;

begin

// Declaring a ToString method

toStringMethod := CoCodeMemberMethod.CreateInstance;

toStringMethod.Attributes := MemberAttributes_Public or
MemberAttributes_Override;

toStringMethod.Name := 'ToString';

466
.Net Runtime Library for Delphi

toStringMethod.ReturnType :=
CoCodeTypeReference.CreateInstance(TClrAssembly.GetType('System.String
'));

widthReference := CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,
'Width');

heightReference := CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,
'Height');

areaReference := CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,
'Area');

// Declaring a return statement for method ToString.

returnStatement := CoCodeMethodReturnStatement.CreateInstance;

Environment := CoEnvironment.CreateInstance;

// This statement returns a string representation of the width,

// height, and area.

formattedOutput := 'The object:' + Environment.NewLine +

' width = {0},' + Environment.NewLine +

' height = {1},' + Environment.NewLine +

' area = {2}';

Parameters := CoCodeExpressionArray.CreateInstance(4);

Parameters[0] :=
CoCodePrimitiveExpression.CreateInstance(formattedOutput).AsCodeExpres
sion;

Parameters[1] := widthReference.AsCodeExpression;

Parameters[2] := heightReference.AsCodeExpression;

Parameters[3] := areaReference.AsCodeExpression;

returnStatement.Expression :=

CoCodeMethodInvokeExpression.CreateInstance(

467
.Net Runtime Library for Delphi

CoCodeTypeReferenceExpression.CreateInstance('System.String').AsCodeEx
pression,

'Format', Parameters).AsCodeExpression;

toStringMethod.Statements.Add(returnStatement.AsCodeStatement);

targetClass.Members.Add(toStringMethod.AsCodeTypeMember);

end;

/// <summary>

/// Add a constructor to the class.

/// </summary>

procedure TSample.AddConstructor;

var

constructorA: _CodeConstructor;

widthReference: _CodeFieldReferenceExpression;

heightReference: _CodeFieldReferenceExpression;

begin

// Declare the constructor

constructorA := CoCodeConstructor.CreateInstance;

constructorA.Attributes := MemberAttributes_Public or
MemberAttributes_Final;

// Add parameters.

constructorA.Parameters.Add(

CoCodeParameterDeclarationExpression.CreateInstance(

TClrAssembly.GetType(tcDouble),

'width'));

constructorA.Parameters.Add(

CoCodeParameterDeclarationExpression.CreateInstance(

TClrAssembly.GetType(tcDouble),

'height'));

// Add field initialization logic

468
.Net Runtime Library for Delphi

widthReference :=

CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,
'widthValue');

constructorA.Statements.Add(CoCodeAssignStatement.CreateInstance(width
Reference.AsCodeExpression,

CoCodeArgumentReferenceExpression.CreateInstance('width').AsCodeExpres
sion).AsCodeStatement);

heightReference := CoCodeFieldReferenceExpression.CreateInstance(

CoCodeThisReferenceExpression.CreateInstance.AsCodeExpression,
'heightValue');

constructorA.Statements.Add(CoCodeAssignStatement.CreateInstance(heigh
tReference.AsCodeExpression,

CoCodeArgumentReferenceExpression.CreateInstance('height').AsCodeExpre
ssion).AsCodeStatement);

targetClass.Members.Add(constructorA.AsCodeMemberMethod.AsCodeTypeMemb
er);

end;

/// <summary>

/// Add an entry point to the class.

/// </summary>

procedure TSample.AddEntryPoint;

var

start: _CodeEntryPointMethod;

objectCreate: _CodeObjectCreateExpression;

Parameters: _CodeExpressionArray;

toStringInvoke: _CodeMethodInvokeExpression;

begin

start := CoCodeEntryPointMethod.CreateInstance;

Parameters:= CoCodeExpressionArray.CreateInstance(2);

469
.Net Runtime Library for Delphi

Parameters[0] :=
CoCodePrimitiveExpression.CreateInstance(5.3).AsCodeExpression;

Parameters[1] :=
CoCodePrimitiveExpression.CreateInstance(6.9).AsCodeExpression;

objectCreate := CoCodeObjectCreateExpression.CreateInstance(

CoCodeTypeReference.CreateInstance('CodeDOMCreatedClass'),

Parameters);

// Add the statement:

// "CodeDOMCreatedClass testClass =

// new CodeDOMCreatedClass(5.3, 6.9);"

start.Statements.Add(CoCodeVariableDeclarationStatement.CreateInstance
(

CoCodeTypeReference.CreateInstance('CodeDOMCreatedClass'),

'testClass',

objectCreate.AsCodeExpression).AsCodeStatement);

// Creat the expression:

// "testClass.ToString()"

toStringInvoke := CoCodeMethodInvokeExpression.CreateInstance(

CoCodeVariableReferenceExpression.CreateInstance('testClass').AsCodeEx
pression,

'ToString', nil);

// Add a System.Console.WriteLine statement with the previous

// expression as a parameter.

Parameters:= CoCodeExpressionArray.CreateInstance(1);

Parameters[0] := toStringInvoke.AsCodeExpression;

start.Statements.Add(CoCodeStatement.Wrap(

CoCodeMethodInvokeExpression.CreateInstance(

CoCodeTypeReferenceExpression.CreateInstance('System.Console').AsCodeE
xpression,

'WriteLine', Parameters)));

470
.Net Runtime Library for Delphi

targetClass.Members.Add(start.AsCodeMemberMethod.AsCodeTypeMember);

end;

/// <summary>

/// Generate CSharp source code from the compile unit.

/// </summary>

/// <param name="filename">Output file name</param>

procedure TSample.GenerateCSharpCode(fileName: string);

var

provider: _CodeDomProvider;

providerHelper: _CodeDomProviderHelper;

options: _CodeGeneratorOptions;

sourceWriter: _StreamWriter;

begin

providerHelper := CoCodeDomProviderHelper.CreateInstance;

provider := providerHelper.CreateProvider_1('CSharp');

options := CoCodeGeneratorOptions.CreateInstance;

options.BracingStyle := 'C';

sourceWriter := CoStreamWriter.CreateInstance(fileName);

try

provider.GenerateCodeFromCompileUnit(targetUnit,
sourceWriter.AsTextWriter, options);

finally

sourceWriter.Close;

sourceWriter.Dispose;

end;

end;

/// <summary>

/// Create the CodeDOM graph and generate the code.

/// </summary>

var

471
.Net Runtime Library for Delphi

sample: TSample;

begin

sample := TSample.Create;

sample.AddFields;

sample.AddProperties;

sample.AddMethod;

sample.AddConstructor;

sample.AddEntryPoint;

sample.GenerateCSharpCode(outputFileName);

end.

472
.Net Runtime Library for Delphi

473
.Net Runtime Library for Delphi

474
.Net Runtime Library for Delphi

475
.Net Runtime Library for Delphi

476
.Net Runtime Library for Delphi

When the preceding example is compiled and executed, it produces the following source code.
C#

//--------------------------------------------------------------------
------

// <auto-generated>

// This code was generated by a tool.

// Runtime Version:2.0.50727.42

//

// Changes to this file may cause incorrect behavior and will be


lost if

// the code is regenerated.

// </auto-generated>

477
.Net Runtime Library for Delphi

//--------------------------------------------------------------------
------

namespace CodeDOMSample

using System;

public sealed class CodeDOMCreatedClass

// The width of the object.

private double widthValue;

// The height of the object.

private double heightValue;

public CodeDOMCreatedClass(double width, double height)

this.widthValue = width;

this.heightValue = height;

// The Width property for the object.

public double Width

get

return this.widthValue;

// The Height property for the object.

478
.Net Runtime Library for Delphi

public double Height

get

return this.heightValue;

// The Area property for the object.

public double Area

get

return (this.widthValue * this.heightValue);

public override string ToString()

return string.Format(

"The object:\r\n width = {0},\r\n height = {1},\r\n


area = {2}",

this.Width, this.Height, this.Area);

public static void Main()

CodeDOMCreatedClass testClass = new


CodeDOMCreatedClass(5.3, 6.9);

System.Console.WriteLine(testClass.ToString());

479
.Net Runtime Library for Delphi

480
.Net Runtime Library for Delphi

The generated source code produces the following output when compiled and executed.
The object:
width = 5.3,
height = 6.9,
area = 36.57

See Also
Using the CodeDOM
Generating and Compiling Source Code from a CodeDOM Graph

5. Utilities
This section of the documentation provides the list of the .Net Runtime Library utilities.
In This Section
Import .Net Assemblies

Describes how to import .net assemblies and generates delphi classes from the types of the imported
assemblies.
Import WSDL/XML Webservices

Describes how to import Web Service Description language file/url or XML schema that describes a web
service and generates delphi classes from the types of the imported wsdl assemblies.

5.1 Import .Net Assemblies


Describes how to import .net assemblies and generates delphi classes from the types of the
imported assemblies.

481
.Net Runtime Library for Delphi

Note

Before you can use this utility to generate delphi classes from .Net assemblies, you
must have Delphi Host Class Library and Delphi Framework Class Library
installed.
Follow the steps below to import .Net Assemblies and generate Delphi Classes from the
types of the Assemblies imported:

Step 1: Click on the add button to add .Net Assembly files to the Assembly Names list. The
assemblies can be removed by selecting the assemblies on the list and subsequently clicking on
the remove button .

The right part of the screen above displays the properties of the assemblies to be imported.

The delphi unit name for the assembly can be changed from the property display section. For
instance, the name of the above assembly on the list has been changed from System.Xml to
SystemXmlUnit.

482
.Net Runtime Library for Delphi

To load assemblies from the Global Assembly Cache (GAC), click on the GAC button and the
GAC assembly form below will be shown.

Select the assemblies to import from the GAC assembly form above and click the Ok button to
add the selected assemblies to the list.

Click the Next button and go to step 2.

Step 2: This screen allows you to specify which types and the members of the types of the
assemblies you want to import. The members of the type includes the Constructors, Fields,
Properties, Methods and Events. In the screen below, the XmlDocument type has
been selected and atleast one member item has also been selected for each member of the
type.

483
.Net Runtime Library for Delphi

You can change the class names of the assembly types by clicking on the Modify Class Name button. The screen below
will be shown where you can change the default class names of the assembly types.

Click the Next button and go to step 3.


Step 3: This screen allows you to determine how the imported assemblies should be loaded by the host library at
runtime. There are four load assembly options, namely:

484
.Net Runtime Library for Delphi

a. Load from GAC using Qualified Assembly Name: Selecting this option allows the
host library to load the assembly from the Global Assembly Cache using the qualified
assembly name. Example: System.Data, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=b78a5c561856e089
b. Load from GAC using Partial Assembly Name: Selecting this option allows the host
library to load the assembly from the Global Assembly Cache using the partial name of
the assembly. Considering the above example, instead of specifying the full qualified
name, you can specify only the name of the assembly. Example: System.Data
c. Load from File Location: Selecting this option allows the host library to load the
assembly from the specified file location.
d. Load from EXE location: Selecting this option allows the host library to load the
assembly from the location of the Delphi executing file. You can copy your .net
assembly files to the delphi executable file directory and select this option.

Click the Next button and go to step 4.


Step 4: This screen allows you to specify the directory where the generated Delphi files will be
stored after import. You can also select the option(s) for importing the assembly types. These
options are:

485
.Net Runtime Library for Delphi

a. Separate larger generated Delphi units into different units: Selecting this option
allows the process to automatically separates the delphi unit to be generated into
smaller units if the unit to be generated from the assembly types will be larger and
contains volumnous lines of code making it difficult to debug in delphi.
b. Optimize process: Selecting this option allows the process to perform a number of
delphi code optimization such as excluding public field members of the selected types
to be imported and prevent creating full class definition for types without any
members.
c. Search and include type references in other assemblies to be imported: Selecting
this option allows the process to search for any dependencies in the list of assemblies
to be imported and use the referenced type rather than specifying a default value or
creating a class for the referenced type.

Click the Finish Button to start the process.


After the process is complete, atleast 2 files or delphi units will have been generated for each assembly file imported.
These units are:
 Constant Unit : This delphi unit contains the string constant variables of the assembly
ID, the assembly load option path and the fullnames of the .net assembly types
imported. This unit file name is the combination of the name of the class unit and
Const.

486
.Net Runtime Library for Delphi

The example below shows the content of the constant unit generated from the System.Xml
assembly file.

Delphi

unit SystemXmlUnitConst;

interface

const

sC_SystemXmlUnit_Asm_ID = '4a01b83c-6007-406a-a205-5c348fdb2fdd';

sC_SystemXmlUnit_sC_AssemblyPath = 'System.Xml, Version=4.0.0.0,


Culture=neutral, PublicKeyToken=b77a5c561934e089';

sC_SysXml_XmlDocument = 'System.Xml.XmlDocument';

implementation

end.

 Class Unit(s) : Contains the types and members of the types imported from the .net
assembly file which is represented as classes in this unit. More than one class unit can
be generated if the option "Separate larger generated Delphi units into different
units" is selected and the assembly file to be imported will result in a larger and
voluminous lines of code in a single unit.
The example below shows the content of the Class Unit generated from the System.Xml
assembly file.

487
.Net Runtime Library for Delphi

Delphi

unit SystemXmlUnit;

{$WARN SYMBOL_PLATFORM OFF}

{$WARN HIDING_MEMBER OFF}

interface

uses

CNClrLib.Host, CNClrLib.Core, CNClrLib.Host.Utils, CNClrLib.Xml,


CNClrLib.TypeNames,

SystemXmlUnitConst;

type

{ Forward Declarations }

TXmlDocument = Class;

{ Event Handlers }

TXmlNodeChangedEventHandler = procedure(sender: TClrBaseObject; e:


_XmlNodeChangedEventArgs) of Object;

{ TXmlDocument }

TXmlDocument = Class(TClrBaseObject)

private

FNodeChanged : TXmlNodeChangedEventHandler;

procedure Set_InnerText(Value: String);

function Get_InnerXml: String;

procedure Set_InnerXml(Value: String);

procedure Set_NodeChanged(Value :
TXmlNodeChangedEventHandler);

public

constructor Create;

488
.Net Runtime Library for Delphi

procedure Load(filename: String);

procedure Save(filename: String);

property InnerText: String write Set_InnerText;

property InnerXml: String read Get_InnerXml write


Set_InnerXml;

property NodeChanged: TXmlNodeChangedEventHandler read


FNodeChanged write Set_NodeChanged;

end;

function GetSystemXmlUnitAssembly: TClrAssembly;

implementation

function GetSystemXmlUnitAssembly: TClrAssembly;

begin

Result :=
TClrAssembly.GetRegisterAssembly(sC_SystemXmlUnit_Asm_ID);

end;

{ TXmlDocument }

constructor TXmlDocument.Create;

begin

inherited Create(sC_SysXml_XmlDocument, nil)

end;

procedure TXmlDocument.Load(filename: String);

begin

InvokeMethod('Load', [S_CnClr_System_String], [filename]);

end;

procedure TXmlDocument.Save(filename: String);

begin

489
.Net Runtime Library for Delphi

InvokeMethod('Save', [S_CnClr_System_String], [filename]);

end;

procedure TXmlDocument_NodeChangedHandler(sender: _ClrObject; e:


_ClrEventArgs); stdcall;

var

evtObject: TXmlDocument;

evtArg: _XmlNodeChangedEventArgs;

begin

evtObject :=
TXmlDocument(ClrHostManager.GetRegisteredEventObject(sender));

evtArg := CoXmlNodeChangedEventArgs.Wrap(e.EventArgs);

if Assigned(evtObject) and Assigned(evtObject.FNodeChanged) then

evtObject.FNodeChanged(evtObject, evtArg);

end;

procedure TXmlDocument.Set_NodeChanged(Value :
TXmlNodeChangedEventHandler);

var

stdEvtHandler : TClrEventHandler;

begin

stdEvtHandler := TXmlDocument_NodeChangedHandler;

if @Value <> Nil then

RegisterEventCallBack('NodeChanged', @stdEvtHandler)

else

UnRegisterEventCallBack('NodeChanged', @stdEvtHandler);

FNodeChanged := Value;

end;

procedure TXmlDocument.Set_InnerText(Value: String);

begin

SetPropertyValue('InnerText', Value);

end;

490
.Net Runtime Library for Delphi

function TXmlDocument.Get_InnerXml: String;

begin

Result := GetPropertyValue('InnerXml');

end;

procedure TXmlDocument.Set_InnerXml(Value: String);

begin

SetPropertyValue('InnerXml', Value);

end;

initialization

TClrAssembly.RegisterAssembly(sC_SystemXmlUnit_Asm_ID,
sC_SystemXmlUnit_sC_AssemblyPath, ltGACByFullName);

end.

491
.Net Runtime Library for Delphi

492
.Net Runtime Library for Delphi

 Enums Unit : This delphi unit contains the enumeration types defined in the imported
assembly types. If the assemblies to be imported do not have any enumeration types,
this unit will not be generated. This unit file name is the combination of the name of the
class unit and Enums.

5.2 Import WSDL/XML Webservices


Describes how to import Web Service Description language file/url or XML schema that
describes a web service and generates delphi classes from the types of the imported wsdl
assemblies.

Note

493
.Net Runtime Library for Delphi

Before you can use this utility to generate delphi classes from wsdl assemblies, you
must have Delphi Host Class Library and Delphi Framework Class Library
installed.
Follow the steps below to import WSDL/XML Web Service and generate Delphi Classes
from the imported Wsdl Assemblies:

Step 1: Specify the file or Url location of the Web Service Description Language (WSDL). On this
screen, you have the option to specify the SOAP protocol version that is used to communicate
with the WSDL document or XML Web services. The following are the versions of the SOAP
protocol:

a. Process only WSDL Binding extensions for SOAP 1.1 Protocol : The process
communicates with the service using SOAP 1.1 protocol.
b. Process only WSDL Binding extensions for SOAP 1.2 Protocol : The process
communicates with the service using SOAP 1.2 protocol.
c. Process only WSDL Binding extensions for HTTP POST Protocol : The process
communicates with the service using HTTP POST protocol.
d. Process only WSDL Binding extensions for HTTP GET Protocol : The process
communicates with the service using HTTP GET protocol.
e. Process only WSDL Binding extensions for HTTP SOAP Protocol : The process
communicates with the service using HTTP SOAP protocol.

494
.Net Runtime Library for Delphi

Click the Next button and go to step 2.


Step 2: This screen displays the loaded wsdl assemblies in the WSDL Assembly Names list.
The assemblies on the list can be removed by selecting the assemblies to remove and
subsequently clicking on the remove button .

495
.Net Runtime Library for Delphi

The right part of the screen above displays the properties of the wsdl assemblies to be
imported.

It is recommended to change the unit name of the WSDL assembly since the assembly name of
the wsdl is randomly generated. For instance, the unit name for the wsdl assembly above has
been changed from obmnycr5 to WebService1.

Click the Next button and go to step 3.

Step 3: This screen allows you to specify which types and the members of the types of the wsdl assemblies you want to
import. The members of the type includes the Constructors, Fields, Properties, Methods and Events. In the screen
below, the Service1 type has been selected and atleast one member item has also been selected for each member of
the type.

496
.Net Runtime Library for Delphi

You can change the class names of the assembly types by clicking on the
Modify Class Name button. The screen below will be shown where you
can change the default class names of the assembly types.

497
.Net Runtime Library for Delphi

Click the Next button and go to step 4.

Step 4: This screen allows you to specify the directory where the generated Delphi files will be
stored after import. You can also select the option(s) for importing the assembly types. These
options are:
a. Separate larger generated Delphi units into different units: Selecting this
option allows the process to automatically separates the delphi unit to be
generated into smaller units if the unit to be generated from the assembly
types will be larger and contains volumnous lines of code making it difficult to
debug in delphi.
b. Optimize process: Selecting this option allows the process to perform a
number of delphi code optimization such as excluding public field members of
the selected types to be imported and prevent creating full class definition for
types without any members.
c. Search and include type references in other assemblies to be imported:
Selecting this option allows the process to search for any dependencies in the
list of assemblies to be imported and use the referenced type rather than
specifying a default value or creating a class for the referenced type.

498
.Net Runtime Library for Delphi

Click the Finish Button to start the process.


After the process is complete, atleast 2 files or delphi units will have been generated for each assembly file imported.
These units are:
 Constants Unit : This delphi unit contains the string constant variables of the
assembly ID, the WSDL Url or File Location and the fullnames of
the .net assembly types imported. This unit file name is the combination of the
name of the class unit and Const.
The example below shows the content of the constant unit generated from
the wsdl assembly obmnycr5 .

Delphi

unit WebService1Const;

interface

const

sC_WebService1_Asm_ID = 'a1e3fcac-57aa-40a9-9030-c84c8834c8e5';

sC_WebService1_sC_WSDLLocation =
'http://localhost:14199/Service1.asmx';

sC_Service1 = 'Service1';

implementation

end.

499
.Net Runtime Library for Delphi

 Class Unit(s) : Contains the types and it members imported from the wsdl
assembly. More than one class unit can be generated if the option "Separate
larger generated Delphi units into different units" is selected and the
imported wsdl assembly will result in a larger and voluminous lines of code for
a single unit.
The example below shows the content of the Class Unit generated from the wsdl
Assembly obmnycr5.

Delphi

unit WebService1;

{$WARN SYMBOL_PLATFORM OFF}

{$WARN HIDING_MEMBER OFF}

interface

uses

CNClrLib.Host, WebService1Enums, CNClrLib.EnumTypes,


WebService1Const;

type

{ TService1 }

TService1 = Class(TClrBaseObject)

private

function Get_AllowAutoRedirect: Boolean;

procedure Set_AllowAutoRedirect(Value: Boolean);

public

constructor Create;

function HelloWorld: string;

property AllowAutoRedirect: Boolean read Get_AllowAutoRedirect


write Set_AllowAutoRedirect;

end;

function GetWebService1Assembly: TClrAssembly;

500
.Net Runtime Library for Delphi

implementation

function GetWebService1Assembly: TClrAssembly;

begin

Result := TClrAssembly.GetRegisterAssembly(sC_WebService1_Asm_ID);

end;

{ TService1 }

constructor TService1.Create;

begin

inherited Create(sC_Service1, nil)

end;

function TService1.HelloWorld: string;

begin

Result := InvokeMethod('HelloWorld');

end;

function TService1.Get_AllowAutoRedirect: Boolean;

begin

Result := GetPropertyValue('AllowAutoRedirect');

end;

procedure TService1.Set_AllowAutoRedirect(Value: Boolean);

begin

SetPropertyValue('AllowAutoRedirect', Value);

end;

initialization

TClrAssembly.RegisterAssembly(sC_WebService1_Asm_ID,
sC_WebService1_sC_WSDLLocation, ltWSDL, pnSoap12);

501
.Net Runtime Library for Delphi

end.

502
.Net Runtime Library for Delphi

 Enums Unit : This delphi unit contains the enumeration types defined in the imported
wsdl assembly types. If the assemblies to be imported do not have any enumeration
types, this unit will not be generated. This unit file name is the combination of the name
of the class unit and Enums.

6. Constructor Classes
CoClasses also called COM Classes are static construct that enables you to create instance of the interface type as well
as cast or wrap one instance of the interface type to another.

Methods

Name Description

CreateInstance Use to create an instance of the interface type using the


constructor that best matches the specified parameters

Wrap Use to implicitly or explicitly convert a value of one data type


to another

The coClasses are declared as follows:


Delphi

//Where XXXX is the name of the interface

CoXXXXX = class

class function CreateInstance: _XXXXX; overload;

class function CreateInstance({Parameters}): _XXXXX; overload;


//If the interface has parameter constructor

class function Wrap(Value: OleVariant): _XXXXX;

end;

503
.Net Runtime Library for Delphi

The following example shows how the _ClrObject CoClass is defined:


Delphi

CoClrObject = class

class function CreateInstance: _ClrObject; overload;

class function CreateInstance(Obj: OleVariant): _ClrObject;


overload;

class function CreateInstance(Type_: _Type; Parameters:


_ObjectArray): _ClrObject; overload;

class function CreateInstance(Type_: _Type; GenericTypes:


_TypeArray; Parameters: _ObjectArray): _ClrObject; overload;

class function CreateInstance(Value: WideString): _ClrObject;


overload;

class function CreateInstance(Value: WordBool): _ClrObject;


overload;

class function CreateInstance(Value: Byte): _ClrObject; overload;

class function CreateInstance(Value: ShortInt): _ClrObject;


overload;

class function CreateInstance(Value: _Char): _ClrObject; overload;

class function CreateInstance(Value: _Decimal): _ClrObject;


overload;

class function CreateInstance(Value: Double): _ClrObject;


overload;

class function CreateInstance(Value: Single): _ClrObject;


overload;

class function CreateInstance(Value: Integer): _ClrObject;


overload;

class function CreateInstance(Value: LongWord): _ClrObject;


overload;

class function CreateInstance(Value: Int64): _ClrObject; overload;

class function CreateInstance(Value: Largeuint): _ClrObject;


overload;

class function CreateInstance(Value: SmallInt): _ClrObject;


overload;

504
.Net Runtime Library for Delphi

class function CreateInstance(Value: Word): _ClrObject; overload;

class function Wrap(Value: OleVariant): _ClrObject;

end;

The above coClass shows how to create instances of the _ClrObject interface with different parameters. You can also
wrap an object or interface of any type to _ClrObject interface if and only if the object or interface is inherited from
ClrObject (which is System.Object in C#).

Creating Objects
An object (in C#) which is represented as Interface in delphi is a concrete entity based on the class defined in C# which
is sometimes referred to as an instance of a class (In C#) or an instance of an interface (In Delphi). Objects can be
created by using coClass CreateInstance static method, like this:
Delphi

var

oObject: _ClrObject;

begin

oObject := CoClrObject.CreateInstance;

end.

6.1 CoClasses
CoClasses also called COM Classes are static construct that enables you to create instance of the interface type as well
as cast or wrap one instance of the interface type to another.

Methods

505
.Net Runtime Library for Delphi

Name Description

CreateInstance Use to create an instance of the interface type using the


constructor that best matches the specified parameters

Wrap Use to implicitly or explicitly convert a value of one data type


to another

The coClasses are declared as follows:


Delphi

//Where XXXX is the name of the interface

CoXXXXX = class

class function CreateInstance: _XXXXX; overload;

class function CreateInstance({Parameters}): _XXXXX; overload;


//If the interface has parameter constructor

class function Wrap(Value: OleVariant): _XXXXX;

end;

The following example shows how the _ClrObject CoClass is defined:


Delphi

CoClrObject = class

class function CreateInstance: _ClrObject; overload;

class function CreateInstance(Obj: OleVariant): _ClrObject;


overload;

class function CreateInstance(Type_: _Type; Parameters:


_ObjectArray): _ClrObject; overload;

class function CreateInstance(Type_: _Type; GenericTypes:


_TypeArray; Parameters: _ObjectArray): _ClrObject; overload;

class function CreateInstance(Value: WideString): _ClrObject;


overload;

506
.Net Runtime Library for Delphi

class function CreateInstance(Value: WordBool): _ClrObject;


overload;

class function CreateInstance(Value: Byte): _ClrObject; overload;

class function CreateInstance(Value: ShortInt): _ClrObject;


overload;

class function CreateInstance(Value: _Char): _ClrObject; overload;

class function CreateInstance(Value: _Decimal): _ClrObject;


overload;

class function CreateInstance(Value: Double): _ClrObject;


overload;

class function CreateInstance(Value: Single): _ClrObject;


overload;

class function CreateInstance(Value: Integer): _ClrObject;


overload;

class function CreateInstance(Value: LongWord): _ClrObject;


overload;

class function CreateInstance(Value: Int64): _ClrObject; overload;

class function CreateInstance(Value: Largeuint): _ClrObject;


overload;

class function CreateInstance(Value: SmallInt): _ClrObject;


overload;

class function CreateInstance(Value: Word): _ClrObject; overload;

class function Wrap(Value: OleVariant): _ClrObject;

end;

507
.Net Runtime Library for Delphi

The above coClass shows how to create instances of the _ClrObject interface with different parameters. You can also
wrap an object or interface of any type to _ClrObject interface if and only if the object or interface is inherited from
ClrObject (which is System.Object in C#).

Creating Objects
An object (in C#) which is represented as Interface in delphi is a concrete entity based on the class defined in C# which
is sometimes referred to as an instance of a class (In C#) or an instance of an interface (In Delphi). Objects can be
created by using coClass CreateInstance static method, like this:
Delphi

var

oObject: _ClrObject;

begin

oObject := CoClrObject.CreateInstance;

end.

6.1.1 CreateInstance
This method is accessible from the coClasses of the interfaces defined in the CrystalNet Class
Library. It is use to create an instance of the interface type using the constructor that best
matches the specified parameters.The constructor to be invoked must be accessible.

Example
The following code example demonstrates how to call the
parameterless CreateInstance method on the following interface
coClasses and display their default value.

Delphi

program CreateInstanceList;

{$APPTYPE CONSOLE}

{$R *.res}

508
.Net Runtime Library for Delphi

uses

CNClrLib.Core;

var

Console: _Console;

oEventArgs: _EventArgs;

oRandom: _Random;

oException: _Exception;

oObject: _ClrObject;

begin

// Creating instance of Console Interface

Console := CoConsole.CreateInstance;

Console.WriteLine_14('Creating instance of
EventArgs Interface');

oEventArgs := CoEventArgs.CreateInstance;

Console.WriteLine_14('Creating instance of
Random Interface');

oRandom := CoRandom.CreateInstance;

Console.WriteLine_14('Creating instance of
Exception Interface');

oException := CoException.CreateInstance;

509
.Net Runtime Library for Delphi

// The ClrObject interface instance created with


the parameterless CreatInstance

// method internally creates System.Object


instance and wrap the object created;

Console.WriteLine_14('Creating instance of
ClrObject Interface');

oObject := CoClrObject.CreateInstance;

Console.WriteLine;

Console.WriteLine_14('EventArgs Instance''s
default values:');

Console.WriteLine_15('Type: {0}',
oEventArgs.GetType.FullName);

Console.WriteLine_15('Value: {0}',
oEventArgs.ToString);
Console.WriteLine_15('HashCode: {0}',
oEventArgs.GetHashCode);

Console.WriteLine;

Console.WriteLine_14('Random Instance''s default


values:');
Console.WriteLine_15('Type: {0}',
oRandom.GetType.FullName);
Console.WriteLine_15('Value: {0}',
oRandom.ToString);

Console.WriteLine_15('HashCode: {0}',
oRandom.GetHashCode);

510
.Net Runtime Library for Delphi

Console.WriteLine;

Console.WriteLine_14('Exception Instance''s
default values:');

Console.WriteLine_15('Type: {0}',
oException.GetType.FullName);

Console.WriteLine_15('Value: {0}',
oException.ToString);

Console.WriteLine_15('HashCode: {0}',
oException.GetHashCode);

Console.WriteLine;

Console.WriteLine_14('ClrObject/Object
Instance''s default values:');

Console.WriteLine_15('Type: {0}',
oObject.GetType.FullName);
Console.WriteLine_15('Value: {0}',
oObject.ToString);

Console.WriteLine_15('HashCode: {0}',
oObject.GetHashCode);

Console.ReadKey;

end.

// This program will display output similar to the


following:

// Creating instance of EventArgs Interface

// Creating instance of Random Interface

// Creating instance of Exception Interface

511
.Net Runtime Library for Delphi

// Creating instance of ClrObject Interface

//

// EventArgs Instance's default values:

// Type: System.EventArgs

// Value: System.EventArgs

// HashCode: 33476626

//

// Random Instance's default values:

// Type: System.Random

// Value: System.Random

// HashCode: 32854180

//

// Exception Instance's default values:

// Type: System.Exception
// Value: System.Exception: Exception of type
'System.Exception' was thrown.

// HashCode: 27252167

//

// ClrObject/Object Instance's default values:

// Type: System.Object

// Value: System.Object

// HashCode: 43942917

6.1.2 Wrap
This method is use to explicitly convert a value of one data type to another or invoke implicit
conversion from one type to another.

512
.Net Runtime Library for Delphi

Examples
The Example below demonstrates how to wrap tthrough casting a derived interface type to the
base type.

Delphi

var

obaseExc: _Exception;

argumentExc: _ArgumentException;

begin

// Create a new derived type.

argumentExc := CoArgumentException.CreateInstance;

// Conversion to the base type

obaseExc := CoException.Wrap(argumentExc);

// Explicit conversion is required to cast back

// to derived type. This is done using the same method

argumentExc := CoArgumentException.Wrap(obaseExc)

end.

The Example below demonstrates how to explicitly convert an integer value to a decimal
interface type.

Delphi

var

oDecimal: _Decimal;

oInt32: Integer;

513
.Net Runtime Library for Delphi

begin

// NB: Create instance of Console Interface Type

// To convert integer value to decimal object, you can use the wrap
method of the

// _Decimal interface.

oInt32 := 45;

oDecimal := CoDecimal.Wrap(oInt32);

Console.WriteLine_15('Convert Integer value ''45'' to Decimal value


using the Wrap method, '+

'the Decimal value is {0}.', oDecimal);

end.

7. Symbol Reference
In This Section
Host Class Library

This Library contains classes and interfaces for starting and hostimg the .Net Comman
Language Runtime.

Delphi Framework Class Library

The Delphi Framework Class Library is an interface representation of the .NET Framework class
library which is a collection of reusable interface types that tightly integrate with the common
language runtime.

7.1 CrystalNet Class Libraries


In This Section
Host Class Library

This Library contains classes and interfaces for starting and hostimg the .Net Comman
Language Runtime.

Delphi Framework Class Library

The Delphi Framework Class Library is an interface representation of the .NET Framework class
library which is a collection of reusable interface types that tightly integrate with the common
language runtime.

514
.Net Runtime Library for Delphi

7.1.1 Host Class Library


This Library contains classes and interfaces for starting and hosting the .Net Comman Language
Runtime.

Namespaces

Name Description

Comp The CNClrLib.Comp namespace provides container class for


hosting .Net Controls.

Core The CNClrLib.Core namespace contains interfaces that define


the core of the CLR. It contains interfaces of all classes
defined in the microsoft common object runtime library
(mscorlib). The namespace contains all the types that
provide a managed view of loaded types, methods, and
fields, and that can dynamically create and invoke types.
These types are defined in System.Reflection in the .Net
Framework Class library. The namespace also contains
interfaces of the tpes defined in System.Globalization of the
.Net library which define culture-related information,
including language, country/region, calendars in use, format
patterns for dates, currency, and numbers, and sort order for
strings. These classes are useful for writing globalized
(internationalized) applications.

DynamicLinq The CNClrLib.Dynamic namespace provides interfaces that support


Execution of Lambda expressions defined in a string against Entity
Framework or any provider that supports IQueryable.

Enums This CNClrLib.Enums namespace contains set of named


integer constants which represents all the .Net framework
class library enumeration types.

EnumArrays This CNClrLib.EnumArrays namespace contains arrays used


to map the delphi enumeration types defined in
CNClrLib.EnumTypes to it equivalent types defined as
TOleEnum constants in CNClrLib.Enums .

EnumFunc This CNClrLib.EnumFunc namespace contains functions for converting


between delphi set of enumeration types defined in
CNClrLib.EnumTypes and it equivalent TOleEnum constant types
defined in CNClrLib.Enums and vice-versa.

EnumTypes This CNClrLib.EnumTypes namespace contains delphi


enumeration equivalent of the .Net framework class library

515
.Net Runtime Library for Delphi

Name Description

enumeration types defined as TOleEnum constants in


CNClrLib.Enums.

Host The CNClrLib.Host namespace contains classes for starting and


hosting the .Net CLR. It also contains classes to load .net assembly
files, view loaded types, methods, properties and fields, and
dynamically create and invoke types. The Host Helper namespace
contains classes that allow for conversion between delphi and .net
data types.

TypeNames This CNClrLib.TypeNames namespace contains the list of types names


of all the CLR wrapper classes.

7.1.1.1 CNClrLib.Comp Namespace


The CNClrLib.Dynamic namespace provides interfaces that support Execution of Lambda expressions defined in a string
against Entity Framework or any provider that supports IQueryable.

Classes

Name Description

TClrContainer Used to group collections of .net controls programmatically.

TClrForm Provides CLR Support for a TForm object

Interfaces

Name Description

IVCLFrameForm This is class CNClrLib.Comp.IVCLFrameForm.

Enumeration Types

Name Description

TAutoSizeMode Specifies how a control will behave when its AutoSize property is
enabled.

TObjectState This is record CNClrLib.Comp.TObjectState.

TSizeMode This is record CNClrLib.Comp.TSizeMode.

516
.Net Runtime Library for Delphi

7.1.1.1.1 Classes
The following table lists classes defined in the CNClrLib.Comp Namespace.

Classes

Name Description

TClrContainer Used to group collections of .net controls programmatically.

TClrForm Provides CLR Support for a TForm object

7.1.1.1.1.1 TClrContainer Class


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer Class
Collapse All Expand All

Used to group collections of .net controls programmatically.

Inheritance Hierarchy
CNClrLib.Comp.TClrContainer

File: CNClrLib.Comp.pas

Namespace: CNClrLib.Comp

Syntax
Delphi

TClrContainer = class(TCustomControl, IUnknown);

Constructors

Name Description

Create Creates and initializes an instance of TClrContainer.

Destructors

517
.Net Runtime Library for Delphi

Name Description

Destroy Destroys an instance of TClrContainer.

Methods

Show: Protected

No members matching the current filter

Name Description

AddClrControl(Variant) Adds the specified control as variant (interface) to


the ClrContainer.

AddClrControl(_Control) Adds the specified control as _Control interface to


the ClrContainer.

AddRangeClrControls(_ControlArray) Adds an array of control objects to the


ClrContainer.

AddRangeClrControls(array of Adds an array of control objects to the


_Control) ClrContainer.

Contains(Variant) Determines whether the specified control as


variant (interface) is a member of the children
controls in ClrContainer.

Contains(_Control) Determines whether the specified control as


_Control interface is a member of the children
controls in ClrContainer.

GetClrControls Gets the collection of .net controls on the


ClrContainer.

HasChildren Gets a value indicating whether the control


contains one or more child controls.

Invalidate Schedules a control repaint. Invalidates the entire


surface of the control and causes the control to be redrawn.

PerformAutoScale Performs scaling of the container control and its children.

PerformLayout Performs scaling of the container control and its children.

518
.Net Runtime Library for Delphi

Name Description

QueryInterface Returns a reference to a specified interface if the


object supports that interface.

Refresh Repaints the control on the screen.

ResetBackColor Resets the BackColor property to its default value.

ResetCursor Resets the Cursor property to its default value.

ResetFont Resets the Font property to its default value.

ResetForeColor Resets the ForeColor property to its default value.

ResumeLayout Resumes usual layout logic.

SuspendLayout Temporarily suspends the layout logic for the control.

Update Causes the control to redraw the invalidated regions within


its client area.

ValidateChildren Causes all of the child controls within a control that support
validation to validate their data.

Properties

Name Description

ActiveControl Gets or sets the active control on the container control.

AutoScroll Gets or sets a value indicating whether the container enables


the user to scroll to any controls placed outside of its visible
boundaries.

AutoSize Specifies whether the control sizes itself automatically to


accommodate its contents.

AutoSizeMode Gets or sets how the control will resize itself.

DefaultInterface The default interface of the ClrContainer class.

SizeMode Determines how the CLR control is sized in the Clrcontainer.

See Also

519
.Net Runtime Library for Delphi

TClrContainer Methods
TClrContainer Properties

7.1.1.1.1.1.1 TClrContainer.Create Constructor


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.Create Constructor
Creates and initializes an instance of TClrContainer.

Syntax
Delphi

constructor Create(AOwner: TComponent); override;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.2 TClrContainer.Destroy Destructor


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.Destroy Destructor
Destroys an instance of TClrContainer.

Syntax
Delphi

destructor Destroy; override;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.3 TClrContainer Methods


Contents Index
.Net Runtime Library for Delphi
CLOSE

520
.Net Runtime Library for Delphi

TClrContainer Methods
The methods of the TClrContainer class are listed here.

Methods

Show: Protected

No members matching the current filter

Name Description

AddClrControl(Variant) Adds the specified control as variant (interface) to


the ClrContainer.

AddClrControl(_Control) Adds the specified control as _Control interface to


the ClrContainer.

AddRangeClrControls(_ControlArray) Adds an array of control objects to the


ClrContainer.

AddRangeClrControls(array of Adds an array of control objects to the


_Control) ClrContainer.

Contains(Variant) Determines whether the specified control as


variant (interface) is a member of the children
controls in ClrContainer.

Contains(_Control) Determines whether the specified control as


_Control interface is a member of the children
controls in ClrContainer.

GetClrControls Gets the collection of .net controls on the


ClrContainer.

HasChildren Gets a value indicating whether the control


contains one or more child controls.

Invalidate Schedules a control repaint. Invalidates the entire


surface of the control and causes the control to be redrawn.

PerformAutoScale Performs scaling of the container control and its children.

PerformLayout Performs scaling of the container control and its children.

521
.Net Runtime Library for Delphi

Name Description

QueryInterface Returns a reference to a specified interface if the


object supports that interface.

Refresh Repaints the control on the screen.

ResetBackColor Resets the BackColor property to its default value.

ResetCursor Resets the Cursor property to its default value.

ResetFont Resets the Font property to its default value.

ResetForeColor Resets the ForeColor property to its default value.

ResumeLayout Resumes usual layout logic.

SuspendLayout Temporarily suspends the layout logic for the control.

Update Causes the control to redraw the invalidated regions within


its client area.

ValidateChildren Causes all of the child controls within a control that support
validation to validate their data.

7.1.1.1.1.1.3.1 AddClrControl Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

AddClrControl Method
This is the overview for the AddClrControl method overload.

Overload List

Name Description

TClrContainer.AddClrControl Adds the specified control as variant (interface) to the


(Variant) ClrContainer.

TClrContainer.AddClrControl Adds the specified control as _Control interface to the


(_Control) ClrContainer.

522
.Net Runtime Library for Delphi

7.1.1.1.1.1.3.1.1 TClrContainer.AddClrControl Method (Variant)


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.AddClrControl Method (Variant)


Adds the specified control as variant (interface) to the ClrContainer.

Syntax
Delphi

procedure AddClrControl(AControl: Variant); overload;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.3.1.2 TClrContainer.AddClrControl Method (_Control)


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.AddClrControl Method (_Control)


Adds the specified control as _Control interface to the ClrContainer.

Syntax
Delphi

procedure AddClrControl(AControl: _Control); overload;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.3.2 AddRangeClrControls Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

AddRangeClrControls Method
This is the overview for the AddRangeClrControls method overload.

523
.Net Runtime Library for Delphi

Overload List

Name Description

TClrContainer.AddRangeClrControls Adds an array of control objects to the ClrContainer.


(_ControlArray)

TClrContainer.AddRangeClrControls Adds an array of control objects to the ClrContainer.


(array of _Control)

7.1.1.1.1.1.3.2.1 TClrContainer.AddRangeClrControls Method (_ControlArray)


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.AddRangeClrControls Method
(_ControlArray)
Adds an array of control objects to the ClrContainer.

Syntax
Delphi

procedure AddRangeClrControls(AControls: _ControlArray); overload;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.3.2.2 TClrContainer.AddRangeClrControls Method (array of _Control)


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.AddRangeClrControls Method
(array of _Control)
Adds an array of control objects to the ClrContainer.

Syntax
Delphi

524
.Net Runtime Library for Delphi

procedure AddRangeClrControls(AControls: array of _Control); overload;

See Also
TClrContainer Class
CNClrLib.Comp Names pace

7.1.1.1.1.1.3.3 Contains Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

Contains Method
This is the overview for the Contains method overload.

Overload List

Name Description

TClrContainer.Contains Determines whether the specified control as variant


(Variant) (interface) is a member of the children controls in
ClrContainer.

TClrContainer.Contains Determines whether the specified control as _Control


(_Control) interface is a member of the children controls in
ClrContainer.

7.1.1.1.1.1.3.3.1 TClrContainer.Contains Method (Variant)


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.Contains Method (Variant)


Determines whether the specified control as variant (interface) is a member of the children
controls in ClrContainer.

Syntax
Delphi

function Contains(AControl: Variant): Boolean; overload;

See Also

525
.Net Runtime Library for Delphi

TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.3.3.2 TClrContainer.Contains Method (_Control)


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.Contains Method (_Control)


Determines whether the specified control as _Control interface is a member of the children
controls in ClrContainer.

Syntax
Delphi

function Contains(AControl: _Control): Boolean; overload;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.3.4 TClrContainer.GetClrControls Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.GetClrControls Method
Gets the collection of .net controls on the ClrContainer.

Syntax
Delphi

function GetClrControls: _Control_ControlCollection;

See Also
TClrContainer Class
CNClrLib.Comp Names pace

7.1.1.1.1.1.3.5 TClrContainer.HasChildren Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

526
.Net Runtime Library for Delphi

TClrContainer.HasChildren Method
Gets a value indicating whether the control contains one or more child controls.

Syntax
Delphi

function HasChildren: WordBool;

See Also
TClrContainer Class
CNClrLib.Co mp Namespace

7.1.1.1.1.1.3.6 TClrContainer.Invalidate Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.Invalidate Method
Schedules a control repaint. Invalidates the entire surface of the control and causes the control
to be redrawn.

Syntax
Delphi

procedure Invalidate; override;

See Also
TClrContainer Class
CNClrLib.Comp Namespa ce

7.1.1.1.1.1.3.7 TClrContainer.PerformAutoScale Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.PerformAutoScale Method
Performs scaling of the container control and its children.

Syntax
Delphi

procedure PerformAutoScale;

527
.Net Runtime Library for Delphi

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.3.8 TClrContainer.PerformLayout Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.PerformLayout Method
Performs scaling of the container control and its children.

Syntax
Delphi

procedure PerformLayout;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.3.9 TClrContainer.QueryInterface Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.QueryInterface Method
Returns a reference to a specified interface if the object supports that interface.

Syntax
Delphi

function QueryInterface(const IID: TGUID; out Obj): HResult; override;


stdcall;

See Also
TClrContainer Class
CNClrLib.Comp Na mespace

7.1.1.1.1.1.3.10 TClrContainer.Refresh Method


.Net Runtime Library for Delphi Contents Index

528
.Net Runtime Library for Delphi

CLOSE

TClrContainer.Refresh Method
Repaints the control on the screen.

Syntax
Delphi

procedure Refresh;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.3.11 TClrContainer.ResetBackColor Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.ResetBackColor Method
Resets the BackColor property to its default value.

Syntax
Delphi

procedure ResetBackColor;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.3.12 TClrContainer.ResetCursor Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.ResetCursor Method
Resets the Cursor property to its default value.

Syntax
Delphi

529
.Net Runtime Library for Delphi

procedure ResetCursor;

See Also
TClrContainer Class
CNClrLib.Comp Names pace

7.1.1.1.1.1.3.13 TClrContainer.ResetFont Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.ResetFont Method
Resets the Font property to its default value.

Syntax
Delphi

procedure ResetFont;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.3.14 TClrContainer.ResetForeColor Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.ResetForeColor Method
Resets the ForeColor property to its default value.

Syntax
Delphi

procedure ResetForeColor;

See Also
TClrContainer Class
CNClrLib.Comp Namespac e

7.1.1.1.1.1.3.15 TClrContainer.ResumeLayout Method


.Net Runtime Library for Delphi Contents Index

530
.Net Runtime Library for Delphi

CLOSE

TClrContainer.ResumeLayout Method
Resumes usual layout logic.

Syntax
Delphi

procedure ResumeLayout(APerformLayout: Boolean = True);

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.3.16 TClrContainer.SuspendLayout Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.SuspendLayout Method
Temporarily suspends the layout logic for the control.

Syntax
Delphi

procedure SuspendLayout;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.3.17 TClrContainer.Update Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.Update Method
Causes the control to redraw the invalidated regions within its client area.

Syntax
Delphi

531
.Net Runtime Library for Delphi

procedure Update; override;

See Also
TClrContainer Class
CNClrLib.Comp Name space

7.1.1.1.1.1.3.18 TClrContainer.ValidateChildren Method


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.ValidateChildren Method
Causes all of the child controls within a control that support validation to validate their data.

Syntax
Delphi

procedure ValidateChildren;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.4 TClrContainer Properties


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer Properties
The properties of the TClrContainer class are listed here.

Properties

Name Description

ActiveControl Gets or sets the active control on the container control.

AutoScroll Gets or sets a value indicating whether the container enables


the user to scroll to any controls placed outside of its visible
boundaries.

AutoSize Specifies whether the control sizes itself automatically to

532
.Net Runtime Library for Delphi

Name Description

accommodate its contents.

AutoSizeMode Gets or sets how the control will resize itself.

DefaultInterface The default interface of the ClrContainer class.

SizeMode Determines how the CLR control is sized in the Clrcontainer.

7.1.1.1.1.1.4.1 TClrContainer.ActiveControl Property


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.ActiveControl Property
Gets or sets the active control on the container control.

Syntax
Delphi

property ActiveControl: _Control;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.4.2 TClrContainer.AutoScroll Property


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.AutoScroll Property
Gets or sets a value indicating whether the container enables the user to scroll to any controls
placed outside of its visible boundaries.

Syntax
Delphi

property AutoScroll: Boolean;

533
.Net Runtime Library for Delphi

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.4.3 TClrContainer.AutoSize Property


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.AutoSize Property
Specifies whether the control sizes itself automatically to accommodate its contents.

Syntax
Delphi

property AutoSize: Boolean;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.4.4 TClrContainer.AutoSizeMode Property


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.AutoSizeMode Property
Gets or sets how the control will resize itself.

Syntax
Delphi

property AutoSizeMode: TAutoSizeMode;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.4.5 TClrContainer.DefaultInterface Property


.Net Runtime Library for Delphi Contents Index

534
.Net Runtime Library for Delphi

CLOSE

TClrContainer.DefaultInterface Property
The default interface of the ClrContainer class.

Syntax
Delphi

property DefaultInterface: _ClrContainer;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.1.4.6 TClrContainer.SizeMode Property


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrContainer.SizeMode Property
Determines how the CLR control is sized in the Clrcontainer.

Syntax
Delphi

property SizeMode: TSizeMode;

See Also
TClrContainer Class
CNClrLib.Comp Namespace

7.1.1.1.1.2 TClrForm Class


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrForm Class
Collapse All Expand All

Provides CLR Support for a TForm object.

Inheritance Hierarchy

535
.Net Runtime Library for Delphi

CNClrLib.Comp.IVCLFrameForm

CNClrLib.Comp.TClrForm

File: CNClrLib.Comp.pas

Namespace: CNClrLib.Comp

Syntax
Delphi

TClrForm = class(TInterfacedObject, IOleForm, IOleWindow,


IVCLFrameForm);

Constructors

Name Description

Create Create creates a new instance of the TClrForm object.

Destructors

Name Description

Destroy Destroy frees the memory associated with this instance of


the TClrForm object.

7.1.1.1.1.2.1 TClrForm.Create Constructor


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrForm.Create Constructor
Create creates a new instance of the TClrForm object.

Syntax
Delphi

constructor Create(Form: TCustomForm);

See Also
TClrForm Class
CNClrLib.Comp Namespace

536
.Net Runtime Library for Delphi

7.1.1.1.1.2.2 TClrForm.Destroy Destructor


Contents Index
.Net Runtime Library for Delphi
CLOSE

TClrForm.Destroy Destructor
Destroy frees the memory associated with this instance of the TClrForm object.

Syntax
Delphi

destructor Destroy; override;

See Also
TClrForm Class
CNClrLib.Comp Namespace

7.1.1.1.2 Interfaces
The following table lists interfaces defined in the CNClrLib.Comp Namespace.

Interfaces

Name Description

IVCLFrameForm This is class CNClrLib.Comp.IVCLFrameForm.

7.1.1.1.2.1 IVCLFrameForm Interface


Contents Index
.Net Runtime Library for Delphi
CLOSE

IVCLFrameForm Interface
This is Interface CNClrLib.Comp.IVCLFrameForm.

Inheritance Hierarchy
CNClrLib.Comp.IVCLFrameForm

File: CNClrLib.Comp.pas

Namespace: CNClrLib.Comp

537
.Net Runtime Library for Delphi

Syntax
Delphi

IVCLFrameForm = interface

7.1.1.1.3 Enumeration Types


The following table lists structs, records, enums defined in the CNClrLib.Comp Namespace.

Enumeration Types

Name Description

TAutoSizeMode Specifies how a control will behave when its AutoSize property is
enabled.

TObjectState This is record CNClrLib.Comp.TObjectState.

TSizeMode This is record CNClrLib.Comp.TSizeMode.

7.1.1.1.3.1 CNClrLib.Comp.TAutoSizeMode Enumeration


Contents Index
.Net Runtime Library for Delphi
CLOSE

CNClrLib.Comp.TAutoSizeMode Enumeration
Specifies how a control will behave when its AutoSize property is enabled.

File: CNClrLib.Comp.pas

Namespace: CNClrLib.Comp

Syntax
Delphi

TAutoSizeMode = (

asmGrowAndShrink = 0,

asmGrowOnly = 1

);

7.1.1.1.3.2 CNClrLib.Comp.TObjectState Enumeration


.Net Runtime Library for Delphi Contents Index

538
.Net Runtime Library for Delphi

CLOSE

CNClrLib.Comp.TObjectState Enumeration
This is record CNClrLib.Comp.TObjectState.

File: CNClrLib.Comp.pas

Namespace: CNClrLib.Comp

Syntax
Delphi

TObjectState = (

osEmpty,

osCreated

);

7.1.1.1.3.3 CNClrLib.Comp.TSizeMode Enumeration


Contents Index
.Net Runtime Library for Delphi
CLOSE

CNClrLib.Comp.TSizeMode Enumeration
This is record CNClrLib.Comp.TSizeMode.

File: CNClrLib.Comp.pas

Namespace: CNClrLib.Comp

Syntax
Delphi

TSizeMode = (

smClip,

smCenter,

smScale,

smStretch,

smAutoSize

);

539
.Net Runtime Library for Delphi

7.1.1.2 CNClrLib.Core Namespace


The CNClrLib.Core namespace contains interfaces that define the core of the CLR. It contains
interfaces of all classes defined in the microsoft common object runtime library (mscorlib). The
namespaces contain all the types that provide a managed view of loaded types, methods, and
fields, and that can dynamically create and invoke types. These types are defined in
System.Reflection in the .Net Framework Class library. The namespace also contains interfaces
of the tpes defined in System.Globalization of the .Net library which define culture-related
information, including language, country/region, calendars in use, format patterns for dates,
currency, and numbers, and sort order for strings. These classes are useful for writing globalized
(internationalized) applications.

Some of the interfaces defined in the CNClrLib.Core.Intf are defined as classes or interfaces in
the following C# Class Library Namespaces:

 System
 System.Collections
 System.Collections.Generic
 System.Collections.ObjectModel
 System.ComponentModel
 System.Deployment.Internal
 System.Diagnostics
 System.Diagnostics.CodeAnalysis
 System.Diagnostics.Contracts
 System.Diagnostics.SymbolStore
 System.Diagnostics.Tracing
 System.Globalization
 System.IO
 System.IO.IsolatedStorage
 System.Reflection
 System.Resources
 System.Runtime
 System.Security
 System.Text
 System.Threading
 Microsoft.Win32
Other Interfaces

Name Description

_ClrDataTypeHelper Contains helper interfaces for the .Net Data Types.

_ClrEventArgs Represents the wrapper interface for .net objects that contain event
data, and provides a value to use for events that do not include event
data.

540
.Net Runtime Library for Delphi

Name Description

_ClrEventCallbacks This is CharHelper, a member of class _ClrDataTypeHelper.

_ClrEventHander Represents the method that will handle an event when the event
provides data.

_ClrHost Contains methods for starting and hosting the .Net Framework
Common Language Runtime.

_ClrObject This is an interface that can store different kinds of data types.

_ClrWSDL Contains methods to build and convert XML Web Services into a
.net assembly.

_Exception Represents errors that occur during application execution . For more
information , see C# Exception Class.

_IClrObject This is the base interface which all the CrystalNet .Net
Runtuime Library classes inherit. All the dispatch interfaces
in the Class library inherits from _IClrObject and can be cast
to this interface type.

For Examples, go to How to: Section.

7.1.1.2.1 CNClrLib.Core.Intf Namespace


The CNClrLib.Core namespace contains interfaces that define the core of the CLR. It contains
interfaces of all classes defined in the microsoft common object runtime library (mscorlib). The
namespaces contain all the types that provide a managed view of loaded types, methods, and
fields, and that can dynamically create and invoke types. These types are defined in
System.Reflection in the .Net Framework Class library. The namespace also contains interfaces
of the tpes defined in System.Globalization of the .Net library which define culture-related
information, including language, country/region, calendars in use, format patterns for dates,
currency, and numbers, and sort order for strings. These classes are useful for writing globalized
(internationalized) applications.

Some of the interfaces defined in the CNClrLib.Core.Intf are defined as classes or interfaces in
the following C# Class Library Namespaces:

 System
 System.Collections
 System.Collections.Generic
 System.Collections.ObjectModel
 System.ComponentModel
 System.Deployment.Internal
 System.Diagnostics

541
.Net Runtime Library for Delphi

 System.Diagnostics.CodeAnalysis
 System.Diagnostics.Contracts
 System.Diagnostics.SymbolStore
 System.Diagnostics.Tracing
 System.Globalization
 System.IO
 System.IO.IsolatedStorage
 System.Reflection
 System.Resources
 System.Runtime
 System.Security
 System.Text
 System.Threading
 Microsoft.Win32
Other Interfaces

Name Description

_ClrDataTypeHelper Contains helper interfaces for the .Net Data Types.

_ClrEventArgs Represents the wrapper interface for .net objects that contain event
data, and provides a value to use for events that do not include event
data.

_ClrEventCallbacks This is CharHelper, a member of class _ClrDataTypeHelper.

_ClrEventHander Represents the method that will handle an event when the event
provides data.

_ClrHost Contains methods for starting and hosting the .Net Framework
Common Language Runtime.

_ClrObject This is an interface that can store different kinds of data types.

_ClrWSDL Contains methods to build and convert XML Web Services into a
.net assembly.

_Exception Represents errors that occur during application execution . For more
information , see C# Exception Class.

_IClrObject This is the base interface which all the CrystalNet .Net
Runtuime Library classes inherit. All the dispatch interfaces
in the Class library inherits from _IClrObject and can be cast
to this interface type.

For Examples, go to How to: Section.

542
.Net Runtime Library for Delphi

7.1.1.2.1.1 Interfaces
The CNClrLib.Core namespace contains interfaces that define the core of the CLR. It contains
interfaces of all classes defined in the microsoft common object runtime library (mscorlib). The
namespaces contain all the types that provide a managed view of loaded types, methods, and
fields, and that can dynamically create and invoke types. These types are defined in
System.Reflection in the .Net Framework Class library. The namespace also contains interfaces
of the tpes defined in System.Globalization of the .Net library which define culture-related
information, including language, country/region, calendars in use, format patterns for dates,
currency, and numbers, and sort order for strings. These classes are useful for writing globalized
(internationalized) applications.

Some of the interfaces defined in the CNClrLib.Core.Intf are defined as classes or interfaces in
the following C# Class Library Namespaces:

 System
 System.Collections
 System.Collections.Generic
 System.Collections.ObjectModel
 System.ComponentModel
 System.Deployment.Internal
 System.Diagnostics
 System.Diagnostics.CodeAnalysis
 System.Diagnostics.Contracts
 System.Diagnostics.SymbolStore
 System.Diagnostics.Tracing
 System.Globalization
 System.IO
 System.IO.IsolatedStorage
 System.Reflection
 System.Resources
 System.Runtime
 System.Security
 System.Text
 System.Threading
 Microsoft.Win32
Other Interfaces

Name Description

_ClrDataTypeHelper Contains helper interfaces for the .Net Data Types.

_ClrEventArgs Represents the wrapper interface for .net objects that contain event
data, and provides a value to use for events that do not include event
data.

543
.Net Runtime Library for Delphi

Name Description

_ClrEventCallbacks This is CharHelper, a member of class _ClrDataTypeHelper.

_ClrEventHander Represents the method that will handle an event when the event
provides data.

_ClrHost Contains methods for starting and hosting the .Net Framework
Common Language Runtime.

_ClrObject This is an interface that can store different kinds of data types.

_ClrWSDL Contains methods to build and convert XML Web Services into a
.net assembly.

_Exception Represents errors that occur during application execution . For more
information , see C# Exception Class.

_IClrObject This is the base interface which all the CrystalNet .Net
Runtuime Library classes inherit. All the dispatch interfaces
in the Class library inherits from _IClrObject and can be cast
to this interface type.

For Examples, go to How to: Section.

7.1.1.2.1.1.1 _ClrDataTypeHelper Interface


Collapse All Expand All

Contains helper interfaces for the .Net Data Types.

Inheritance Hierarchy
CNClrLib.Core.Intf._ClrDataTypeHelper

File: CNClrLib.Core.Intf.pas

Namespace: CNClrLib.Core.Intf

Syntax
Delphi

_ClrDataTypeHelper = dispinterface;

Methods

Name Description

544
.Net Runtime Library for Delphi

Name Description

BooleanHelper Represents Boolean Helper interface.

ByteHelper Represents Byte Helper interface.

CharHelper Represents Character Helper interface.

DateTimeHelper Represents DateTime Helper interface.

DecimalHelper Represents Decimal Helper interface.

DeepClone Clone the specified clrobject value.

DoubleHelper Represents Double Helper interface.

FromInterface Converts the specified object value to ClrObject.

GuidHelper Represents Guid Helper interface.

Int16Helper Represents Int16 Helper interface.

Int32Helper Represents Int32 Helper interface.

Int64Helper Represents Int64 Helper interface.

IntPtrHelper Represents IntPtr Helper interface.

SByteHelper Represents SByte Helper interface.

SingleHelper Represents Single Helper interface.

StringHelper Represents String Helper interface.

UInt16Helper Represents UInt16 Helper interface.

UInt32Helper Represents UInt32 Helper interface.

UInt64Helper Represents UInt64 Helper interface.

Properties

Name Description

545
.Net Runtime Library for Delphi

Name Description

BooleanArrayType Returns Boolean Array Type.

BooleanArrayTypeSig Returns fullname of Boolean Array Type.

BooleanType Returns Boolean Type.

BooleanTypeSig Returns fullname of Boolean Type.

ByteArrayType Returns Byte Array Type.

ByteArrayTypeSig Returns fullname of Byte Array Type.

ByteType Returns Byte Type.

ByteTypeSig Returns fullname of Byte Type.

CharType Returns Character Type.

CharTypeSig Returns fullname of Character Type.

ClrCharType Returns Wrapper Character Type.

ClrCharTypeSig Returns fullname of Wrapper Character Type.

ClrDecimalType Returns Wrapper Decimal Type.

ClrDecimalTypeSig Returns fullname of Wrapper Decimal Type.

ClrObjectArrayType Returns Wrapper Object Array Type.

ClrObjectArrayTypeSig Returns fullname of Wrapper Object Array Type.

ClrObjectType Returns Wrapper Object Type.

ClrObjectTypeSig Returns fullname of Wrapper Object Type.

DateTimeArrayType Returns DateTime Array Type.

DateTimeArrayTypeSig Returns fullname of DateTime Array Type.

DateTimeType Returns DateTime Type.

546
.Net Runtime Library for Delphi

Name Description

DateTimeTypeSig Returns fullname of DateTime Type.

DecimalType Returns Decimal Type.

DecimalTypeSig Returns fullname of Decimal Type.

DoubleArrayType Returns Double Array Type.

DoubleArrayTypeSig Returns fullname of Double Array Type.

DoubleType Returns Double Type.

DoubleTypeSig Returns fullname of Double Type.

Int16ArrayType Returns Int16 Array Type.

Int16ArrayTypeSig Returns fullname of Int16 Array Type.

Int16Type Returns Int16 Type.

Int16TypeSig Returns fullname of Int16 Type.

Int32ArrayType Returns Int32 Array Type.

Int32ArrayTypeSig Returns fullname of Int32 Array Type.

Int32Type Returns Int32 Type.

Int32TypeSig Returns fullname of Int32 Type.

Int64ArrayType Returns Int64 Array Type.

Int64ArrayTypeSig Returns fullname of Int64 Array Type.

Int64Type Returns Int64 Type.

Int64TypeSig Returns fullname of Int64 Type.

ObjectArrayType Returns Object Array Type.

ObjectArrayTypeSig Returns fullname of Object Array Type.

547
.Net Runtime Library for Delphi

Name Description

ObjectType Returns Object Type.

ObjectTypeSig Returns fullname of Object Type.

SByteArrayType Returns SByte Array Type.

SByteArrayTypeSig Returns fullname of SByte Array Type.

SByteType Returns SByte Type.

SByteTypeSig Returns fullname of SByte Type.

SingleArrayType Returns Single Array Type.

SingleArrayTypeSig Returns fullname of Single Array Type.

SingleType Returns Single Type.

SingleTypeSig Returns fullname of Single Type.

StringArrayType Returns String Array Type.

StringArrayTypeSig Returns fullname of String Array Type.

StringType Returns String Type.

StringTypeSig Returns fullname of String Type.

UInt16ArrayType Returns UInt16 Array Type.

UInt16ArrayTypeSig Returns fullname of UInt16 Array Type.

UInt16Type Returns UInt16 Type.

UInt16TypeSig Returns fullname of UInt16 Type.

UInt32ArrayType Returns UInt32 Array Type.

UInt32Type Returns UInt32 Type.

UInt32TypeSig Returns fullname of UInt32 Type.

548
.Net Runtime Library for Delphi

Name Description

UInt64ArrayType Returns UInt64 Array Type.

UInt64ArrayTypeSig Returns fullname of UInt64 Array Type.

UInt64Type Returns UInt64 Type.

UInt64TypeSig Returns fullname of UInt64 Type.

UIntegerArrayTypeSig Returns fullname of Integer Array Type.

See Also
_ClrDataTypeHelper Methods
_ClrDataTypeHelper Properties

7.1.1.2.1.1.2 _ClrEventArgs Interface


Collapse All Expand All

Represents the wrapper interface for .net objects that contain event data, and provides a value to use for events that do
not include event data.

Inheritance Hierarchy
CNClrLib.Core.Intf._ClrEventArgs

File: CNClrLib.Core.Intf.pas

Namespace: CNClrLib.Core.Intf

Syntax
Delphi

_ClrEventArgs = dispinterface;

Properties

Name Description

EventArgs Contains the event data and provides a value to use for events that do
not include event data. This property can return nil if the eventArgs
property from the event handler does not inherit from
System.EventArgs.

EventInfo Returns the EventInfo object that raised event.

549
.Net Runtime Library for Delphi

Name Description

EventParams Returns an array that contains the parameters of the event


handler which is called if the event is raised.

See Also
_ClrEventArgs Properties

7.1.1.2.1.1.3 _ClrEventCallbacks Interface


Collapse All Expand All

Contains methods to create events

Inheritance Hierarchy
CNClrLib.Core.Intf._ClrEventCallbacks

File: CNClrLib.Core.Intf.pas

Namespace: CNClrLib.Core.Intf

Syntax
Delphi

_ClrEventCallbacks = dispinterface;

Methods

Name Description

CreateFunctionPointer Converts an unmanaged function pointer as integer to


managed pointer.

RegisterEventCallBack Add an event to the specified target object using the


specified event name and a function pointer which is the
event handler.

RegisterEventCallBackDirect Add an event directly to the specified target object using


the specified event name and function pointer which is the
event handler.

RegisterEventCallBackDirect_1 Add an event directly to the specified target object using


the specified event name and delegate.

RegisterEventCallBack_1 Add an event to the specified target object using the


specified event name and delegate.

550
.Net Runtime Library for Delphi

Name Description

RegisterStaticEventCallBack Add an event to the specified static target type using the
specified event name and a function pointer which is the
event handler.

RegisterStaticEventCallBackDirect Add an event directly to the specified static target type


using the specified event name and function pointer which
is the event handler.

RegisterStaticEventCallBackDirect_1 Add an event directly to the specified static target type


using the specified event name and delegate.

RegisterStaticEventCallBack_1 Add an event to the specified static target type using the
specified event name and delegate.

UnRegisterEventCallBack Remove an event from the specified target object using the
specified event name and function pointer (which is the
event handler).

UnRegisterEventCallBackDirect Remove an event directly from the specified target object


using the specified event name and function pointer.

UnRegisterEventCallBackDirect_1 Remove an event directly from the specified target object


using the specified event name and delegate.

UnRegisterEventCallBack_1 Remove an event from the specified target object using the
specified event name and delegate.

UnRegisterStaticEventCallBack Remove an event from the specified static target type using
the specified event name and function pointer (which is the
event handler).

UnRegisterStaticEventCallBackDirect Remove an event directly from the specified static target


type using the specified event name and function pointer
(which is the event handler).

UnRegisterStaticEventCallBackDirect_1 Remove an event directly from the specified static target


type using the specified event name and delegate.

UnRegisterStaticEventCallBack_1 Remove an event from the specified static target type using
the specified event name and delegate.

See Also
_ClrEventCallbacks Methods

551
.Net Runtime Library for Delphi

7.1.1.2.1.1.4 _ClrEventHander Interface


Represents the method that will handle an event when the event provides data.

Inheritance Hierarchy
CNClrLib.Core.Intf._ClrEventHander

File: CNClrLib.Core.Intf.pas

Namespace: CNClrLib.Core.Intf

Syntax
Delphi

_ClrEventHander = dispinterface;

7.1.1.2.1.1.5 _ClrHost Interface


Collapse All Expand All

Contains methods for starting and hosting the .Net Framework Common Language Runtime.

Inheritance Hierarchy
CNClrLib.Core.Intf._ClrHost

File: CNClrLib.Core.Intf.pas

Namespace: CNClrLib.Core.Intf

Syntax
Delphi

_ClrHost = dispinterface;

Methods

Name Description

AsClrObject Returns the ClrHost object as ClrObject Interface.

AsPointer Returns the clrHost object as managed pointer.

AsType Converts the specified variant to another type.

Cast Casts the specified variant to another type.

ClrCreateInstance Creates an instance of the specified type using the constructor that
best matches the specified parameters and returns the object as

552
.Net Runtime Library for Delphi

Name Description

ClrObject Interface.

ClrCreateInstance_1 Creates an instance of the specified type using the constructor that
best matches the specified parameters and returns the object as
ClrObject Interface.

ClrCreateInstance_2 Creates an instance of the specified type using the constructor that
best matches the specified parameters and returns the object as
ClrObject Interface.

ClrCreateInstance_3 Creates an instance of the specified type using the constructor that
best matches the specified parameters and returns the object as
ClrObject Interface.

ClrCreateInstance_4 Creates an instance of the specified type using the constructor that
best matches the specified parameters and returns the object as
ClrObject Interface.

ClrCreateInstance_5 Creates an instance of the specified type using the constructor that
best matches the specified parameters and returns the object as
ClrObject Interface.

ClrCreateInstance_6 Creates an instance of the specified type using the constructor that
best matches the specified parameters and returns the object as
ClrObject Interface.

ClrCreateInstance_7 Creates an instance of the specified type using the constructor that
best matches the specified parameters and returns the object as
ClrObject Interface.

ClrCreateWSDL Creates WSDL Interface.

CreateArray Creates an Array Interface.

CreateException Create Exception Interface.

CreateManagedPointer Creates a managed pointer from the specified unmanaged


pointer.

CreateObjectArray Creates an array of object.

CreateStaticObject Creates a static object type.

GetAssembly Gets the assembly from the specified type name.

GetAssemblyName Gets the Assembly Name interface from the specified

553
.Net Runtime Library for Delphi

Name Description

assembly file path.

GetAssembly_1 Gets the assembly from the specified object.

GetDispatch Gets IDispatch interface from the specified object.

GetEnumObject Converts the specified 32-bit signed integer to an enumeration


member as variant.

GetException This is GetException, a member of class _ClrHost.

GetGACAssemblyPath This is GetGACAssemblyPath, a member of class _ClrHost.

GetObject Converts a function pointer to ClrObject.

GetType Get Type from the specified TypeCode .

GetTypes Convert type names separated by semicolons to a one-


dimensional array if Type.

GetType_1 Get Type from the specified type name.

GetType_2 Get Type from the specified object.

QueryInterface Returns a reference to a specified interface if the object


supports that interface.

StringToByteArray Converts a string to an array of bytes.

ThrowException Raise the exception of the specified exception interface.

TryAsType Tries to convert the specified object value to another type.

TryCast Tries to cast the specified object value to another type.

TryWrap Tries to wrap the specified object value to another type.

Unwrap Returns the .net System.Object from the specified object.

Wrap Wraps the specified object to another type.

Wrap_1 Wraps the specified object to another type.

554
.Net Runtime Library for Delphi

Properties

Name Description

Activator Returns the Activator Interface.

AppDomain Returns the AppDomain Interface.

AppDomainHelper Returns the AppDomain static helper Interface.

AssemblyHelper Returns the Assembly static helper Interface.

ClrConvert Returns the Convert Interface.

ClrDataTypeHelper Returns the Data Type Helper Interface.

GC Returns the Garbage Collector Interface.

Marshal Returns the Marshal Interface.

See Also
_ClrHost Methods
_ClrHost Properties

7.1.1.2.1.1.6 _ClrObject Interface


Collapse All Expand All

This is an interface that can store different kinds of data types.

Inheritance Hierarchy
CNClrLib.Core.Intf._ClrObject

File: CNClrLib.Core.Intf.pas

Namespace: CNClrLib.Core.Intf

Syntax
Delphi

_ClrObject = dispinterface;

Methods

Name Description

555
.Net Runtime Library for Delphi

Name Description

AsArray Converts the stored value to an Array value.

AsBoolean Converts the stored value to a boolean value.

AsByte Converts the stored value to a byte value.

AsChar Converts the stored value to a unicode character value.

AsClrObject Returns the Assembly object as ClrObject Interface.

AsDecimal Converts the stored value to a decimal value.

AsDispatch Returns the stored IDispatch interface value.

AsDouble Converts the stored value to a double value.

AsInt16 Converts the stored value to a smallint value.

AsInt32 Converts the stored value to an integer value.

AsInt64 Converts the stored value to a decimal value.

AsObject Converts the stored value to a variant value.

AsPointer Converts the stored value to a managed ponter.

AsSByte Converts the stored value to a shortint value.

AsSingle Converts the stored value to a single value.

AsString Converts the stored value to a string value.

AsUInt16 Converts the stored value to a word value.

AsUInt32 Converts the stored value to a longword value.

AsUInt64 Converts the stored value to a uint64 value.

AsUnknown Returns the stored IUnknown interface value.

AsWrapObject This is AsWrapObject, a member of interface _ClrObject.

556
.Net Runtime Library for Delphi

Name Description

Cast Casts the currently stored value to another type.

Cast_ Casts the currently stored value to another type.

Clone Create a shallow copy of the interface.

Dispose Forces the execution of the destructor code in an object.

Equals Determines whether this interface and the specified variant are
equal.

Equals_1 Determines whether this interface and the specified clrobject value
are equal.

Equals_2 Determines whether the two specified variant values are equal.

Equals_3 Determines whether the two specified clrObject values are equal.

GetArrayElement Returns an element from the array stored in this interface.

GetArrayElement_ Returns an element as ClrObject from the array stored in this


interface.

GetArrayLength Returns the array length if the stored value is an array.

GetEvent Returns the EventInfo object representing the specified public


event.

GetEvent_1 Returns the EventInfo object representing the specified event,


using the specified binding constraints.

GetField Searches for the public field with the specified name.

GetFieldValue Searches for the public field with the specified name and returns
the value of a field supported by a given object.

GetFieldValue_ Searches for the public field with the specified name and returns
the value of a field as ClrObject supported by a given object.

GetFieldValue_1 Searches for the specified field, using the specified binding
constraints and returns the value of a field supported by a given
object.

GetFieldValue__1 Searches for the specified field, using the specified binding
constraints and returns the value of a field as ClrObject supported

557
.Net Runtime Library for Delphi

Name Description

by a given object.

GetField_1 Searches for the specified field, using the specified binding
constraints.

GetGenericMethod Searches for the specified public generic method whose parameters
match the specified generic and argument types.

GetGenericMethod_1 Searches for the specified public generic method whose parameters
match the specified generic types.

GetGenericMethod_2 Searches for the specified public generic method whose parameters
match the specified generic and argument types. The argument
paramter accepts type names as string separated with semicolon.

GetHashCode Returns the hash code for this instance.

GetMethod Searches for the public method with the specified name.

GetMethod_1 Searches for the specified public method whose parameters match
the specified argument types. The argument paramter accepts type
names as string separated with semicolon.

GetMethod_2 Searches for the specified public method whose parameters match
the specified argument types.

GetProperty Searches for the public property with the specified name.

GetPropertyValue Searches for the public property with the specified name and
returns the property value of a specified object.

GetPropertyValue_ Searches for the public property with the specified name and
returns the property clrobject value of a specified object.

GetPropertyValue_1 Searches for the public property with the specified name and
returns the property index value of a specified indexer object.

GetPropertyValue_2 Searches for the public property with the specified name and
returns the property index value of a specified indexer object.

GetPropertyValue_3 Searches for the public property with the specified name and
returns the property index value of a specified indexer object.

GetPropertyValue_4 Searches for the public property with the specified name and
returns the property index value of a specified indexer object.

558
.Net Runtime Library for Delphi

Name Description

GetPropertyValue__1 Searches for the public property with the specified name and
returns the property index clrobject value of a specified indexer
object.

GetPropertyValue__2 Searches for the public property with the specified name and
returns the property index clrobject value of a specified indexer
object.

GetPropertyValue__3 Searches for the public property with the specified name and
returns the property index clrobject value of a specified indexer
object.

GetProperty_1 Searches for the specified public property whose parameters match
the specified argument types.

GetProperty_2 Searches for the specified public property whose parameters match
the specified argument types.

GetType Gets the Type of the current instance.

GetWrappedType Get the Type of the wrapped object.

InvokeGenericMethod Searches for the specified public generic method whose parameters
match the specified generic and argument types and invokes the
method using the specified parameters.

InvokeGenericMethod_ Searches for the specified public generic method whose parameters
match the specified generic and argument types and invokes the
method using the specified parameters which returns a ClrObject.

InvokeGenericMethod_1 Searches for the specified public generic method whose parameters
match the specified generic and argument types and invokes the
method using the specified parameters.

InvokeGenericMethod_2 Searches for the specified public generic method whose parameters
match the specified generic and argument types and invokes the
method using the specified parameters which returns a ClrObject.

InvokeGenericMethod__1 Searches for the specified public generic method whose parameters
match the specified generic and argument types and invokes the
method using the specified parameters.

InvokeGenericMethod__2 Searches for the specified public generic method whose parameters
match the specified generic and argument types and invokes the
method using the specified parameters which returns a ClrObject.

InvokeMethod Searches for the public method with the specified name invokes the

559
.Net Runtime Library for Delphi

Name Description

method using the specified parameters.

InvokeMethod_ Searches for the public method with the specified name invokes the
method using the specified parameters which returns ClrObject
value.

InvokeMethod_1 Searches for the public method with the specified name invokes the
method using the specified parameters.

InvokeMethod_2 Searches for the public method with the specified name invokes the
method using the specified parameters which returns ClrObject
value.

InvokeMethod__1 Searches for the public method with the specified name invokes the
method using the specified parameters.

InvokeMethod__2 Searches for the public method with the specified name invokes the
method using the specified parameters which returns ClrObject
value.

IsClass Gets a value indicating whether the current Type is a class.

IsEnum Gets a value indicating whether the current Type is a class.

IsInstanceOfType Determines whether the specified object is an instance of the


current Type.

IsInstanceOfType_1 Determines whether the specified object is an instance of the


current Type.

IsObject Checks whether the stored value is an object reference.

IsType Checks whether the currently stored value can be casted to a


given type.

IsValueType Gets a value indicating whether the Type is a value type.

ReferenceEquals Determines whether the specified Object instances are the same
instance.

ReferenceEquals_1 Determines whether the specified Object instances are the same
instance.

RegisterEventCallBack Add an event to the instance using the specified event name
and function pointer (which is the event handler).

560
.Net Runtime Library for Delphi

Name Description

RegisterEventCallBackDirect Add an event directly to the instance using the specified event
name and function pointer (which is the event handler).

RegisterEventCallBackDirect_1 Add an event directly to the instance using the specified event
name and delegate.

RegisterEventCallBack_1 Add an event to the instance using the specified event name
and delegate.

SetArrayElement Sets an element in the array stored in the interface.

SetArrayElement_1 Sets an element in the array stored in the interface.

SetFieldValue Searches for the public field with the specified name and sets the
value of a field supported by a given object.

SetFieldValue_1 Searches for the public field with the specified name and sets the
value of a field supported by a given object.

SetFieldValue_2 Searches for the public field with the specified name and sets the
value of a field supported by a given object.

SetFieldValue_3 Searches for the public field with the specified name and sets the
value of a field supported by a given object.

SetObject This is SetObject, a member of interface _ClrObject.

SetObject_1 This is SetObject_1, a member of interface _ClrObject.

SetPropertyValue Searches for the public property with the specified name and sets
the property value of a specified object.

SetPropertyValue_1 Searches for the public property with the specified name and sets
the property value of a specified object.

SetPropertyValue_10 Searches for the public property with the specified name and sets
the property value of a specified object.

SetPropertyValue_2 Searches for the public property with the specified name and sets
the property value of a specified object.

SetPropertyValue_3 Searches for the public property with the specified name and sets
the property value of a specified object.

SetPropertyValue_4 Searches for the public property with the specified name and sets
the property value of a specified object.

561
.Net Runtime Library for Delphi

Name Description

SetPropertyValue_5 Searches for the public property with the specified name and sets
the property value of a specified object.

SetPropertyValue_6 Searches for the public property with the specified name and sets
the property value of a specified object.

SetPropertyValue_7 Searches for the public property with the specified name and sets
the property value of a specified object.

SetPropertyValue_8 Searches for the public property with the specified name and sets
the property value of a specified object.

SetPropertyValue_9 Searches for the public property with the specified name and sets
the property value of a specified object.

ToString Returns a string that represents the current object.

TryCast Tries to cast the currently stored value to another type.

TryCast_1 Tries to cast the currently stored value to another type.

UnRegisterEventCallBack Remove an event from the instance using the specified event
name and function pointer which is the event handler.

UnRegisterEventCallBackDirect Remove an event from the instance using the specified event
name and delegate.

UnRegisterEventCallBackDirect_1 Remove an event directly from the instance using the specified
event name and function pointer which is the event handler.

UnRegisterEventCallBack_1 Remove an event directly from the instance using the specified
event name and delegate.

Unwrap Returns the stored .net unwrapped object.

Properties

Name Description

IsArray Gets a value that indicates whether the type is an array.

IsGeneric Gets a value indicating whether the current type is a generic type.

IsStatic Gets a value indicating whether the current type is a static type.

562
.Net Runtime Library for Delphi

Name Description

TypeCode Gets the underlying type code of the instance.

UnManagedObject Returns the TObject as managed pointer if an event is


registered from TBaseObject level.

See Also
_ClrObject Methods
_ClrObject Properties

7.1.1.2.1.1.7 _ClrWSDL Interface


Collapse All Expand All

Contains methods to build and convert XML Web Services into a .net assembly.

Inheritance Hierarchy
CNClrLib.Core.Intf._ClrWSDL

File: CNClrLib.Core.Intf.pas

Namespace: CNClrLib.Core.Intf

Syntax
Delphi

_ClrWSDL = dispinterface;

Methods

Name Description

BuildAssembly Build and convert the XML Web Services to a .net assembly.

GetServices Returns the webservices from the XML Web Services path as
assembly types.

Properties

Name Description

ProtocolName Gets or sets the protocol used to access the described XML Web
services.

563
.Net Runtime Library for Delphi

Name Description

WSDLLocation Gets or Sets the path of the XML Web services.

See Also
_ClrWSDL Methods
_ClrWSDL Properties

7.1.1.2.1.1.8 _Exception Interface


Represents errors that occur during application execution. For more information, see C# Exception Class.

Inheritance Hierarchy
CNClrLib.Core.Intf._Exception

File: CNClrLib.Core.Intf.pas

Namespace: CNClrLib.Core.Intf

Syntax
Delphi

_Exception = dispinterface;

7.1.1.2.1.1.9 _IClrObject Interface


Collapse All Expand All

This is the base interface which all the CrystalNet .Net Runtuime Library classes inherit. All the
dispatch interfaces in the Class library inherits from _IClrObject and can be cast to this interface
type.

Inheritance Hierarchy
CNClrLib.Core.Intf._IClrObject

File: CNClrLib.Core.Intf.pas

Namespace: CNClrLib.Core.Intf

Syntax
Delphi

_IClrObject = dispinterface;

Methods

564
.Net Runtime Library for Delphi

Name Description

AsClrObject Returns the object as ClrObject Interface.

AsPointer Returns the object as managed pointer.

GetType Gets the Type of the current instance.

Unwrap Returns the .net System.Object value.

See Also
_IClrObject Methods

7.1.1.3 CNClrLib.DynamicLinq Namespace


Collapse All Expand All

The CNClrLib.Dynamic namespaceprovides interfaces that support Execution of Lambda expressions defined in a string
against Entity Framework or any provider that supports IQueryable.

Interfaces

Name Description

_ClrDynamicClass Provides functionality to create new classes from values in a


Dynamic Linq.

_ClrDynamicExpression Represents a dynamic operation.

_ClrDynamicProperty Represents the property of the dynamic class.

_ClrDynamicPropertyArray Represents an array of ClrDynamicProperty objects.

_ClrDynamicQueryable Provides functionality to evaluate queries against a specific data


source wherein the type of the data is known.

_ClrParseException Represents errors that occur when a DynamicLinq parses


values to create a query.

See Also
How to: Use Linq and Dynamic Linq Interfaces

7.1.1.3.1 Interfaces
Collapse All Expand All

565
.Net Runtime Library for Delphi

The CNClrLib.Dynamic namespaceprovides interfaces that support Execution of Lambda expressions defined in a string
against Entity Framework or any provider that supports IQueryable.

Interfaces

Name Description

_ClrDynamicClass Provides functionality to create new classes from values in a


Dynamic Linq.

_ClrDynamicExpression Represents a dynamic operation.

_ClrDynamicProperty Represents the property of the dynamic class.

_ClrDynamicPropertyArray Represents an array of ClrDynamicProperty objects.

_ClrDynamicQueryable Provides functionality to evaluate queries against a specific data


source wherein the type of the data is known.

_ClrParseException Represents errors that occur when a DynamicLinq parses


values to create a query.

See Also
How to: Use Linq and Dynamic Linq Interfaces

7.1.1.3.1.1 _ClrDynamicClass Interface


Provides functionality to create new classes from values in a Dynamic Linq.

Inheritance Hierarchy
CNClrLib.DynamicLinq._ClrDynamicClass

File: CNClrLib.DynamicLinq.pas

Namespace: CNClrLib.DynamicLinq

Syntax

7.1.1.3.1.2 _ClrDynamicExpression Interface


Represents a dynamic operation.

Inheritance Hierarchy
CNClrLib.DynamicLinq._ClrDynamicExpression

File: CNClrLib.DynamicLinq.pas

566
.Net Runtime Library for Delphi

Namespace: CNClrLib.DynamicLinq

Syntax
Delphi

_ClrDynamicExpression = dispinterface;

For Examples, see How to: Use Linq and Dynamic Linq Interfaces.

7.1.1.3.1.3 _ClrDynamicProperty Interface


Represents the property of the dynamic class.

Inheritance Hierarchy
CNClrLib.DynamicLinq._ClrDynamicProperty

File: CNClrLib.DynamicLinq.pas

Namespace: CNClrLib.DynamicLinq

Syntax

7.1.1.3.1.4 _ClrDynamicPropertyArray Interface


Represents an array of ClrDynamicProperty objects.

Inheritance Hierarchy
CNClrLib.DynamicLinq._ClrDynamicPropertyArray

File: CNClrLib.DynamicLinq.pas

Namespace: CNClrLib.DynamicLinq

Syntax

7.1.1.3.1.5 _ClrDynamicQueryable Interface


Provides functionality to evaluate queries against a specific data source wherein the type of the data is known.

Inheritance Hierarchy
CNClrLib.DynamicLinq._ClrDynamicQueryable

File: CNClrLib.DynamicLinq.pas

Namespace: CNClrLib.DynamicLinq

Syntax

567
.Net Runtime Library for Delphi

Delphi

_ClrDynamicQueryable = dispinterface;

For more information about the members of this interface, see IQueryable<T>.

For Examples, see How to: Use Linq and Dynamic Linq Interfaces.

7.1.1.3.1.6 _ClrParseException Interface


Represents errors that occur when a DynamicLinq parses values to create a query.

Inheritance Hierarchy
CNClrLib.DynamicLinq._ClrParseException

File: CNClrLib.DynamicLinq.pas

Namespace: CNClrLib.DynamicLinq

Syntax
Delphi

_ClrParseException = dispinterface;

For more information about exception in general, see _Exception Interface.

7.1.1.4 CNClrLib.Enums Namespace


This CNClrLib.Enums namespace contains set of named integer constants which represents all
the .Net framework class library enumeration types.

Examples
The example below shows the TypeCode enumeration in c# and it equivalent in Delphi using
TOleEnum defined in CNClrLib.Enums Namespaces.

C#

// Specifies the type of an object.

public enum TypeCode

Empty = 0,

Object = 1,

DBNull = 2,

Boolean = 3,

Char = 4,

568
.Net Runtime Library for Delphi

SByte = 5,

Byte = 6,

Int16 = 7,

UInt16 = 8,

Int32 = 9,

UInt32 = 10,

Int64 = 11,

UInt64 = 12,

Single = 13,

Double = 14,

Decimal = 15,

DateTime = 16,

String = 18

Delphi Equivalent of theTypeCode enumeration in c#

Delphi

569
.Net Runtime Library for Delphi

type

TypeCode = TOleEnum;

const

TypeCode_Empty = $00000000;

TypeCode_Object = $00000001;

TypeCode_DBNull = $00000002;

TypeCode_Boolean = $00000003;

TypeCode_Char = $00000004;

TypeCode_SByte = $00000005;

TypeCode_Byte = $00000006;

TypeCode_Int16 = $00000007;

TypeCode_UInt16 = $00000008;

TypeCode_Int32 = $00000009;

TypeCode_UInt32 = $0000000A;

TypeCode_Int64 = $0000000B;

TypeCode_UInt64 = $0000000C;

TypeCode_Single = $0000000D;

TypeCode_Double = $0000000E;

TypeCode_Decimal = $0000000F;

TypeCode_DateTime = $00000010;

TypeCode_String = $00000012;

570
.Net Runtime Library for Delphi

The example below demonstrates how to get the TypeCode of the value 455 using the Convert
Interface.

Delphi

program EnumsExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.Enums,

CNClrLib.Core,

ActiveX;

var

Convert: _Convert;

ATypeCode: TypeCode;

begin

Convert := CoConvert.CreateInstance;

ATypeCode := Convert.GetTypeCode(455);

WriteLn(ATypeCode);

end.

//Output

// 9

//NB: 9 Represents the TypeCode constants TypeCode_Int32

571
.Net Runtime Library for Delphi

7.1.1.5 CNClrLib.EnumTypes Namespace


This CNClrLib.EnumTypes namespace contains delphi enumeration equivalent of the .Net
framework class library enumeration types defined as TOleEnum constants in CNClrLib.Enums .
The purpose of defining an enumeration types in this unit is for readable and reliable code.
TOleEnum Constants are difficult to read, however using a representation of this TOleEnum
constants as delphi enumeration types makes it easy to ready.

Examples
The example below demonstrates how the delphi specific enumeration types are defined to
map to it counterparts in CNClrLib.Enums.

The TypeCode defined in the CNClrLib.Enums as TOleEnum constant is represented as delphi


enumeration types in this unit (CNClrLib.EnumTypes namespace).

Delphi

TTypeCode =

tcEmpty,

tcObject,

tcDBNull,

tcBoolean,

tcChar,

tcSByte,

tcByte,

tcInt16,

tcUInt16,

tcInt32,

tcUInt32,

tcInt64,

tcUInt64,

tcSingle,

tcDouble,

tcDecimal,

tcDateTime,

tcString

572
.Net Runtime Library for Delphi

);

The example below demonstrates how to get the TTypeCode enumeration type of the value
455 using the Convert Interface.

Delphi

program EnumTypesExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

TypInfo,

CNClrLib.EnumTypes,

CNClrLib.Host.Helper;

var

573
.Net Runtime Library for Delphi

Convert: TClrConvert;

ATypeCode: TTypeCode;

ATypeCodeName: string;

begin

Convert := TClrConvert.Create;

ATypeCode := Convert.GetTypeCode(455);

ATypeCodeName := TypInfo.GetEnumName(System.TypeInfo(TTypeCode),
Ord(ATypeCode));

WriteLn(ATypeCodeName);

end.

//Output

// tcInt32

//NB: tcInt32 Represents the Integer part of the TypeCode Enumeration

7.1.1.6 CNClrLib.EnumArrays Namespace


This CNClrLib.EnumArrays namespace contains arrays used to map the delphi enumeration
types defined inCNClrLib.EnumTypes to it equivalent types defined as TOleEnum constants in
CNClrLib.Enums . The Length of the array is equal to the number of enumeration type values
defined.

Examples
The example below demonstrates how the array constants of the enumeration types are
defined.

Delphi

const

TypeCodeValues: array[TTypeCode] of TOleEnum =

TypeCode_Empty, TypeCode_Object, TypeCode_DBNull,


TypeCode_Boolean, TypeCode_Char,

TypeCode_SByte, TypeCode_Byte, TypeCode_Int16,


TypeCode_UInt16, TypeCode_Int32,

TypeCode_UInt32, TypeCode_Int64, TypeCode_UInt64,


TypeCode_Single, TypeCode_Double,

TypeCode_Decimal, TypeCode_DateTime, TypeCode_String

);

574
.Net Runtime Library for Delphi

The example below demonstrates how to return the TypeCode TOleEnum constant equivalent
of the TTypeCode enumeration type value tcInt32.

Delphi

program EnumArraysExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

ActiveX,

CNClrLib.Core,

CNClrLib.EnumTypes,

CNClrLib.EnumArrays,

CNClrLib.Host.Helper;

var

Convert: _Convert;

ATypeCode: TTypeCode;

ATypeCodeConst: TOleEnum;

ATypeCodeConst2: TOleEnum;

ATypeCodeName: string;

typeChangeVal: OleVariant;

begin

575
.Net Runtime Library for Delphi

// Get TypeCode Constant from TTypeCode enumeration type value


tcInt32.

ATypeCodeConst := TypeCodeValues[tcInt32];

Convert := CoConvert.CreateInstance;

// Pass the TOleEnum constant value of the TcInt32 which will be


TypeCode_Int32

// in the Convert method ChangeType; to change the type of double to


integer

typeChangeVal := Convert.ChangeType(455.9, ATypeCodeConst);

//Get the TypeCode constant from the value after the type has
changed

ATypeCodeConst2 := Convert.GetTypeCode(typeChangeVal);

WriteLn(ATypeCodeConst = ATypeCodeConst2);

end.

//Output

// True

7.1.1.7 CNClrLib.EnumFunc Namespace


This CNClrLib.EnumFunc namespace contains functions for converting between delphi set of
enumeration types defined in CNClrLib.EnumTypes and it equivalent TOleEnum constant types
defined in CNClrLib.Enums and vice-versa.

Examples
The following example demonstrates how to you the ToOleEnum method to convert a set of
TStringSplitOptions enumeration types to it equivalent as TOleEnum constants bitwise
combinations.

Delphi

program EnumFuncExample;

{$APPTYPE CONSOLE}

{$R *.res}

576
.Net Runtime Library for Delphi

uses

ActiveX,

CNClrLib.Enums,

CNClrLib.EnumTypes,

CNClrLib.EnumFunc;

var

ATypeCodeConst: TOleEnum;

ATypeCodeConst2: TOleEnum;

begin

// Convert set of TStringSplitOptions enumeration types to the


TOleEnum Constant

// bitwise combinations.

ATypeCodeConst := ToOleEnum([ssoNone, ssoRemoveEmptyEntries]);

// Using only the TOleEnum Constants to get the bitwse

ATypeCodeConst2 := StringSplitOptions_None or
StringSplitOptions_RemoveEmptyEntries;

WriteLn(ATypeCodeConst = ATypeCodeConst2);

end.

//Output

// True

7.1.1.8 CNClrLib.Host Namespace


Collapse All Expand All

The CNClrLib.Host namespace contains classes for starting and hosting the .Net CLR. It also
contains classes to load .net assembly files, view loaded types, methods, properties and fields,
and dynamically create and invoke types. The Host Helper namespace contains classes that
allow for conversion between delphi and .net data types.

Classes

577
.Net Runtime Library for Delphi

Name Description

EClrArgumentNullException The exception that is thrown when a nil reference is passed


to a method that does not accept it as a valid argument.

EClrError The base exception class for errors generated during


application execution.

EClrException Represents errors that occur during application execution.

TClrActivator Contains methods to create types of objects locally or remotely, or


obtain references to existing remote objects.

TClrAppDomain Represents an application domain, which is an isolated environment


where applications execute.

TClrArray Provides methods for creating, manipulating, searching, and sorting


arrays, thereby serving as the base class for all arrays in the common
language runtime.

TClrArrayHelper Helper class for the TClrArray class.

TClrAssembly Represents an assembly, which is a reusable, versionable, and self-


describing building block of a common language runtime application.

TClrBaseObject This is the base object that can store different kinds of data types.

TClrHost Contains methods for starting and hosting the .Net


Framework Common Language Runtime .

TClrObject This Class is a wrapper of a .Net object. This class inherit from the
TClrBaseObject Class.

TClrObjectArray Represents an array of the ClrObject interface.

TClrWSDL Contains methods to build and convert XML Web Services into a
.net assembly.

Functions

Name Description

ClrHostManager Returns the default and running Common Language Runtime


host object.

ClrLibraryLoaded Determine if the runtime host library has been loaded and

578
.Net Runtime Library for Delphi

Name Description

started.

RaiseClrException Creates and raises an EClrException exception which accept


as argument the Clr exception interface.

RaiseClrException Creates and raises an EClrException exception which accept


as argument an error message.

Namespaces

Name Description

Helper Contain classes that allow for conversion between delphi


and .net data types.

Structs, Records, Enums

Name Description

TClrAssmLoadType Determine how the .net assembly library should be loaded


by TClrAssembly Class.

Types

Name Description

ClrAChar This is a type of AnsiChar.

ClrAString This is a type of AnsiString.

ClrBoolean This is a type of Boolean.

ClrByte This is a type of Byte.

ClrChar Represents a character as a UTF-16 code unit. For more


information, see Char Structure in C#.

ClrDateTime This is a type of TDateTime.

ClrDecimal Another form of floating point number which represent a


decimal number. For more information, see Decimal
Structure in C#.

579
.Net Runtime Library for Delphi

Name Description

ClrDouble This is a typeDouble.

ClrGuid This is a type Guid.

ClrInt16 This is a type SmallInt.

ClrInt32 This is a type Integer.

ClrInt64 This is a type Int64.

ClrSByte This is a type ShortInt.

ClrSingle This is a type Single.

ClrString This is a type String.

ClrUInt16 This is a type Word.

ClrUInt32 This is a type LongWord.

ClrUInt64 This is a type Largeuint.

ClrUString This is a type UnicodeString.

ClrVariant This is a type OleVariant.

ClrWChar This is a type WideChar.

ClrWString This is a type WideString.

TClrACharDynArray Represents a dynamic array of ClrAChar.

TClrAStringDynArray Represents a dynamic array of ClrAString .

TClrBase This is the ultimate base class of all classes in the Host Class
Library.

TClrBooleanDynArray Represents a dynamic array of ClrBoolean.

TClrByteDynArray Represents a dynamic array of ClrByte.

TClrCharDynArray Represents a dynamic array of ClrChar.

580
.Net Runtime Library for Delphi

Name Description

TClrDateTimeDynArray Represents a dynamic array of ClrDateTime.

TClrDecimalDynArray Represents a dynamic array of ClrDecimal.

TClrDoubleDynArray Represents a dynamic array of ClrDouble.

TClrEventHandler A standard method pointer for handling .net events invoked


in the Common Language Runtime which does not return a
value.

TClrEventHandlerR A standard method pointer for handling .net events invoked


in the Common Language Runtime which returns a value.

TClrExceptionDynArray Represents a dynamic array of Clr Exception interface.

TClrExtendedDynArray Represents a dynamic array of ClrExtended.

TClrInt16DynArray Represents a dynamic array of ClrInt16.

TClrInt32DynArray Represents a dynamic array of ClrInt32.

TClrInt64DynArray Represents a dynamic array of ClrInt64.

TClrObjectDynArray Represents a dynamic array of _ClrObject interface.

TClrSByteDynArray Represents a dynamic array of ClrSByte.

TClrSingleDynArray Represents a dynamic array of ClrSingle.

TClrStringDynArray Represents a dynamic array of ClrString.

TClrTypeDynArray Represents a dynamic array of _Type Interface.

TClrUInt16DynArray Represents a dynamic array of ClrUInt16.

TClrUInt32DynArray Represents a dynamic array of ClrUInt32.

TClrUInt64DynArray Represents a dynamic array of ClrUInt64.

TClrVariantDynArray Represents a dynamic array of ClrVariant.

TClrWCharDynArray Represents a dynamic array of ClrWChar.

581
.Net Runtime Library for Delphi

Name Description

TClrWStringDynArray Represents a dynamic array of ClrWString.

TExceptionDynArray Represents a dynamic array of Delphi Exception.

TTClrObjectDynArray Represents a dynamic array of TClrBaseObject.

7.1.1.8.1 CNClrLib.Host.Helper Namespace


Contain classes that allow for conversion between delphi and .net data types.

Classes

Name Description

TClrDoubleHelper Helper class for Double Data Type.

TClrInt64Helper Helper class for Int64 Data Type.

TClrBitConverter Converts base data types to an array of bytes, and an array of bytes to
base data types.

TClrBooleanHelper Helper class for Boolean Data Type.

TClrByteHelper Helper class for Byte Data Type.

TClrCharHelper Helper class for Char Data Type and _Char interface Type.

TClrConvert Converts a base data type to another base data type.

TClrDateTimeHelper Helper class for TDateTime Data Type.

TClrDecimalHelper Helper class for _Decimal Interface Type.

TClrGuidHelper Helper class for Guid Type.

TClrInt16Helper Helper class for SmallInt Data Type.

TClrInt32Helper Helper class for Integer Data Type.

TClrIntPtrHelper Helper class for managed pointer interface type called


_IntPtr .

582
.Net Runtime Library for Delphi

Name Description

TClrSByteHelper Helper class for ShortInt Data Type.

TClrSingleHelper Helper class for Single Data Type.

TClrStringHelper Helper class for String Data Type.

TClrUInt16Helper Helper class for Word Data Type.

TClrUInt32Helper Helper class for LongInt Data Type.

TClrUInt64Helper Helper class for LargeUInt Data Type.

7.1.1.8.1.1 Classes
Contain classes that allow for conversion between delphi and .net data types.

Classes

Name Description

TClrDoubleHelper Helper class for Double Data Type.

TClrInt64Helper Helper class for Int64 Data Type.

TClrBitConverter Converts base data types to an array of bytes, and an array of bytes to
base data types.

TClrBooleanHelper Helper class for Boolean Data Type.

TClrByteHelper Helper class for Byte Data Type.

TClrCharHelper Helper class for Char Data Type and _Char interface Type.

TClrConvert Converts a base data type to another base data type.

TClrDateTimeHelper Helper class for TDateTime Data Type.

TClrDecimalHelper Helper class for _Decimal Interface Type.

TClrGuidHelper Helper class for Guid Type.

583
.Net Runtime Library for Delphi

Name Description

TClrInt16Helper Helper class for SmallInt Data Type.

TClrInt32Helper Helper class for Integer Data Type.

TClrIntPtrHelper Helper class for managed pointer interface type called


_IntPtr .

TClrSByteHelper Helper class for ShortInt Data Type.

TClrSingleHelper Helper class for Single Data Type.

TClrStringHelper Helper class for String Data Type.

TClrUInt16Helper Helper class for Word Data Type.

TClrUInt32Helper Helper class for LongInt Data Type.

TClrUInt64Helper Helper class for LargeUInt Data Type.

7.1.1.8.1.1.1 TClrDoubleHelper Class


Collapse All Expand All

Helper class for Double Data Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrDoubleHelper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrDoubleHelper = class;

Methods

Name Description

584
.Net Runtime Library for Delphi

Name Description

CompareTo(ClrDouble, Compares this instance to a specified double-precision floating-point


ClrDouble) number and returns an integer that indicates whether the value of this
instance is less than, equal to, or greater than the value of the
specified double-precision floating-point number.

CompareTo(ClrDouble, Compares this instance to a specified object and returns an integer


ClrVariant) that indicates whether the value of this instance is less than, equal to,
or greater than the value of the specified object.

Epsilon Represents the smallest positive Double value that is greater than
zero.

Equals(ClrDouble, ClrDouble) Returns a value indicating whether this instance and a specified
Double object represent the same value.

Equals(ClrDouble, Returns a value indicating whether this instance is equal to a specified


ClrVariant) object.

GetHashCode Returns the hash code for this instance.

IsInfinity Returns a value indicating whether the specified number evaluates to


negative or positive infinity

IsNaN Returns a value that indicates whether the specified value is not a
number.

IsNegativeInfinity Returns a value indicating whether the specified number evaluates to


negative infinity.

IsPositiveInfinity Returns a value indicating whether the specified number evaluates to


positive infinity.

MaxValue Represents the largest possible value of a Double.

MinValue Represents the smallest possible value of a Double.

NaN Represents a value that is not a number (NaN).

NegativeInfinity Represents negative infinity.

Parse(ClrWString) Converts the string representation of a number to its double-precision


floating-point number equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its double-precision floating-point number
equivalent.

585
.Net Runtime Library for Delphi

Name Description

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its double-precision floating-point number equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its double-precision floating-point number
equivalent.
IFormatProvider)

PositiveInfinity Represents positive infinity.

ToString(ClrDouble) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrDouble, Converts the numeric value of this instance to its equivalent string
ClrWString) representation, using the specified format.

ToString(ClrDouble, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

ToString(ClrDouble, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Converts the string representation of a number to its double-precision


ClrDouble) floating-point number equivalent. A return value indicates whether
the conversion succeeded or failed.

TryParse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its double-precision floating-point number
equivalent. A return value indicates whether the conversion succeeded
IFormatProvider, ClrDouble)
or failed.

See Also
TClrDoubleHelper Methods

7.1.1.8.1.1.1.1 TClrDoubleHelper Methods

The methods of the TClrDoubleHelper class are listed here.

Methods

Name Description

CompareTo(ClrDouble, Compares this instance to a specified double-precision floating-point


ClrDouble) number and returns an integer that indicates whether the value of this
instance is less than, equal to, or greater than the value of the

586
.Net Runtime Library for Delphi

Name Description

specified double-precision floating-point number.

CompareTo(ClrDouble, Compares this instance to a specified object and returns an


ClrVariant) integer that indicates whether the value of this instance is
less than, equal to, or greater than the value of the specified
object.

Epsilon Represents the smallest positive Double value that is greater than
zero.

Equals(ClrDouble, ClrDouble) Returns a value indicating whether this instance and a specified
Double object represent the same value.

Equals(ClrDouble, Returns a value indicating whether this instance is equal to a specified


ClrVariant) object.

GetHashCode Returns the hash code for this instance.

IsInfinity Returns a value indicating whether the specified number evaluates to


negative or positive infinity

IsNaN Returns a value that indicates whether the specified value is not a
number.

IsNegativeInfinity Returns a value indicating whether the specified number evaluates to


negative infinity.

IsPositiveInfinity Returns a value indicating whether the specified number evaluates to


positive infinity.

MaxValue Represents the largest possible value of a Double .

MinValue Represents the smallest possible value of a Double .

NaN Represents a value that is not a number ( NaN ).

NegativeInfinity Represents negative infinity.

Parse(ClrWString) Converts the string representation of a number to its double-precision


floating-point number equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its double-precision floating-point number
equivalent.

587
.Net Runtime Library for Delphi

Name Description

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its double-precision floating-point number equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its double-precision floating-point number
equivalent.
IFormatProvider)

PositiveInfinity Represents positive infinity.

ToString(ClrDouble) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrDouble, Converts the numeric value of this instance to its equivalent string
ClrWString) representation, using the specified format.

ToString(ClrDouble, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

ToString(ClrDouble, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Converts the string representation of a number to its double-precision


ClrDouble) floating-point number equivalent. A return value indicates whether
the conversion succeeded or failed.

TryParse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its double-precision floating-point number
equivalent. A return value indicates whether the conversion succeeded
IFormatProvider, ClrDouble)
or failed.

7.1.1.8.1.1.1.1.1 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

Name Description

TClrDoubleHelper.CompareTo Compares this instance to a specified double-precision floating-point


(ClrDouble, ClrDouble) number and returns an integer that indicates whether the value of
this instance is less than, equal to, or greater than the value of the
specified double-precision floating-point number.

588
.Net Runtime Library for Delphi

Name Description

TClrDoubleHelper.CompareTo Compares this instance to a specified object and returns an integer


(ClrDouble, ClrVariant) that indicates whether the value of this instance is less than, equal to,
or greater than the value of the specified object.

7.1.1.8.1.1.1.1.1 TClrDoubleHelper.CompareTo Method (ClrDouble, ClrDouble)


Compares this instance to a specified double-precision floating-point number and returns an integer that indicates
whether the value of this instance is less than, equal to, or greater than the value of the specified double-precision
floating-point number.

Syntax
Delphi

class function CompareTo(D: ClrDouble; AValue: ClrDouble): ClrInt32;


overload;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.1 TClrDoubleHelper.CompareTo Method (ClrDouble, ClrVariant)


Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is
less than, equal to, or greater than the value of the specified object.

Syntax
Delphi

class function CompareTo(D: ClrDouble; AValue: ClrVariant): ClrInt32;


overload;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.2 TClrDoubleHelper.Epsilon Method

Represents the smallest positive Double value that is greater than zero.

Syntax
Delphi

class function Epsilon: ClrDouble;

589
.Net Runtime Library for Delphi

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.3 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrDoubleHelper.Equals Returns a value indicating whether this instance and a specified


(ClrDouble, ClrDouble) Double object represent the same value.

TClrDoubleHelper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrDouble, ClrVariant) object.

7.1.1.8.1.1.1.1.3 TClrDoubleHelper.Equals Method (ClrDouble, ClrDouble)


Returns a value indicating whether this instance and a specified Double object represent the same value.

Syntax
Delphi

class function Equals(D: ClrDouble; AObj: ClrDouble): ClrBoolean;


overload; reintroduce;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.3 TClrDoubleHelper.Equals Method (ClrDouble, ClrVariant)


Returns a value indicating whether this instance is equal to a specified object.

Syntax
Delphi

class function Equals(D: ClrDouble; AObj: ClrVariant): ClrBoolean;


overload; reintroduce;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

590
.Net Runtime Library for Delphi

7.1.1.8.1.1.1.1.4 TClrDoubleHelper.GetHashCode Method

Returns the hash code for this instance.

Syntax
Delphi

class function GetHashCode(D: ClrDouble): ClrInt32; reintroduce;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.5 TClrDoubleHelper.IsInfinity Method

Returns a value indicating whether the specified number evaluates to negative or positive infinity

Syntax
Delphi

class function IsInfinity(D: ClrDouble): ClrBoolean;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.6 TClrDoubleHelper.IsNaN Method

Returns a value that indicates whether the specified value is not a number.

Syntax
Delphi

class function IsNaN(D: ClrDouble): ClrBoolean;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.7 TClrDoubleHelper.IsNegativeInfinity Method

Returns a value indicating whether the specified number evaluates to negative infinity.

Syntax
Delphi

591
.Net Runtime Library for Delphi

class function IsNegativeInfinity(D: ClrDouble): ClrBoolean;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.8 TClrDoubleHelper.IsPositiveInfinity Method

Returns a value indicating whether the specified number evaluates to positive infinity.

Syntax
Delphi

class function IsPositiveInfinity(D: ClrDouble): ClrBoolean;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.9 TClrDoubleHelper.MaxValue Method

Represents the largest possible value of a Double.

Syntax
Delphi

class function MaxValue: ClrDouble;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.10 TClrDoubleHelper.MinValue Method

Represents the smallest possible value of a Double.

Syntax
Delphi

class function MinValue: ClrDouble;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

592
.Net Runtime Library for Delphi

7.1.1.8.1.1.1.1.11 TClrDoubleHelper.NaN Method

Represents a value that is not a number (NaN).

Syntax
Delphi

class function NaN: ClrDouble;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.12 TClrDoubleHelper.NegativeInfinity Method

Represents negative infinity.

Syntax
Delphi

class function NegativeInfinity: ClrDouble;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.13 Parse Method

This is the overview for the Parse method overload.

Overload List

Name Description

TClrDoubleHelper.Parse Converts the string representation of a number to its double-precision


(ClrWString) floating-point number equivalent.

TClrDoubleHelper.Parse Converts the string representation of a number in a specified culture-


(ClrWString, specific format to its double-precision floating-point number
equivalent.
IFormatProvider)

TClrDoubleHelper.Parse Converts the string representation of a number in a specified style to


(ClrWString, TNumberStyles) its double-precision floating-point number equivalent.

TClrDoubleHelper.Parse Converts the string representation of a number in a specified style and


(ClrWString, TNumberStyles, culture-specific format to its double-precision floating-point number

593
.Net Runtime Library for Delphi

Name Description

IFormatProvider) equivalent.

7.1.1.8.1.1.1.1.13 TClrDoubleHelper.Parse Method (ClrWString)


Converts the string representation of a number to its double-precision floating-point number equivalent.

Syntax
Delphi

class function Parse(S: ClrWString): ClrDouble; overload;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.13 TClrDoubleHelper.Parse Method (ClrWString, IFormatProvider)


Converts the string representation of a number in a specified culture-specific format to its double-precision floating-
point number equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AProvider: IFormatProvider):


ClrDouble; overload;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.13 TClrDoubleHelper.Parse Method (ClrWString, TNumberStyles)


Converts the string representation of a number in a specified style to its double-precision floating-point number
equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles): ClrDouble;


overload;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

594
.Net Runtime Library for Delphi

7.1.1.8.1.1.1.1.13 TClrDoubleHelper.Parse Method (ClrWString, TNumberStyles,


IFormatProvider)
Converts the string representation of a number in a specified style and culture-specific format to its double-precision
floating-point number equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles; AProvider:


IFormatProvider): ClrDouble; overload;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.14 TClrDoubleHelper.PositiveInfinity Method

Represents positive infinity.

Syntax
Delphi

class function PositiveInfinity: ClrDouble;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.15 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrDoubleHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrDouble) representation.

TClrDoubleHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrDouble, ClrWString) representation, using the specified format.

TClrDoubleHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrDouble, ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

595
.Net Runtime Library for Delphi

Name Description

TClrDoubleHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrDouble, IFormatProvider) representation using the specified culture-specific format information.

7.1.1.8.1.1.1.1.15 TClrDoubleHelper.ToString Method (ClrDouble)


Converts the numeric value of this instance to its equivalent string representation.

Syntax
Delphi

class function ToString(D: ClrDouble): ClrWString; overload;


reintroduce;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.15 TClrDoubleHelper.ToString Method (ClrDouble, ClrWString)


Converts the numeric value of this instance to its equivalent string representation, using the specified format.

Syntax
Delphi

class function ToString(D: ClrDouble; AFormat: ClrWString):


ClrWString; overload; reintroduce;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.15 TClrDoubleHelper.ToString Method (ClrDouble, ClrWString,


IFormatProvider)
Converts the numeric value of this instance to its equivalent string representation using the specified format and
culture-specific format information.

Syntax
Delphi

class function ToString(D: ClrDouble; AFormat: ClrWString; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also

596
.Net Runtime Library for Delphi

TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.15 TClrDoubleHelper.ToString Method (ClrDouble, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific
format information.

Syntax
Delphi

class function ToString(D: ClrDouble; AProvider: IFormatProvider):


ClrWString; overload; reintroduce;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.16 TryParse Method

This is the overview for the TryParse method overload.

Overload List

Name Description

TClrDoubleHelper.TryParse Converts the string representation of a number to its double-precision


(ClrWString, ClrDouble) floating-point number equivalent. A return value indicates whether
the conversion succeeded or failed.

TClrDoubleHelper.TryParse Converts the string representation of a number in a specified style and


(ClrWString, TNumberStyles, culture-specific format to its double-precision floating-point number
equivalent. A return value indicates whether the conversion succeeded
IFormatProvider, ClrDouble)
or failed.

7.1.1.8.1.1.1.1.16 TClrDoubleHelper.TryParse Method (ClrWString, ClrDouble)


Converts the string representation of a number to its double-precision floating-point number equivalent. A return value
indicates whether the conversion succeeded or failed.

Syntax
Delphi

class function TryParse(S: ClrWString; var AResult: ClrDouble):


ClrBoolean; overload;

See Also

597
.Net Runtime Library for Delphi

TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.1.1.16 TClrDoubleHelper.TryParse Method (ClrWString, TNumberStyles,


IFormatProvider, ClrDouble)
Converts the string representation of a number in a specified style and culture-specific format to its double-precision
floating-point number equivalent. A return value indicates whether the conversion succeeded or failed.

Syntax
Delphi

class function TryParse(S: ClrWString; AStyle: TNumberStyles;


AProvider: IFormatProvider; var AResult: ClrDouble): ClrBoolean;
overload;

See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2 TClrInt64Helper Class


Collapse All Expand All

Helper class for Int64 Data Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrInt64Helper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrInt64Helper = class;

Methods

Name Description

CompareTo(ClrInt64, Compares this instance to a specified 64-bit signed integer and


ClrInt64) returns an indication of their relative values .

598
.Net Runtime Library for Delphi

Name Description

CompareTo(ClrInt64, Compares this instance to a specified object and returns an indication


ClrVariant) of their relative values .

Equals(ClrInt64, ClrInt64) Returns a value indicating whether this instance is equal to a specified
Int64 value.

Equals(ClrInt64, ClrVariant) Returns a value indicating whether this instance is equal to a specified
object.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of an Int64 .

MinValue Represents the smallest possible value of an Int64 .

Parse(ClrWString) Converts the string representation of a number to its 64-bit signed


integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its 64-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its 64-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 64-bit signed integer equivalent.

IFormatProvider)

ToString(ClrInt64) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrInt64, Converts the numeric value of this instance to its equivalent string
ClrWString) representation, using the specified format.

ToString(ClrInt64, Converts the numeric value of this instance to its equivalent


ClrWString, string representation using the specified format and culture-
IFormatProvider) specific format information.

ToString(ClrInt64, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Converts the string representation of a number to its 64-bit signed


ClrInt64) integer equivalent. A return value indicates whether the conversion
succeeded or failed.

599
.Net Runtime Library for Delphi

Name Description

TryParse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 64-bit signed integer equivalent. A return
value indicates whether the conversion succeeded or failed.
IFormatProvider, ClrInt64)

See Also
TClrInt64Helper Methods

7.1.1.8.1.1.2.1 TClrInt64Helper Methods

The methods of the TClrInt64Helper class are listed here.

Methods

Name Description

CompareTo(ClrInt64, Compares this instance to a specified 64-bit signed integer and


ClrInt64) returns an indication of their relative values .

CompareTo(ClrInt64, Compares this instance to a specified object and returns an indication


ClrVariant) of their relative values .

Equals(ClrInt64, ClrInt64) Returns a value indicating whether this instance is equal to a specified
Int64 value.

Equals(ClrInt64, ClrVariant) Returns a value indicating whether this instance is equal to a specified
object.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of an Int64.

MinValue Represents the smallest possible value of an Int64.

Parse(ClrWString) Converts the string representation of a number to its 64-bit signed


integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its 64-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its 64-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles,

600
.Net Runtime Library for Delphi

Name Description

IFormatProvider) culture-specific format to its 64-bit signed integer equivalent.

ToString(ClrInt64) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrInt64, Converts the numeric value of this instance to its equivalent string
ClrWString) representation, using the specified format.

ToString(ClrInt64, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

ToString(ClrInt64, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Converts the string representation of a number to its 64-bit signed


ClrInt64) integer equivalent. A return value indicates whether the conversion
succeeded or failed.

TryParse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 64-bit signed integer equivalent. A return
value indicates whether the conversion succeeded or failed.
IFormatProvider, ClrInt64)

7.1.1.8.1.1.2.1.1 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

Name Description

TClrInt64Helper.CompareTo Compares this instance to a specified 64-bit signed integer and


(ClrInt64, ClrInt64) returns an indication of their relative values.

TClrInt64Helper.CompareTo Compares this instance to a specified object and returns an indication


(ClrInt64, ClrVariant) of their relative values.

7.1.1.8.1.1.2.1.1 TClrInt64Helper.CompareTo Method (ClrInt64, ClrInt64)


Compares this instance to a specified 64-bit signed integer and returns an indication of their relative values.

Syntax
Delphi

601
.Net Runtime Library for Delphi

class function CompareTo(X: ClrInt64; Y: ClrInt64): ClrInt32;


overload;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.1 TClrInt64Helper.CompareTo Method (ClrInt64, ClrVariant)


Compares this instance to a specified object and returns an indication of their relative values.

Syntax
Delphi

class function CompareTo(I64: ClrInt64; AValue: ClrVariant): ClrInt32;


overload;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.2 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrInt64Helper.Equals Returns a value indicating whether this instance isequal to a specified


(ClrInt64, ClrInt64) Int64 value.

TClrInt64Helper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrInt64, ClrVariant) object.

7.1.1.8.1.1.2.1.2 TClrInt64Helper.Equals Method (ClrInt64, ClrInt64)


Returns a value indicating whether this instance is equal to a specified Int64 value.

Syntax
Delphi

class function Equals(X: ClrInt64; Y: ClrInt64): ClrBoolean; overload;


reintroduce;

See Also

602
.Net Runtime Library for Delphi

TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.2 TClrInt64Helper.Equals Method (ClrInt64, ClrVariant)


Returns a value indicating whether this instance is equal to a specified object.

Syntax
Delphi

class function Equals(I64: ClrInt64; AObj: ClrVariant): ClrBoolean;


overload; reintroduce;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.3 TClrInt64Helper.GetHashCode Method

Returns the hash code for this instance.

Syntax
Delphi

class function GetHashCode(I64: ClrInt64): ClrInt32; reintroduce;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.4 TClrInt64Helper.MaxValue Method

Represents the largest possible value of an Int64.

Syntax
Delphi

class function MaxValue: ClrInt64;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.5 TClrInt64Helper.MinValue Method

Represents the smallest possible value of an Int64.

Syntax

603
.Net Runtime Library for Delphi

Delphi

class function MinValue: ClrInt64;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.6 Parse Method

This is the overview for the Parse method overload.

Overload List

Name Description

TClrInt64Helper.Parse Converts the string representation of a number to its 64-bit signed


(ClrWString) integer equivalent.

TClrInt64Helper.Parse Converts the string representation of a number in a specified culture-


(ClrWString, specific format to its 64-bit signed integer equivalent.

IFormatProvider)

TClrInt64Helper.Parse Converts the string representation of a number in a specified style to


(ClrWString, TNumberStyles) its 64-bit signed integer equivalent.

TClrInt64Helper.Parse Converts the string representation of a number in a specified style and


(ClrWString, TNumberStyles, culture-specific format to its 64-bit signed integer equivalent.

IFormatProvider)

7.1.1.8.1.1.2.1.6 TClrInt64Helper.Parse Method (ClrWString)


Converts the string representation of a number to its 64-bit signed integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString): ClrInt64; overload;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.6 TClrInt64Helper.Parse Method (ClrWString, IFormatProvider)


Converts the string representation of a number in a specified culture-specific format to its 64-bit signed integer
equivalent.

604
.Net Runtime Library for Delphi

Syntax
Delphi

class function Parse(S: ClrWString; AProvider: IFormatProvider):


ClrInt64; overload;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.6 TClrInt64Helper.Parse Method (ClrWString, TNumberStyles)


Converts the string representation of a number in a specified style to its 64-bit signed integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles): ClrInt64;


overload;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.6 TClrInt64Helper.Parse Method (ClrWString, TNumberStyles, IFormatProvider)


Converts the string representation of a number in a specified style and culture-specific format to its 64-bit signed
integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles; AProvider:


IFormatProvider): ClrInt64; overload;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.7 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

605
.Net Runtime Library for Delphi

Name Description

TClrInt64Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt64) representation.

TClrInt64Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt64, ClrWString) representation, using the specified format.

TClrInt64Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt64, ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

TClrInt64Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt64, IFormatProvider) representation using the specified culture-specific format information.

7.1.1.8.1.1.2.1.7 TClrInt64Helper.ToString Method (ClrInt64)


Converts the numeric value of this instance to its equivalent string representation.

Syntax
Delphi

class function ToString(I64: ClrInt64): ClrWString; overload;


reintroduce;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.7 TClrInt64Helper.ToString Method (ClrInt64, ClrWString)


Converts the numeric value of this instance to its equivalent string representation, using the specified format.

Syntax
Delphi

class function ToString(I64: ClrInt64; AFormat: ClrWString):


ClrWString; overload; reintroduce;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.7 TClrInt64Helper.ToString Method (ClrInt64, ClrWString, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the
specified format and culture-specific format information.

606
.Net Runtime Library for Delphi

Syntax
Delphi

class function ToString(I64: ClrInt64; AFormat: ClrWString; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.7 TClrInt64Helper.ToString Method (ClrInt64, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific
format information.

Syntax
Delphi

class function ToString(I64: ClrInt64; AProvider: IFormatProvider):


ClrWString; overload; reintroduce;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.8 TryParse Method

This is the overview for the TryParse method overload.

Overload List

Name Description

TClrInt64Helper.TryParse Converts the string representation of a number to its 64-bit signed


(ClrWString, ClrInt64) integer equivalent. A return value indicates whether the conversion
succeeded or failed.

TClrInt64Helper.TryParse Converts the string representation of a number in a specified style and


(ClrWString, TNumberStyles, culture-specific format to its 64-bit signed integer equivalent. A return
value indicates whether the conversion succeeded or failed.
IFormatProvider, ClrInt64)

7.1.1.8.1.1.2.1.8 TClrInt64Helper.TryParse Method (ClrWString, ClrInt64)


Converts the string representation of a number to its 64-bit signed integer equivalent. A return value indicates whether
the conversion succeeded or failed.

Syntax

607
.Net Runtime Library for Delphi

Delphi

class function TryParse(S: ClrWString; var AResult: ClrInt64):


ClrBoolean; overload;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.2.1.8 TClrInt64Helper.TryParse Method (ClrWString, TNumberStyles,


IFormatProvider, ClrInt64)
Converts the string representation of a number in a specified style and culture-specific format to its 64-bit signed
integer equivalent. A return value indicates whether the conversion succeeded or failed.

Syntax
Delphi

class function TryParse(S: ClrWString; AStyle: TNumberStyles;


AProvider: IFormatProvider; var AResult: ClrInt64): ClrBoolean;
overload;

See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3 TClrBitConverter Class


Collapse All Expand All

Converts base data types to an array of bytes, and an array of bytes to base data types.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrBitConverter

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrBitConverter = class;

Methods

608
.Net Runtime Library for Delphi

Name Description

DoubleToInt64Bits Converts the specified double-precision floating point number to a


64-bit signed integer.

GetBytes(ClrBoolean) Returns the specified Boolean value as a byte array.

GetBytes(ClrChar) Returns the specified Unicode character value as an array of bytes.

GetBytes(ClrDouble) Returns the specified double-precision floating point value as an array


of bytes.

GetBytes(ClrInt16) Returns the specified 16-bit signed integer value as an array of bytes.

GetBytes(ClrInt32) Returns the specified 32-bit signed integer value as an array of bytes.

GetBytes(ClrInt64) Returns the specified 64-bit signed integer value as an array of bytes.

GetBytes(ClrSingle) Returns the specified single-precision floating point value as an array


of bytes.

GetBytes(ClrUInt16) Returns the specified 16-bit unsigned integer value as an array of


bytes.

GetBytes(ClrUInt32) Returns the specified 32-bit unsigned integer value as an array of


bytes.

GetBytes(ClrUInt64) Returns the specified 64-bit unsigned integer value as an array of


bytes.

GetBytes(ClrWChar) Returns the specified Unicode character value as an array of bytes.

GetDefaultInterface Get the BitConverter interface.

Int64BitsToDouble Converts the specified 64-bit signed integer to a double-precision


floating point number.

ToBoolean Returns a Boolean value converted from the byte at a specified


position in a byte array.

ToChar Returns a Unicode character converted from two bytes at a specified


position in a byte array.

ToClrChar Returns a Unicode clr character converted from two bytes at a


specified position in a byte array.

ToDouble Returns a double-precision floating point number converted from

609
.Net Runtime Library for Delphi

Name Description

eight bytes at a specified position in a byte array.

ToInt16 Returns a 16-bit signed integer converted from two bytes at a


specified position in a byte array.

ToInt32 Returns a 32-bit signed integer converted from four bytes at a


specified position in a byte array.

ToInt64 Returns a 64-bit signed integer converted from eight bytes at a


specified position in a byte array.

ToSingle Returns a single-precision floating point number converted from four


bytes at a specified position in a byte array.

ToString(_ByteArray) Converts the numeric value of each element of a specified array of


bytes to its equivalent hexadecimal string representation.

ToString(_ByteArray, Converts the numeric value of each element of a specified subarray of


ClrInt32) bytes to its equivalent hexadecimal string representation.

ToString(_ByteArray, Converts the numeric value of each element of a specified subarray of


ClrInt32, ClrInt32) bytes to its equivalent hexadecimal string representation.

ToUInt16 Returns a 16-bit unsigned integer converted from two bytes at a


specified position in a byte array.

ToUInt32 Returns a 32-bit unsigned integer converted from four bytes at a


specified position in a byte array.

ToUInt64 Returns a 64-bit unsigned integer converted from eight bytes at a


specified position in a byte array.

Properties

Name Description

IsLittleEndian Indicates the byte order ("endianness") in which data is stored in this
computer architecture.

See Also
TClrBitConverter Methods
TClrBitConverter Properties

610
.Net Runtime Library for Delphi

7.1.1.8.1.1.3.1 TClrBitConverter Methods

The methods of the TClrBitConverter class are listed here.

Methods

Name Description

DoubleToInt64Bits Converts the specified double-precision floating point number to a


64-bit signed integer.

GetBytes(ClrBoolean) Returns the specified Boolean value as a byte array.

GetBytes(ClrChar) Returns the specified Unicode character value as an array of bytes.

GetBytes(ClrDouble) Returns the specified double-precision floating point value as an array


of bytes.

GetBytes(ClrInt16) Returns the specified 16-bit signed integer value as an array of bytes.

GetBytes(ClrInt32) Returns the specified 32-bit signed integer value as an array


of bytes.

GetBytes(ClrInt64) Returns the specified 64-bit signed integer value as an array of bytes.

GetBytes(ClrSingle) Returns the specified single-precision floating point value as an array


of bytes.

GetBytes(ClrUInt16) Returns the specified 16-bit unsigned integer value as an array of


bytes.

GetBytes(ClrUInt32) Returns the specified 32-bit unsigned integer value as an array of


bytes.

GetBytes(ClrUInt64) Returns the specified 64-bit unsigned integer value as an array of


bytes.

GetBytes(ClrWChar) Returns the specified Unicode character value as an array of bytes.

GetDefaultInterface Get the BitConverter interface.

Int64BitsToDouble Converts the specified 64-bit signed integer to a double-precision


floating point number.

ToBoolean Returns a Boolean value converted from the byte at a


specified position in a byte array.

611
.Net Runtime Library for Delphi

Name Description

ToChar Returns a Unicode character converted from two bytes at a specified


position in a byte array.

ToClrChar Returns a Unicode clr character converted from two bytes at a


specified position in a byte array.

ToDouble Returns a double-precision floating point number converted from


eight bytes at a specified position in a byte array.

ToInt16 Returns a 16-bit signed integer converted from two bytes at a


specified position in a byte array.

ToInt32 Returns a 32-bit signed integer converted from four bytes at a


specified position in a byte array.

ToInt64 Returns a 64-bit signed integer converted from eight bytes at a


specified position in a byte array.

ToSingle Returns a single-precision floating point number converted from four


bytes at a specified position in a byte array.

ToString(_ByteArray) Converts the numeric value of each element of a specified array of


bytes to its equivalent hexadecimal string representation.

ToString(_ByteArray, Converts the numeric value of each element of a specified


ClrInt32) subarray of bytes to its equivalent hexadecimal string
representation.

ToString(_ByteArray, Converts the numeric value of each element of a specified subarray of


ClrInt32, ClrInt32) bytes to its equivalent hexadecimal string representation.

ToUInt16 Returns a 16-bit unsigned integer converted from two bytes at a


specified position in a byte array.

ToUInt32 Returns a 32-bit unsigned integer converted from four bytes at a


specified position in a byte array.

ToUInt64 Returns a 64-bit unsigned integer converted from eight bytes at a


specified position in a byte array.

7.1.1.8.1.1.3.1.1 TClrBitConverter.DoubleToInt64Bits Method

Converts the specified double-precision floating point number to a 64-bit signed integer.

Syntax

612
.Net Runtime Library for Delphi

Delphi

class function DoubleToInt64Bits(AValue: ClrDouble): ClrInt64;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.2 GetBytes Method

This is the overview for the GetBytes method overload.

Overload List

Name Description

TClrBitConverter.GetBytes Returns the specified Boolean value as a byte array.


(ClrBoolean)

TClrBitConverter.GetBytes Returns the specified Unicode Clr character value as an array of bytes.
(ClrChar)

TClrBitConverter.GetBytes Returns the specified double-precision floating point value as an array


(ClrDouble) of bytes.

TClrBitConverter.GetBytes Returns the specified 16-bit signed integer value as an array of bytes.
(ClrInt16)

TClrBitConverter.GetBytes Returns the specified 32-bit signed integer value as an array of bytes.
(ClrInt32)

TClrBitConverter.GetBytes Returns the specified 64-bit signed integer value as an array of bytes.
(ClrInt64)

TClrBitConverter.GetBytes Returns the specified single-precision floating point value as an array


(ClrSingle) of bytes.

TClrBitConverter.GetBytes Returns the specified 16-bit unsigned integer value as an array of


(ClrUInt16) bytes.

TClrBitConverter.GetBytes Returns the specified 32-bit unsigned integer value as an array of


(ClrUInt32) bytes.

TClrBitConverter.GetBytes Returns the specified 64-bit unsigned integer value as an array of


(ClrUInt64) bytes.

613
.Net Runtime Library for Delphi

Name Description

TClrBitConverter.GetBytes Returns the specified Unicode character value as an array of bytes.


(ClrWChar)

7.1.1.8.1.1.3.1.2 TClrBitConverter.GetBytes Method (ClrBoolean)


Returns the specified Boolean value as a byte array.

Syntax
Delphi

class function GetBytes(AValue: ClrBoolean): _ByteArray; overload;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.2 TClrBitConverter.GetBytes Method (ClrChar)


Returns the specified Unicode Clr character value as an array of bytes.

Syntax
Delphi

class function GetBytes(AValue: ClrChar): _ByteArray; overload;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.2 TClrBitConverter.GetBytes Method (ClrDouble)


Returns the specified double-precision floating point value as an array of bytes.

Syntax
Delphi

class function GetBytes(AValue: ClrDouble): _ByteArray; overload;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.2 TClrBitConverter.GetBytes Method (ClrInt16)

614
.Net Runtime Library for Delphi

Returns the specified 16-bit signed integer value as an array of bytes.

Syntax
Delphi

class function GetBytes(AValue: ClrInt16): _ByteArray; overload;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.2 TClrBitConverter.GetBytes Method (ClrInt32)


Returns the specified 32-bit signed integer value as an array of bytes.

Syntax
Delphi

class function GetBytes(AValue: ClrInt32): _ByteArray; overload;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.2 TClrBitConverter.GetBytes Method (ClrInt64)


Returns the specified 64-bit signed integer value as an array of bytes.

Syntax
Delphi

class function GetBytes(AValue: ClrInt64): _ByteArray; overload;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.2 TClrBitConverter.GetBytes Method (ClrSingle)


Returns the specified single-precision floating point value as an array of bytes.

Syntax
Delphi

class function GetBytes(AValue: ClrSingle): _ByteArray; overload;

615
.Net Runtime Library for Delphi

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.2 TClrBitConverter.GetBytes Method (ClrUInt16)


Returns the specified 16-bit unsigned integer value as an array of bytes.

Syntax
Delphi

class function GetBytes(AValue: ClrUInt16): _ByteArray; overload;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.2 TClrBitConverter.GetBytes Method (ClrUInt32)


Returns the specified 32-bit unsigned integer value as an array of bytes.

Syntax
Delphi

class function GetBytes(AValue: ClrUInt32): _ByteArray; overload;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.2 TClrBitConverter.GetBytes Method (ClrUInt64)


Returns the specified 64-bit unsigned integer value as an array of bytes.

Syntax
Delphi

class function GetBytes(AValue: ClrUInt64): _ByteArray; overload;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.2 TClrBitConverter.GetBytes Method (ClrWChar)


Returns the specified Unicode character value as an array of bytes.

616
.Net Runtime Library for Delphi

Syntax
Delphi

class function GetBytes(AValue: ClrWChar): _ByteArray; overload;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.3 TClrBitConverter.GetDefaultInterface Method


Get the BitConverter interface.

Syntax
Delphi

class function GetDefaultInterface: _BitConverter;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.4 TClrBitConverter.Int64BitsToDouble Method

Converts the specified 64-bit signed integer to a double-precision floating point number.

Syntax
Delphi

class function Int64BitsToDouble(AValue: ClrInt64): Double;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.5 TClrBitConverter.ToBoolean Method

Returns a Boolean value converted from the byte at a specified position in a byte array.

Syntax
Delphi

class function ToBoolean(AValue: _ByteArray; AStartIndex: ClrInt32):


ClrBoolean; overload; reintroduce;

See Also

617
.Net Runtime Library for Delphi

TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.6 TClrBitConverter.ToChar Method

Returns a Unicode character converted from two bytes at a specified position in a byte array.

Syntax
Delphi

class function ToChar(AValue: _ByteArray; AStartIndex: ClrInt32):


ClrWChar; overload;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.7 TClrBitConverter.ToClrChar Method

Returns a Unicode Clr character converted from two bytes at a specified position in a byte array.

Syntax
Delphi

class function ToClrChar(AValue: _ByteArray; AStartIndex: ClrInt32):


ClrChar; overload;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.8 TClrBitConverter.ToDouble Method

Returns a double-precision floating point number converted from eight bytes at a specified position in a byte array.

Syntax
Delphi

class function ToDouble(AValue: _ByteArray; AStartIndex: ClrInt32):


ClrDouble;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

618
.Net Runtime Library for Delphi

7.1.1.8.1.1.3.1.9 TClrBitConverter.ToInt16 Method

Returns a 16-bit signed integer converted from two bytes at a specified position in a byte array.

Syntax
Delphi

class function ToInt16(AValue: _ByteArray; AStartIndex: ClrInt32):


ClrInt16;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.10 TClrBitConverter.ToInt32 Method

Returns a 32-bit signed integer converted from four bytes at a specified position in a byte array.

Syntax
Delphi

class function ToInt32(AValue: _ByteArray; AStartIndex: ClrInt32):


ClrInt32;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.11 TClrBitConverter.ToInt64 Method

Returns a 64-bit signed integer converted from eight bytes at a specified position in a byte array.

Syntax
Delphi

class function ToInt64(AValue: _ByteArray; AStartIndex: ClrInt32):


ClrInt64;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.12 TClrBitConverter.ToSingle Method

Returns a single-precision floating point number converted from four bytes at a specified position in a byte array.

Syntax

619
.Net Runtime Library for Delphi

Delphi

class function ToSingle(AValue: _ByteArray; AStartIndex: ClrInt32):


ClrSingle;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.13 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrBitConverter.ToString Converts the numeric value of each element of a specified array of


(_ByteArray) bytes to its equivalent hexadecimal string representation.

TClrBitConverter.ToString Converts the numeric value of each element of a specified subarray of


(_ByteArray, ClrInt32) bytes to its equivalent hexadecimal string representation.

TClrBitConverter.ToString Converts the numeric value of each element of a specified subarray of


(_ByteArray, ClrInt32, bytes to its equivalent hexadecimal string representation.

ClrInt32)

7.1.1.8.1.1.3.1.13 TClrBitConverter.ToString Method (_ByteArray)


Converts the numeric value of each element of a specified array of bytes to its equivalent
hexadecimal string representation.

Syntax
Delphi

class function ToString(AValue: _ByteArray): ClrWString; overload;


reintroduce;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.13 TClrBitConverter.ToString Method (_ByteArray, ClrInt32)


Converts the numeric value of each element of a specified subarray of bytes to its equivalent
hexadecimal string representation.

620
.Net Runtime Library for Delphi

Syntax
Delphi

class function ToString(AValue: _ByteArray; AStartIndex: ClrInt32):


ClrWString; overload; reintroduce;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.13 TClrBitConverter.ToString Method (_ByteArray, ClrInt32, ClrInt32)


Converts the numeric value of each element of a specified subarray of bytes to its equivalent hexadecimal string
representation.

Syntax
Delphi

class function ToString(AValue: _ByteArray; AStartIndex: ClrInt32;


ALength: ClrInt32): ClrWString; overload; reintroduce;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.14 TClrBitConverter.ToUInt16 Method

Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte array.

Syntax
Delphi

class function ToUInt16(AValue: _ByteArray; AStartIndex: ClrInt32):


ClrUInt16;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.15 TClrBitConverter.ToUInt32 Method

Returns a 32-bit unsigned integer converted from four bytes at a specified position in a byte array.

Syntax
Delphi

621
.Net Runtime Library for Delphi

class function ToUInt32(AValue: _ByteArray; AStartIndex: ClrInt32):


ClrUInt32;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.1.16 TClrBitConverter.ToUInt64 Method

Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a byte array.

Syntax
Delphi

class function ToUInt64(AValue: _ByteArray; AStartIndex: ClrInt32):


ClrUInt64;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.3.2 TClrBitConverter Properties

The properties of the TClrBitConverter class are listed here.

Properties

Name Description

IsLittleEndian Indicates the byte order ("endianness") in which data is stored in this
computer architecture.

7.1.1.8.1.1.3.2.1 TClrBitConverter.IsLittleEndian Property


Indicates the byte order ("endianness") in which data is stored in this computer architecture.

Syntax
Delphi

class property IsLittleEndian: ClrBoolean;

See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace

622
.Net Runtime Library for Delphi

7.1.1.8.1.1.4 TClrBooleanHelper Class


Collapse All Expand All

Helper class for Boolean Data Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrBooleanHelper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrBooleanHelper = class;

Methods

Name Description

CompareTo(ClrBoolean, Compares this instance to a specified Boolean object and returns an


ClrBoolean) integer that indicates their relationship to one another.

CompareTo(ClrBoolean, Compares this instance to a specified object and returns an integer


ClrVariant) that indicates their relationship to one another.

Equals(ClrBoolean, Returns a value indicating whether this instance is equal to a specified


ClrBoolean) Boolean object.

Equals(ClrBoolean, Returns a value indicating whether this instance is equal to a specified


ClrVariant) object.

FalseString Represents the Boolean value false as a string.

Parse Converts the specified string representation of a logical value to its


Boolean equivalent.

ToString(ClrBoolean) Converts the value of this instance to its equivalent string


representation (either "True" or "False").

ToString(ClrBoolean, Converts the value of this instance to its equivalent string


IFormatProvider) representation (either "True" or "False").

623
.Net Runtime Library for Delphi

Name Description

TrueString Represents the Boolean value true as a string.

TryParse Tries to convert the specified string representation of a logical value to


its Boolean equivalent. A return value indicates whether the
conversion succeeded or failed.

See Also
TClrBooleanHelper Methods

7.1.1.8.1.1.4.1 TClrBooleanHelper Methods

The methods of the TClrBooleanHelper class are listed here.

Methods

Name Description

CompareTo(ClrBoolean, Compares this instance to a specified Boolean object and returns


ClrBoolean) an integer that indicates their relationship to one another.

CompareTo(ClrBoolean, Compares this instance to a specified object and returns an integer


ClrVariant) that indicates their relationship to one another.

Equals(ClrBoolean, Returns a value indicating whether this instance is equal to a specified


ClrBoolean) boolean.

Equals(ClrBoolean, Returns a value indicating whether this instance is equal to a specified


ClrVariant) object.

FalseString Represents the Boolean value false as a string.

Parse Converts the specified string representation of a logical value to its


Boolean equivalent.

ToString(ClrBoolean) Converts the value of this instance to its equivalent string


representation (either "True" or "False").

ToString(ClrBoolean, Converts the value of this instance to its equivalent string


IFormatProvider) representation (either "True" or "False").

TrueString Represents the Boolean value true as a string.

TryParse Tries to convert the specified string representation of a logical value to


its Boolean equivalent. A return value indicates whether the

624
.Net Runtime Library for Delphi

Name Description

conversion succeeded or failed.

7.1.1.8.1.1.4.1.1 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

Name Description

TClrBooleanHelper.CompareTo Compares this instance to a specified Boolean object and


(ClrBoolean, ClrBoolean) returns an integer that indicates their relationship to one another.

TClrBooleanHelper.CompareTo Compares this instance to a specified object and returns an integer


(ClrBoolean, ClrVariant) that indicates their relationship to one another.

7.1.1.8.1.1.4.1.1 TClrBooleanHelper.CompareTo Method (ClrBoolean, ClrBoolean)


Compares this instance to a specified Boolean object and returns an integer that indicates their relationship
to one another.

Syntax
Delphi

class function CompareTo(X: ClrBoolean; Y: ClrBoolean): ClrInt32;


overload;

See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.4.1.1 TClrBooleanHelper.CompareTo Method (ClrBoolean, ClrVariant)


Compares this instance to a specified object and returns an integer that indicates their relationship to one another.

Syntax
Delphi

class function CompareTo(X: ClrBoolean; AObj: ClrVariant): ClrInt32;


overload;

See Also

625
.Net Runtime Library for Delphi

TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.4.1.2 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrBooleanHelper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrBoolean, ClrBoolean) Boolean object.

TClrBooleanHelper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrBoolean, ClrVariant) object.

7.1.1.8.1.1.4.1.2 TClrBooleanHelper.Equals Method (ClrBoolean, ClrBoolean)


Returns a value indicating whether this instance is equal to a specified boolean.

Syntax
Delphi

class function Equals(X: ClrBoolean; Y: ClrBoolean): ClrBoolean;


overload; reintroduce;

See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.4.1.2 TClrBooleanHelper.Equals Method (ClrBoolean, ClrVariant)


Returns a value indicating whether this instance is equal to a specified object.

Syntax
Delphi

class function Equals(X: ClrBoolean; AObj: ClrVariant): ClrBoolean;


overload; reintroduce;

See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace

626
.Net Runtime Library for Delphi

7.1.1.8.1.1.4.1.3 TClrBooleanHelper.FalseString Method

Represents the Boolean value false as a string.

Syntax
Delphi

class function FalseString: ClrWString;

See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.4.1.4 TClrBooleanHelper.Parse Method

Converts the specified string representation of a logical value to its Boolean equivalent.

Syntax
Delphi

class function Parse(AValue: ClrWString): ClrBoolean;

See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.4.1.5 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrBooleanHelper.ToString Converts the value of this instance to its equivalent string


(ClrBoolean) representation (either "True" or "False").

TClrBooleanHelper.ToString Converts the value of this instance to its equivalent string


(ClrBoolean, representation (either "True" or "False").

IFormatProvider)

7.1.1.8.1.1.4.1.5 TClrBooleanHelper.ToString Method (ClrBoolean)


Converts the value of this instance to its equivalent string representation (either "True" or "False").

Syntax

627
.Net Runtime Library for Delphi

Delphi

class function ToString(AValue: ClrBoolean): ClrWString; overload;


reintroduce;

See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.4.1.5 TClrBooleanHelper.ToString Method (ClrBoolean, IFormatProvider)


Converts the value of this instance to its equivalent string representation (either "True" or "False").

Syntax
Delphi

class function ToString(AValue: ClrBoolean; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.4.1.6 TClrBooleanHelper.TrueString Method

Represents the Boolean value true as a string.

Syntax
Delphi

class function TrueString: ClrWString;

See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.4.1.7 TClrBooleanHelper.TryParse Method

Tries to convert the specified string representation of a logical value to its Boolean equivalent. A return value indicates
whether the conversion succeeded or failed.

Syntax
Delphi

class function TryParse(AValue: ClrWString; var AResult: ClrBoolean):


ClrBoolean;

628
.Net Runtime Library for Delphi

See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5 TClrByteHelper Class


Collapse All Expand All

Helper class for Byte Data Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrByteHelper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrByteHelper = class;

Methods

Name Description

CompareTo(ClrByte, ClrByte) Compares this instance to a specified 8-bit unsigned integer and
returns an indication of their relative values.

CompareTo(ClrByte, Compares this instance to a specified object and returns an indication


ClrVariant) of their relative values.

Equals(ClrByte, ClrByte) Returns a value indicating whether this instance and a specified Byte
object represent the same value.

Equals(ClrByte, ClrVariant) Returns a value indicating whether this instance is equal to a specified
object.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of a Byte.

MinValue Represents the smallest possible value of a Byte.

629
.Net Runtime Library for Delphi

Name Description

Parse(ClrWString) Converts the string representation of a number to its Byte equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its Byte equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its Byte equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its Byte equivalent.

IFormatProvider)

ToString(ClrByte) Converts the value of the current Byte object to its equivalent string
representation.

ToString(ClrByte, ClrWString) Converts the value of the current Byte object to its equivalent string
representation using the specified format.

ToString(ClrByte, ClrWString, Converts the value of the current Byte object to its equivalent string
IFormatProvider) representation using the specified format and culture-specific
formatting information.

ToString(ClrByte, Converts the numeric value of the current Byte object to its equivalent
IFormatProvider) string representation using the specified culture-specific formatting
information.

TryParse(ClrWString, Tries to convert the string representation of a number to its Byte


ClrByte) equivalent, and returns a value that indicates whether the conversion
succeeded.

TryParse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its Byte equivalent. A return value indicates
whether the conversion succeeded or failed.
IFormatProvider, ClrByte)

See Also
TClrByteHelper Methods

7.1.1.8.1.1.5.1 TClrByteHelper Methods

The methods of the TClrByteHelper class are listed here.

Methods

Name Description

630
.Net Runtime Library for Delphi

Name Description

CompareTo(ClrByte, ClrByte) Compares this instance to a specified 8-bit unsigned integer and
returns an indication of their relative values.

CompareTo(ClrByte, Compares this instance to a specified variant and returns an indication


ClrVariant) of their relative values.

Equals(ClrByte, ClrByte) Returns a value indicating whether this instance and a specified Byte
object represent the same value.

Equals(ClrByte, ClrVariant) Returns a value indicating whether this instance is equal to a specified
object.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of a Byte .

MinValue Represents the smallest possible value of a Byte .

Parse(ClrWString) Converts the string representation of a number to its Byte equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its Byte equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its Byte quivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its Byte equivalent.

IFormatProvider)

ToString(ClrByte) Converts the value of the current Byte to its equivalent string
representation.

ToString(ClrByte, ClrWString) Converts the value of the current Byte to its equivalent string
representation using the specified format.

ToString(ClrByte, ClrWString, Converts the value of the current Byte to its equivalent string
IFormatProvider) representation using the specified format and culture-specific
formatting information.

ToString(ClrByte, Converts the numeric value of the current Byte object to its equivalent
IFormatProvider) string representation using the specified culture-specific formatting
information.

TryParse(ClrWString, Tries to convert the string representation of a number to its Byte


equivalent, and returns a value that indicates whether the conversion

631
.Net Runtime Library for Delphi

Name Description

ClrByte) succeeded.

TryParse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its Byte equivalent. A return value indicates
whether the conversion succeeded or failed.
IFormatProvider, ClrByte)

7.1.1.8.1.1.5.1.1 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

Name Description

TClrByteHelper.CompareTo Compares this instance to a specified 8-bit unsigned integer and


(ClrByte, ClrByte) returns an indication of their relative values.

TClrByteHelper.CompareTo Compares this instance to a specified object and returns an indication


(ClrByte, ClrVariant) of their relative values.

7.1.1.8.1.1.5.1.1 TClrByteHelper.CompareTo Method (ClrByte, ClrByte)


Compares this instance to a specified 8-bit unsigned integer and returns an indication of their relative values.

Syntax
Delphi

class function CompareTo(X: ClrByte; Y: ClrByte): ClrInt32; overload;

See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.1 TClrByteHelper.CompareTo Method (ClrByte, ClrVariant)


Compares this instance to a specified object and returns an indication of their relative values.

Syntax
Delphi

class function CompareTo(X: ClrByte; AObj: ClrVariant): ClrInt32;


overload;

632
.Net Runtime Library for Delphi

See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.2 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrByteHelper.Equals Returns a value indicating whether this instance and a specified Byte
(ClrByte, ClrByte) object represent the same value.

TClrByteHelper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrByte, ClrVariant) object.

7.1.1.8.1.1.5.1.2 TClrByteHelper.Equals Method (ClrByte, ClrByte)


Returns a value indicating whether this instance and a specified Byte object represent the same value.

Syntax
Delphi

class function Equals(X: ClrByte; Y: ClrByte): ClrBoolean; overload;


reintroduce;

See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.2 TClrByteHelper.Equals Method (ClrByte, ClrVariant)


Returns a value indicating whether this instance is equal to a specified object.

Syntax
Delphi

class function Equals(X: ClrByte; AObj: ClrVariant): ClrBoolean;


overload; reintroduce;

See Also

633
.Net Runtime Library for Delphi

TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.3 TClrByteHelper.GetHashCode Method

Returns the hash code for this instance.

Syntax
Delphi

class function GetHashCode(B: ClrByte): ClrInt32; reintroduce;

See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.4 TClrByteHelper.MaxValue Method

Represents the largest possible value of a Byte.

Syntax
Delphi

class function MaxValue: ClrByte;

See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.5 TClrByteHelper.MinValue Method

Represents the smallest possible value of a Byte.

Syntax
Delphi

class function MinValue: ClrByte;

See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.6 Parse Method

This is the overview for the Parse method overload.

Overload List

634
.Net Runtime Library for Delphi

Name Description

TClrByteHelper.Parse Converts the string representation of a number to its Byte equivalent.


(ClrWString)

TClrByteHelper.Parse Converts the string representation of a number in a specified culture-


(ClrWString, specific format to its Byte equivalent.

IFormatProvider)

TClrByteHelper.Parse Converts the string representation of a number in a specified style to


(ClrWString, TNumberStyles) its Byte equivalent.

TClrByteHelper.Parse Converts the string representation of a number in a specified style and


(ClrWString, TNumberStyles, culture-specific format to its Byte equivalent.

IFormatProvider)

7.1.1.8.1.1.5.1.6 TClrByteHelper.Parse Method (ClrWString)


Converts the string representation of a number to its Byte equivalent.

Syntax
Delphi

class function Parse(S: ClrWString): ClrByte; overload;

See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.6 TClrByteHelper.Parse Method (ClrWString, IFormatProvider)


Converts the string representation of a number in a specified culture-specific format to its Byte equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AProvider: IFormatProvider):


ClrByte; overload;

See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.6 TClrByteHelper.Parse Method (ClrWString, TNumberStyles)

635
.Net Runtime Library for Delphi

Converts the string representation of a number in a specified style to its Byte equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles): ClrByte;


overload;

See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.6 TClrByteHelper.Parse Method (ClrWString, TNumberStyles, IFormatProvider)


Converts the string representation of a number in a specified style and culture-specific format to its Byte equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles; AProvider:


IFormatProvider): ClrByte; overload;

See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.7 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrByteHelper.ToString Converts the value of the current Byte object to its equivalent string
(ClrByte) representation.

TClrByteHelper.ToString Converts the value of the current Byte object to its equivalent string
(ClrByte, ClrWString) representation using the specified format.

TClrByteHelper.ToString Converts the value of the current Byte object to its equivalent string
(ClrByte, ClrWString, representation using the specified format and culture-specific
formatting information.
IFormatProvider)

TClrByteHelper.ToString Converts the numeric value of the current Byte object to its equivalent
(ClrByte, IFormatProvider) string representation using the specified culture-specific formatting

636
.Net Runtime Library for Delphi

Name Description

information.

7.1.1.8.1.1.5.1.7 TClrByteHelper.ToString Method (ClrByte)


Converts the value of the current Byte object to its equivalent string representation.

Syntax
Delphi

class function ToString(B: ClrByte): ClrWString; overload;


reintroduce;

See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.7 TClrByteHelper.ToString Method (ClrByte, ClrWString)


Converts the value of the current Byte object to its equivalent string representation using the specified format.

Syntax
Delphi

class function ToString(B: ClrByte; AFormat: ClrWString): ClrWString;


overload; reintroduce;

See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.7 TClrByteHelper.ToString Method (ClrByte, ClrWString, IFormatProvider)


Converts the value of the current Byte object to its equivalent string representation using the specified format and
culture-specific formatting information.

Syntax
Delphi

class function ToString(B: ClrByte; AFormat: ClrWString; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also

637
.Net Runtime Library for Delphi

TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.7 TClrByteHelper.ToString Method (ClrByte, IFormatProvider)


Converts the numeric value of the current Byte object to its equivalent string representation using the specified culture-
specific formatting information.

Syntax
Delphi

class function ToString(B: ClrByte; AProvider: IFormatProvider):


ClrWString; overload; reintroduce;

See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.8 TryParse Method

This is the overview for the TryParse method overload.

Overload List

Name Description

TClrByteHelper.TryParse Tries to convert the string representation of a number to its Byte


(ClrWString, ClrByte) equivalent, and returns a value that indicates whether the conversion
succeeded.

TClrByteHelper.TryParse Converts the string representation of a number in a specified style and


(ClrWString, TNumberStyles, culture-specific format to its Byte equivalent. A return value indicates
whether the conversion succeeded or failed.
IFormatProvider, ClrByte)

7.1.1.8.1.1.5.1.8 TClrByteHelper.TryParse Method (ClrWString, ClrByte)


Tries to convert the string representation of a number to its Byte equivalent, and returns a value that indicates whether
the conversion succeeded.

Syntax
Delphi

class function TryParse(S: ClrWString; var AResult: ClrByte):


ClrBoolean; overload;

See Also

638
.Net Runtime Library for Delphi

TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.5.1.8 TClrByteHelper.TryParse Method (ClrWString, TNumberStyles,


IFormatProvider, ClrByte)
Converts the string representation of a number in a specified style and culture-specific format to its Byte equivalent. A
return value indicates whether the conversion succeeded or failed.

Syntax
Delphi

class function TryParse(S: ClrWString; AStyle: TNumberStyles;


AProvider: IFormatProvider; var AResult: ClrByte): ClrBoolean;
overload;

See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6 TClrCharHelper Class


Collapse All Expand All

Helper class for Char Data Type and _Char interface Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrCharHelper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrCharHelper = class;

Methods

Name Description

CompareTo(ClrWChar, Compares this instance to a specified object and indicates whether


ClrVariant) this instance precedes, follows, or appears in the same position in
the sort order as the specified variant .

CompareTo(ClrWChar, Compares this instance to a specified Char object and indicates


ClrWChar) whether this instance precedes, follows, or appears in the same

639
.Net Runtime Library for Delphi

Name Description

position in the sort order as the specified Char variant .

ConvertFromUtf32 Converts the specified Unicode code point into a UTF-16 encoded
string.

ConvertToUtf32(ClrChar, Converts the value of a UTF-16 encoded surrogate pair into


ClrChar) a Unicode code point.

ConvertToUtf32(ClrWChar, Converts the value of a UTF-16 encoded surrogate pair into a


ClrWChar) Unicode code point.

ConvertToUtf32(ClrWString, Converts the value of a UTF-16 encoded character or surrogate pair


ClrInt32) at a specified position in a string into a Unicode code point.

Equals(ClrWChar, ClrVariant) Returns a value that indicates whether this instance is equal to a
specified object.

Equals(ClrWChar, ClrWChar) Returns a value that indicates whether this instance is equal to the
specified Char object.

GetHashCode Returns the hash code for this instance.

GetNumericValue(ClrWChar) Converts the specified numeric Unicode character to a double-


precision floating point number.

GetNumericValue(ClrWString, Converts the numeric Unicode character at the specified position in


ClrInt32) a specified string to a double-precision floating point number.

GetUnicodeCategory(ClrWChar) Categorizes a specified Unicode character into a group identified by


one of the UnicodeCategory values.

GetUnicodeCategory(ClrWString, Categorizes the character at the specified position in a specified


ClrInt32) string into a group identified by one of the UnicodeCategory values.

IsControl(ClrWChar) Indicates whether the specified Unicode character is categorized as


a control character.

IsControl(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as a control character.

IsDigit(ClrWChar) Indicates whether the specified Unicode character is categorized as


a decimal digit.

IsDigit(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as a decimal digit.

640
.Net Runtime Library for Delphi

Name Description

IsHighSurrogate(ClrWChar) Indicates whether the specified Char object is a high surrogate.

IsHighSurrogate(ClrWString, Indicates whether the Char object at the specified position in a


ClrInt32) string is a high surrogate.

IsLetter(ClrWChar) Indicates whether the specified Unicode character is


categorized as a Unicode letter.

IsLetter(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as a Unicode letter.

IsLetterOrDigit(ClrWChar) Indicates whether the specified Unicode character is categorized as


a letter or a decimal digit.

IsLetterOrDigit(ClrWString, Indicates whether the character at the specified position in a


ClrInt32) specified string is categorized as a letter or a decimal digit.

IsLower(ClrWChar) Indicates whether the specified Unicode character is categorized as


a lowercase letter.

IsLower(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as a lowercase letter.

IsLowSurrogate(ClrWChar) Indicates whether the specified Char object is a low surrogate.

IsLowSurrogate(ClrWString, Indicates whether the Char object at the specified position in a


ClrInt32) string is a low surrogate.

IsNumber(ClrWChar) Indicates whether the specified Unicode character is categorized as


a number.

IsNumber(ClrWString, ClrInt32) Indicates whether the character at the specified position in


a specified string is categorized as a number.

IsPunctuation(ClrWChar) Indicates whether the specified Unicode character is categorized as


a punctuation mark.

IsPunctuation(ClrWString, Indicates whether the character at the specified position in a


ClrInt32) specified string is categorized as a punctuation mark.

IsSeparator(ClrWChar) Indicates whether the specified Unicode character is categorized as


a separator character.

IsSeparator(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as a separator character.

641
.Net Runtime Library for Delphi

Name Description

IsSurrogate(ClrWChar) Indicates whether the specified character has a surrogate code unit.

IsSurrogate(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string has a surrogate code unit.

IsSurrogatePair(ClrWChar, Indicates whether the two specified Char objects form a surrogate
ClrWChar) pair.

IsSurrogatePair(ClrWString, Indicates whether two adjacent Char objects at a specified position


ClrInt32) in a string form a surrogate pair.

IsSymbol(ClrWChar) Indicates whether the specified Unicode character is


categorized as a symbol character.

IsSymbol(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as a symbol character.

IsUpper(ClrWChar) Indicates whether the specified Unicode character is categorized as


an uppercase letter.

IsUpper(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as an uppercase letter.

IsWhiteSpace(ClrWChar) Indicates whether the specified Unicode character is categorized as


white space.

IsWhiteSpace(ClrWString, Indicates whether the character at the specified position in a


ClrInt32) specified string is categorized as white space.

MaxValue Represents the largest possible value of a Char .

MinValue Represents the smallest possible value of a Char .

Parse Converts the value of the specified string to its equivalent Unicode
character.

ToAnsiChar(ClrChar) Converts the value of the specified Clr Character interface to Ansi
character.

ToAnsiChar(ClrVariant) Converts the value of the specified variant to Ansi character.

ToChar(ClrChar) Converts the value of the specified Clr Character interface to its
equivalent Unicode character.

ToChar(ClrVariant) Converts the value of the specified variant to Unicode character.

642
.Net Runtime Library for Delphi

Name Description

ToClrChar(ClrInt32) Converts the value of the specified integer to Clr character interface.

ToClrChar(ClrUInt16) Converts the value of the specified word to Clr character


interface.

ToClrChar(ClrVariant) Converts the value of the specified variant to Clr character interface.

ToClrChar(ClrWChar) Converts the value of the specified unicode character to its


equivalent Clr character interface.

ToLower(ClrWChar) Converts the value of a Unicode character to its lowercase


equivalent.

ToLower(ClrWChar, Converts the value of a specified Unicode character to its lowercase


_CultureInfo) equivalent using specified culture-specific formatting information.

ToLowerInvariant Converts the value of a Unicode character to its lowercase


equivalent using the casing rules of the invariant culture.

ToString(ClrWChar) Converts the specified Unicode character to its equivalent string


representation.

ToString(ClrWChar, Converts the value of this instance to its equivalent string


IFormatProvider) representation using the specified culture-specific format
information.

ToUpper(ClrWChar) Converts the value of a Unicode character to its uppercase


equivalent.

ToUpper(ClrWChar, Converts the value of a specified Unicode character to its uppercase


_CultureInfo) equivalent using specified culture-specific formatting information.

ToUpperInvariant Converts the value of a Unicode character to its uppercase


equivalent using the casing rules of the invariant culture.

TryParse Converts the value of the specified string to its equivalent Unicode
character. A return code indicates whether the conversion
succeeded or failed.

See Also
TClrCharHelper Methods

7.1.1.8.1.1.6.1 TClrCharHelper Methods

The methods of the TClrCharHelper class are listed here.

643
.Net Runtime Library for Delphi

Methods

Name Description

CompareTo(ClrWChar, Compares this instance to a specified object and indicates whether


ClrVariant) this instance precedes, follows, or appears in the same position in
the sort order as the specified variant.

CompareTo(ClrWChar, Compares this instance to a specified Char object and indicates


ClrWChar) whether this instance precedes, follows, or appears in the same
position in the sort order as the specified Char variant.

ConvertFromUtf32 Converts the specified Unicode code point into a UTF-16 encoded
string.

ConvertToUtf32(ClrChar, Converts the value of a UTF-16 encoded surrogate pair into a


ClrChar) Unicode code point.

ConvertToUtf32(ClrWChar, Converts the value of a UTF-16 encoded surrogate pair into a


ClrWChar) Unicode code point.

ConvertToUtf32(ClrWString, Converts the value of a UTF-16 encoded character or surrogate pair


ClrInt32) at a specified position in a string into a Unicode code point.

Equals(ClrWChar, ClrVariant) Returns a value that indicates whether this instance is equal to a
specified object.

Equals(ClrWChar, ClrWChar) Returns a value that indicates whether this instance is equal to the
specified Char object.

GetHashCode Returns the hash code for this instance.

GetNumericValue(ClrWChar) Converts the specified numeric Unicode character to a double-


precision floating point number.

GetNumericValue(ClrWString, Converts the numeric Unicode character at the specified position in


ClrInt32) a specified string to a double-precision floating point number.

GetUnicodeCategory(ClrWChar) Categorizes a specified Unicode character into a group identified by


one of the UnicodeCategory values.

GetUnicodeCategory(ClrWString, Categorizes the character at the specified position in a specified


ClrInt32) string into a group identified by one of the UnicodeCategory values.

IsControl(ClrWChar) Indicates whether the specified Unicode character is categorized as


a control character.

644
.Net Runtime Library for Delphi

Name Description

IsControl(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as a control character.

IsDigit(ClrWChar) Indicates whether the specified Unicode character is categorized as


a decimal digit.

IsDigit(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as a decimal digit.

IsHighSurrogate(ClrWChar) Indicates whether the specified Char object is a high surrogate.

IsHighSurrogate(ClrWString, Indicates whether the Char object at the specified position in a


ClrInt32) string is a high surrogate.

IsLetter(ClrWChar) Indicates whether the specified Unicode character is categorized as


a Unicode letter.

IsLetter(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as a Unicode letter.

IsLetterOrDigit(ClrWChar) Indicates whether the specified Unicode character is categorized as


a letter or a decimal digit.

IsLetterOrDigit(ClrWString, Indicates whether the character at the specified position in a


ClrInt32) specified string is categorized as a letter or a decimal digit.

IsLower(ClrWChar) Indicates whether the specified Unicode character is categorized as


a lowercase letter.

IsLower(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as a lowercase letter.

IsLowSurrogate(ClrWChar) Indicates whether the specified Char object is a low surrogate.

IsLowSurrogate(ClrWString, Indicates whether the Char object at the specified position in a


ClrInt32) string is a low surrogate.

IsNumber(ClrWChar) Indicates whether the specified Unicode character is categorized as


a number.

IsNumber(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as a number.

IsPunctuation(ClrWChar) Indicates whether the specified Unicode character is categorized as


a punctuation mark.

645
.Net Runtime Library for Delphi

Name Description

IsPunctuation(ClrWString, Indicates whether the character at the specified position in a


ClrInt32) specified string is categorized as a punctuation mark.

IsSeparator(ClrWChar) Indicates whether the specified Unicode character is categorized as


a separator character.

IsSeparator(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as a separator character.

IsSurrogate(ClrWChar) Indicates whether the specified character has a surrogate code unit.

IsSurrogate(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string has a surrogate code unit.

IsSurrogatePair(ClrWChar, Indicates whether the two specified Char objects form a surrogate
ClrWChar) pair.

IsSurrogatePair(ClrWString, Indicates whether two adjacent Char objects at a specified position


ClrInt32) in a string form a surrogate pair.

IsSymbol(ClrWChar) Indicates whether the specified Unicode character is categorized as


a symbol character.

IsSymbol(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as a symbol character.

IsUpper(ClrWChar) Indicates whether the specified Unicode character is categorized as


an uppercase letter.

IsUpper(ClrWString, ClrInt32) Indicates whether the character at the specified position in a


specified string is categorized as an uppercase letter.

IsWhiteSpace(ClrWChar) Indicates whether the specified Unicode character is categorized as


white space.

IsWhiteSpace(ClrWString, Indicates whether the character at the specified position in a


ClrInt32) specified string is categorized as white space.

MaxValue Represents the largest possible value of a Char.

MinValue Represents the smallest possible value of a Char.

Parse Converts the value of the specified string to its equivalent Unicode
character.

646
.Net Runtime Library for Delphi

Name Description

ToAnsiChar(ClrChar) Converts the value of the specified Clr Character interface to Ansi
character.

ToAnsiChar(ClrVariant) Converts the value of the specified variant to Ansi character.

ToChar(ClrChar) Converts the value of the specified Clr Character interface to its
equivalent Unicode character.

ToChar(ClrVariant) Converts the value of the specified variant to Unicode character.

ToClrChar(ClrInt32) Converts the value of the specified integer to Clr character interface.

ToClrChar(ClrUInt16) Converts the value of the specified word to Clr character interface.

ToClrChar(ClrVariant) Converts the value of the specified variant to Clr character interface.

ToClrChar(ClrWChar) Converts the value of the specified unicode character to its


equivalent Clr character interface.

ToLower(ClrWChar) Converts the value of a Unicode character to its lowercase


equivalent.

ToLower(ClrWChar, Converts the value of a specified Unicode character to its lowercase


_CultureInfo) equivalent using specified culture-specific formatting information.

ToLowerInvariant Converts the value of a Unicode character to its lowercase


equivalent using the casing rules of the invariant culture.

ToString(ClrWChar) Converts the specified Unicode character to its equivalent string


representation.

ToString(ClrWChar, Converts the value of this instance to its equivalent string


IFormatProvider) representation using the specified culture-specific format
information.

ToUpper(ClrWChar) Converts the value of a Unicode character to its uppercase


equivalent.

ToUpper(ClrWChar, Converts the value of a specified Unicode character to its uppercase


_CultureInfo) equivalent using specified culture-specific formatting information.

ToUpperInvariant Converts the value of a Unicode character to its uppercase


equivalent using the casing rules of the invariant culture.

TryParse Converts the value of the specified string to its equivalent Unicode
character. A return code indicates whether the conversion

647
.Net Runtime Library for Delphi

Name Description

succeeded or failed.

7.1.1.8.1.1.6.1.1 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

Name Description

TClrCharHelper.CompareTo Compares this instance to a specified object and indicates whether


(ClrWChar, ClrVariant) this instance precedes, follows, or appears in the same position in the
sort order as the specified variant.

TClrCharHelper.CompareTo Compares this instance to a specified Char object and indicates


(ClrWChar, ClrWChar) whether this instance precedes, follows, or appears in the same
position in the sort order as the specified Char variant.

7.1.1.8.1.1.6.1.1 TClrCharHelper.CompareTo Method (ClrWChar, ClrVariant)


Compares this instance to a specified object and indicates whether this instance precedes, follows, or appears in the
same position in the sort order as the specified variant.

Syntax
Delphi

class function CompareTo(X: ClrWChar; AObj: ClrVariant): ClrInt32;


overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.1 TClrCharHelper.CompareTo Method (ClrWChar, ClrWChar)


Compares this instance to a specified Char object and indicates whether this instance precedes, follows,
or appears in the same position in the sort order as the specified Char variant .

Syntax
Delphi

class function CompareTo(X: ClrWChar; Y: ClrWChar): ClrInt32;


overload;

648
.Net Runtime Library for Delphi

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.2 TClrCharHelper.ConvertFromUtf32 Method

Converts the specified Unicode code point into a UTF-16 encoded string.

Syntax
Delphi

class function ConvertFromUtf32(AUtf32: ClrInt32): ClrWString;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.3 ConvertToUtf32 Method

This is the overview for the ConvertToUtf32 method overload.

Overload List

Name Description

TClrCharHelper.ConvertToUtf32 Converts the value of a UTF-16 encoded surrogate pair into a


(ClrChar, ClrChar) Unicode code point.

TClrCharHelper.ConvertToUtf32 Converts the value of a UTF-16 encoded surrogate pair into a


(ClrWChar, ClrWChar) Unicode code point.

TClrCharHelper.ConvertToUtf32 Converts the value of a UTF-16 encoded character or surrogate pair


(ClrWString, ClrInt32) at a specified position in a string into a Unicode code point.

7.1.1.8.1.1.6.1.3 TClrCharHelper.ConvertToUtf32 Method (ClrChar, ClrChar)


Converts the value of a UTF-16 encoded surrogate pair into a Unicode code point.

Syntax
Delphi

class function ConvertToUtf32(AHighSurrogate: ClrChar; ALowSurrogate:


ClrChar): ClrInt32; overload;

See Also

649
.Net Runtime Library for Delphi

TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.3 TClrCharHelper.ConvertToUtf32 Method (ClrWChar, ClrWChar)


Converts the value of a UTF-16 encoded surrogate pair into a Unicode code point.

Syntax
Delphi

class function ConvertToUtf32(AHighSurrogate: ClrWChar; ALowSurrogate:


ClrWChar): ClrInt32; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.3 TClrCharHelper.ConvertToUtf32 Method (ClrWString, ClrInt32)


Converts the value of a UTF-16 encoded character or surrogate pair at a specified position in a string into a Unicode
code point.

Syntax
Delphi

class function ConvertToUtf32(S: ClrWString; AIndex: ClrInt32):


ClrInt32; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.4 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrCharHelper.Equals Returns a value that indicates whether this instance is equal to a


(ClrWChar, ClrVariant) specified variant.

TClrCharHelper.Equals Returns a value that indicates whether this instance is equal to the
(ClrWChar, ClrWChar) specified Char.

650
.Net Runtime Library for Delphi

7.1.1.8.1.1.6.1.4 TClrCharHelper.Equals Method (ClrWChar, ClrVariant)


Returns a value that indicates whether this instance is equal to a specified variant.

Syntax
Delphi

class function Equals(X: ClrWChar; AObj: ClrVariant): ClrBoolean;


overload; reintroduce;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.4 TClrCharHelper.Equals Method (ClrWChar, ClrWChar)


Returns a value that indicates whether this instance is equal to the specified Char.

Syntax
Delphi

class function Equals(X: ClrWChar; Y: ClrWChar): ClrBoolean; overload;


reintroduce;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.5 TClrCharHelper.GetHashCode Method

Returns the hash code for this instance.

Syntax
Delphi

class function GetHashCode(C: ClrWChar): ClrInt32; reintroduce;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.6 GetNumericValue Method

This is the overview for the GetNumericValue method overload.

Overload List

651
.Net Runtime Library for Delphi

Name Description

TClrCharHelper.GetNumericValue Converts the specified numeric Unicode character to a double-


(ClrWChar) precision floating point number.

TClrCharHelper.GetNumericValue Converts the numeric Unicode character at the specified position in


(ClrWString, ClrInt32) a specified string to a double-precision floating point number.

7.1.1.8.1.1.6.1.6 TClrCharHelper.GetNumericValue Method (ClrWChar)


Converts the specified numeric Unicode character to a double-precision floating point number.

Syntax
Delphi

class function GetNumericValue(C: ClrWChar): ClrDouble; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.6 TClrCharHelper.GetNumericValue Method (ClrWString, ClrInt32)


Converts the numeric Unicode character at the specified position in a specified string to a double-precision floating
point number.

Syntax
Delphi

class function GetNumericValue(S: ClrWString; AIndex: ClrInt32):


ClrDouble; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.7 GetUnicodeCategory Method

This is the overview for the GetUnicodeCategory method overload.

Overload List

Name Description

652
.Net Runtime Library for Delphi

Name Description

TClrCharHelper.GetUnicodeCategory Categorizes a specified Unicode character into a group identified


(ClrWChar) by one of the UnicodeCategory values.

TClrCharHelper.GetUnicodeCategory Categorizes the character at the specified position in a specified


(ClrWString, ClrInt32) string into a group identified by one of the UnicodeCategory
values.

7.1.1.8.1.1.6.1.7 TClrCharHelper.GetUnicodeCategory Method (ClrWChar)


Categorizes a specified Unicode character into a group identified by one of the
UnicodeCategory values.

Syntax
Delphi

class function GetUnicodeCategory(C: ClrWChar): TUnicodeCategory;


overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.7 TClrCharHelper.GetUnicodeCategory Method (ClrWString, ClrInt32)


Categorizes the character at the specified position in a specified string into a group identified by one of the
UnicodeCategory values.

Syntax
Delphi

class function GetUnicodeCategory(S: ClrWString; AIndex: ClrInt32):


TUnicodeCategory; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.8 IsControl Method

This is the overview for the IsControl method overload.

Overload List

Name Description

653
.Net Runtime Library for Delphi

Name Description

TClrCharHelper.IsControl Indicates whether the specified Unicode character is categorized as a


(ClrWChar) control character.

TClrCharHelper.IsControl Indicates whether the character at the specified position in a specified


(ClrWString, ClrInt32) string is categorized as a control character.

7.1.1.8.1.1.6.1.8 TClrCharHelper.IsControl Method (ClrWChar)


Indicates whether the specified Unicode character is categorized as a control character.

Syntax
Delphi

class function IsControl(C: ClrWChar): ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.8 TClrCharHelper.IsControl Method (ClrWString, ClrInt32)


Indicates whether the character at the specified position in a specified string is categorized as a control character.

Syntax
Delphi

class function IsControl(S: ClrWString; AIndex: ClrInt32): ClrBoolean;


overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.9 IsDigit Method

This is the overview for the IsDigit method overload.

Overload List

Name Description

TClrCharHelper.IsDigit Indicates whether the specified Unicode character is categorized as a


decimal digit.

654
.Net Runtime Library for Delphi

Name Description

(ClrWChar)

TClrCharHelper.IsDigit Indicates whether the character at the specified position in a specified


(ClrWString, ClrInt32) string is categorized as a decimal digit.

7.1.1.8.1.1.6.1.9 TClrCharHelper.IsDigit Method (ClrWChar)


Indicates whether the specified Unicode character is categorized as a decimal digit.

Syntax
Delphi

class function IsDigit(C: ClrWChar): ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.9 TClrCharHelper.IsDigit Method (ClrWString, ClrInt32)


Indicates whether the character at the specified position in a specified string is categorized as a decimal digit.

Syntax
Delphi

class function IsDigit(S: ClrWString; AIndex: ClrInt32): ClrBoolean;


overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.10 IsHighSurrogate Method

This is the overview for the IsHighSurrogate method overload.

Overload List

Name Description

TClrCharHelper.IsHighSurrogate Indicates whether the specified Char object is a high surrogate.


(ClrWChar)

655
.Net Runtime Library for Delphi

Name Description

TClrCharHelper.IsHighSurrogate Indicates whether the Char object at the specified position in a string
(ClrWString, ClrInt32) is a high surrogate.

7.1.1.8.1.1.6.1.10 TClrCharHelper.IsHighSurrogate Method (ClrWChar)


Indicates whether the specified Char object is a high surrogate.

Syntax
Delphi

class function IsHighSurrogate(C: ClrWChar): ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.10 TClrCharHelper.IsHighSurrogate Method (ClrWString, ClrInt32)


Indicates whether the Char object at the specified position in a string is a high surrogate.

Syntax
Delphi

class function IsHighSurrogate(S: ClrWString; AIndex: ClrInt32):


ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.11 IsLetter Method

This is the overview for the IsLetter method overload.

Overload List

Name Description

TClrCharHelper.IsLetter Indicates whether the specified Unicode character is categorized as a


(ClrWChar) Unicode letter.

TClrCharHelper.IsLetter Indicates whether the character at the specified position in a specified


(ClrWString, ClrInt32) string is categorized as a Unicode letter.

656
.Net Runtime Library for Delphi

7.1.1.8.1.1.6.1.11 TClrCharHelper.IsLetter Method (ClrWChar)


Indicates whether the specified Unicode character is categorized as a Unicode letter.

Syntax
Delphi

class function IsLetter(C: ClrWChar): ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.11 TClrCharHelper.IsLetter Method (ClrWString, ClrInt32)


Indicates whether the character at the specified position in a specified string is categorized as a Unicode letter.

Syntax
Delphi

class function IsLetter(S: ClrWString; AIndex: ClrInt32): ClrBoolean;


overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.12 IsLetterOrDigit Method

This is the overview for the IsLetterOrDigit method overload.

Overload List

Name Description

TClrCharHelper.IsLetterOrDigit Indicates whether the specified Unicode character is categorized as a


(ClrWChar) letter or a decimal digit.

TClrCharHelper.IsLetterOrDigit Indicates whether the character at the specified position in a


(ClrWString, ClrInt32) specified string is categorized as a letter or a decimal digit.

7.1.1.8.1.1.6.1.12 TClrCharHelper.IsLetterOrDigit Method (ClrWChar)


Indicates whether the specified Unicode character is categorized as a letter or a decimal digit.

657
.Net Runtime Library for Delphi

Syntax
Delphi

class function IsLetterOrDigit(C: ClrWChar): ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.12 TClrCharHelper.IsLetterOrDigit Method (ClrWString, ClrInt32)


Indicates whether the character at the specified position in a specified string is categorized as a letter or a decimal digit.

Syntax
Delphi

class function IsLetterOrDigit(S: ClrWString; AIndex: ClrInt32):


ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.13 IsLower Method

This is the overview for the IsLower method overload.

Overload List

Name Description

TClrCharHelper.IsLower Indicates whether the specified Unicode character is categorized as a


(ClrWChar) lowercase letter.

TClrCharHelper.IsLower Indicates whether the character at the specified position in a specified


(ClrWString, ClrInt32) string is categorized as a lowercase letter.

7.1.1.8.1.1.6.1.13 TClrCharHelper.IsLower Method (ClrWChar)


Indicates whether the specified Unicode character is categorized as a lowercase letter.

Syntax
Delphi

class function IsLower(C: ClrWChar): ClrBoolean; overload;

658
.Net Runtime Library for Delphi

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.13 TClrCharHelper.IsLower Method (ClrWString, ClrInt32)


Indicates whether the character at the specified position in a specified string is categorized as a lowercase letter.

Syntax
Delphi

class function IsLower(S: ClrWString; AIndex: ClrInt32): ClrBoolean;


overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.14 IsLowSurrogate Method

This is the overview for the IsLowSurrogate method overload.

Overload List

Name Description

TClrCharHelper.IsLowSurrogate Indicates whether the specified Char object is a low surrogate.


(ClrWChar)

TClrCharHelper.IsLowSurrogate Indicates whether the Char object at the specified position in a string
(ClrWString, ClrInt32) is a low surrogate.

7.1.1.8.1.1.6.1.14 TClrCharHelper.IsLowSurrogate Method (ClrWChar)


Indicates whether the specified Char object is a low surrogate.

Syntax
Delphi

class function IsLowSurrogate(C: ClrWChar): ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

659
.Net Runtime Library for Delphi

7.1.1.8.1.1.6.1.14 TClrCharHelper.IsLowSurrogate Method (ClrWString, ClrInt32)


Indicates whether the Char object at the specified position in a string is a low surrogate.

Syntax
Delphi

class function IsLowSurrogate(S: ClrWString; AIndex: ClrInt32):


ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.15 IsNumber Method

This is the overview for the IsNumber method overload.

Overload List

Name Description

TClrCharHelper.IsNumber Indicates whether the specified Unicode character is categorized as a


(ClrWChar) number.

TClrCharHelper.IsNumber Indicates whether the character at the specified position in a specified


(ClrWString, ClrInt32) string is categorized as a number.

7.1.1.8.1.1.6.1.15 TClrCharHelper.IsNumber Method (ClrWChar)


Indicates whether the specified Unicode character is categorized as a number.

Syntax
Delphi

class function IsNumber(C: ClrWChar): ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.15 TClrCharHelper.IsNumber Method (ClrWString, ClrInt32)


Indicates whether the character at the specified position in a specified string is categorized as a number.

Syntax

660
.Net Runtime Library for Delphi

Delphi

class function IsNumber(S: ClrWString; AIndex: ClrInt32): ClrBoolean;


overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.16 IsPunctuation Method

This is the overview for the IsPunctuation method overload.

Overload List

Name Description

TClrCharHelper.IsPunctuation Indicates whether the specified Unicode character is categorized as a


(ClrWChar) punctuation mark.

TClrCharHelper.IsPunctuation Indicates whether the character at the specified position in a specified


(ClrWString, ClrInt32) string is categorized as a punctuation mark.

7.1.1.8.1.1.6.1.16 TClrCharHelper.IsPunctuation Method (ClrWChar)


Indicates whether the specified Unicode character is categorized as a punctuation mark.

Syntax
Delphi

class function IsPunctuation(C: ClrWChar): ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.16 TClrCharHelper.IsPunctuation Method (ClrWString, ClrInt32)


Indicates whether the character at the specified position in a specified string is categorized as a punctuation mark.

Syntax
Delphi

class function IsPunctuation(S: ClrWString; AIndex: ClrInt32):


ClrBoolean; overload;

661
.Net Runtime Library for Delphi

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.17 IsSeparator Method

This is the overview for the IsSeparator method overload.

Overload List

Name Description

TClrCharHelper.IsSeparator Indicates whether the specified Unicode character is categorized as a


(ClrWChar) separator character.

TClrCharHelper.IsSeparator Indicates whether the character at the specified position in a specified


(ClrWString, ClrInt32) string is categorized as a separator character.

7.1.1.8.1.1.6.1.17 TClrCharHelper.IsSeparator Method (ClrWChar)


Indicates whether the specified Unicode character is categorized as a separator character.

Syntax
Delphi

class function IsSeparator(C: ClrWChar): ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.17 TClrCharHelper.IsSeparator Method (ClrWString, ClrInt32)


Indicates whether the character at the specified position in a specified string is categorized as a separator character.

Syntax
Delphi

class function IsSeparator(S: ClrWString; AIndex: ClrInt32):


ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

662
.Net Runtime Library for Delphi

7.1.1.8.1.1.6.1.18 IsSurrogate Method

This is the overview for the IsSurrogate method overload.

Overload List

Name Description

TClrCharHelper.IsSurrogate Indicates whether the specified character has a surrogate code unit.
(ClrWChar)

TClrCharHelper.IsSurrogate This is IsSurrogate, a member of class TClrCharHelper.


(ClrWString, ClrInt32)

7.1.1.8.1.1.6.1.18 TClrCharHelper.IsSurrogate Method (ClrWChar)


Indicates whether the specified character has a surrogate code unit.

Syntax
Delphi

class function IsSurrogate(C: ClrWChar): ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.18 TClrCharHelper.IsSurrogate Method (ClrWString, ClrInt32)


Indicates whether the character at the specified position in a specified string has a surrogate code unit.

Syntax
Delphi

class function IsSurrogate(S: ClrWString; AIndex: ClrInt32):


ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.19 IsSurrogatePair Method

This is the overview for the IsSurrogatePair method overload.

Overload List

663
.Net Runtime Library for Delphi

Name Description

TClrCharHelper.IsSurrogatePair Indicates whether the two specified Char objects form a surrogate
(ClrWChar, ClrWChar) pair.

TClrCharHelper.IsSurrogatePair Indicates whether two adjacent Char objects at a specified position in


(ClrWString, ClrInt32) a string form a surrogate pair.

7.1.1.8.1.1.6.1.19 TClrCharHelper.IsSurrogatePair Method (ClrWChar, ClrWChar)


Indicates whether the two specified Char objects form a surrogate pair.

Syntax
Delphi

class function IsSurrogatePair(AHighSurrogate: ClrWChar;


ALowSurrogate: ClrWChar): ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.19 TClrCharHelper.IsSurrogatePair Method (ClrWString, ClrInt32)


Indicates whether two adjacent Char objects at a specified position in a string form a surrogate pair.

Syntax
Delphi

class function IsSurrogatePair(S: ClrWString; AIndex: ClrInt32):


ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.20 IsSymbol Method

This is the overview for the IsSymbol method overload.

Overload List

Name Description

664
.Net Runtime Library for Delphi

Name Description

TClrCharHelper.IsSymbol Indicates whether the specified Unicode character is categorized as a


(ClrWChar) symbol character.

TClrCharHelper.IsSymbol Indicates whether the character at the specified position in a specified


(ClrWString, ClrInt32) string is categorized as a symbol character.

7.1.1.8.1.1.6.1.20 TClrCharHelper.IsSymbol Method (ClrWChar)


Indicates whether the specified Unicode character is categorized as a symbol character.

Syntax
Delphi

class function IsSymbol(C: ClrWChar): ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.20 TClrCharHelper.IsSymbol Method (ClrWString, ClrInt32)


Indicates whether the character at the specified position in a specified string is categorized as a symbol character.

Syntax
Delphi

class function IsSymbol(S: ClrWString; AIndex: ClrInt32): ClrBoolean;


overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.21 IsUpper Method

This is the overview for the IsUpper method overload.

Overload List

Name Description

TClrCharHelper.IsUpper Indicates whether the specified Unicode character is categorized as an

665
.Net Runtime Library for Delphi

Name Description

(ClrWChar) uppercase letter.

TClrCharHelper.IsUpper Indicates whether the character at the specified position in a specified


(ClrWString, ClrInt32) string is categorized as an uppercase letter.

7.1.1.8.1.1.6.1.21 TClrCharHelper.IsUpper Method (ClrWChar)


Indicates whether the specified Unicode character is categorized as an uppercase letter.

Syntax
Delphi

class function IsUpper(C: ClrWChar): ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.21 TClrCharHelper.IsUpper Method (ClrWString, ClrInt32)


Indicates whether the character at the specified position in a specified string is categorized as an uppercase letter.

Syntax
Delphi

class function IsUpper(S: ClrWString; AIndex: ClrInt32): ClrBoolean;


overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.22 IsWhiteSpace Method

This is the overview for the IsWhiteSpace method overload.

Overload List

Name Description

TClrCharHelper.IsWhiteSpace Indicates whether the specified Unicode character is categorized as


(ClrWChar) white space.

666
.Net Runtime Library for Delphi

Name Description

TClrCharHelper.IsWhiteSpace Indicates whether the character at the specified position in a specified


(ClrWString, ClrInt32) string is categorized as white space.

7.1.1.8.1.1.6.1.22 TClrCharHelper.IsWhiteSpace Method (ClrWChar)


Indicates whether the specified Unicode character is categorized as white space.

Syntax
Delphi

class function IsWhiteSpace(C: ClrWChar): ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.22 TClrCharHelper.IsWhiteSpace Method (ClrWString, ClrInt32)


Indicates whether the character at the specified position in a specified string is categorized as white space.

Syntax
Delphi

class function IsWhiteSpace(S: ClrWString; AIndex: ClrInt32):


ClrBoolean; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.23 TClrCharHelper.MaxValue Method

Represents the largest possible value of a Char.

Syntax
Delphi

class function MaxValue: ClrWChar;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

667
.Net Runtime Library for Delphi

7.1.1.8.1.1.6.1.24 TClrCharHelper.MinValue Method

Represents the smallest possible value of a Char.

Syntax
Delphi

class function MinValue: ClrWChar;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.25 TClrCharHelper.Parse Method


Converts the value of the specified string to its equivalent Unicode character.

Syntax
Delphi

class function Parse(S: ClrWString): ClrWChar; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.26 ToAnsiChar Method

This is the overview for the ToAnsiChar method overload.

Overload List

Name Description

TClrCharHelper.ToAnsiChar Converts the value of the specified Clr Character interface to


(ClrChar) Ansi character.

TClrCharHelper.ToAnsiChar Converts the value of the specified variant to Ansi character.


(ClrVariant)

7.1.1.8.1.1.6.1.26 TClrCharHelper.ToAnsiChar Method (ClrChar)


Converts the value of the specified Clr Character interface to Ansi character.

Syntax
Delphi

668
.Net Runtime Library for Delphi

class function ToAnsiChar(C: ClrChar): ClrAChar; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.26 TClrCharHelper.ToAnsiChar Method (ClrVariant)


Converts the value of the specified variant to Ansi character.

Syntax
Delphi

class function ToAnsiChar(V: ClrVariant): ClrAChar; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.27 ToChar Method

This is the overview for the ToChar method overload.

Overload List

Name Description

TClrCharHelper.ToChar Converts the value of the specified Clr Character interface to


(ClrChar) its equivalent Unicode character.

TClrCharHelper.ToChar Converts the value of the specified variant to Unicode


(ClrVariant) character.

7.1.1.8.1.1.6.1.27 TClrCharHelper.ToChar Method (ClrChar)

Converts the value of the specified Clr Character interface to its equivalent Unicode character.

Syntax
Delphi

class function ToChar(C: ClrChar): ClrWChar; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

669
.Net Runtime Library for Delphi

7.1.1.8.1.1.6.1.27 TClrCharHelper.ToChar Method (ClrVariant)

Converts the value of the specified variant to Unicode character.

Syntax
Delphi

class function ToChar(V: ClrVariant): ClrWChar; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.28 ToClrChar Method

This is the overview for the ToClrChar method overload.

Overload List

Name Description

TClrCharHelper.ToClrChar Converts the value of the specified integer to Clr character


(ClrInt32) interface.

TClrCharHelper.ToClrChar Converts the value of the specified word to Clr character


(ClrUInt16) interface.

TClrCharHelper.ToClrChar Converts the value of the specified variant to Clr character


(ClrVariant) interface.

TClrCharHelper.ToClrChar Converts the value of the specified unicode character to its


(ClrWChar) equivalent Clr character interface.

7.1.1.8.1.1.6.1.28 TClrCharHelper.ToClrChar Method (ClrInt32)


Converts the value of the specified integer to Clr character interface.

Syntax
Delphi

class function ToClrChar(AValue: ClrInt32): ClrChar; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

670
.Net Runtime Library for Delphi

7.1.1.8.1.1.6.1.28 TClrCharHelper.ToClrChar Method (ClrUInt16)

Converts the value of the specified word to Clr character interface.

Syntax
Delphi

class function ToClrChar(AValue: ClrUInt16): ClrChar; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.28 TClrCharHelper.ToClrChar Method (ClrVariant)

Converts the value of the specified variant to Clr character interface.

Syntax
Delphi

class function ToClrChar(V: ClrVariant): ClrChar; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.28 TClrCharHelper.ToClrChar Method (ClrWChar)

Converts the value of the specified unicode character to its equivalent Clr character interface.

Syntax
Delphi

class function ToClrChar(C: ClrWChar): ClrChar; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.29 ToLower Method

This is the overview for the ToLower method overload.

Overload List

671
.Net Runtime Library for Delphi

Name Description

TClrCharHelper.ToLower Converts the value of a Unicode character to its lowercase


(ClrWChar) equivalent.

TClrCharHelper.ToLower Converts the value of a specified Unicode character to its


(ClrWChar, _CultureInfo) lowercase equivalent using specified culture-specific
formatting information.

7.1.1.8.1.1.6.1.29 TClrCharHelper.ToLower Method (ClrWChar)

Converts the value of a Unicode character to its lowercase equivalent.

Syntax
Delphi

class function ToLower(C: ClrWChar): ClrWChar; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.29 TClrCharHelper.ToLower Method (ClrWChar, _CultureInfo)

Converts the value of a specified Unicode character to its lowercase equivalent using specified
culture-specific formatting information.

Syntax
Delphi

class function ToLower(C: ClrWChar; ACulture: _CultureInfo): ClrWChar;


overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.30 TClrCharHelper.ToLowerInvariant Method

Converts the value of a Unicode character to its lowercase equivalent using the casing rules of
the invariant culture.

Syntax
Delphi

672
.Net Runtime Library for Delphi

class function ToLowerInvariant(C: ClrWChar): ClrWChar;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.31 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrCharHelper.ToString Converts the specified Unicode character to its equivalent


(ClrWChar) string representation.

TClrCharHelper.ToString This is ToString, a member of class TClrCharHelper.


(ClrWChar, IFormatProvider)

7.1.1.8.1.1.6.1.31 TClrCharHelper.ToString Method (ClrWChar)

Converts the specified Unicode character to its equivalent string representation.

Syntax
Delphi

class function ToString(C: ClrWChar): ClrWString; overload;


reintroduce;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.31 TClrCharHelper.ToString Method (ClrWChar, IFormatProvider)

Converts the value of this instance to its equivalent string representation using the specified
culture-specific format information.

Syntax
Delphi

class function ToString(C: ClrWChar; AProvider: IFormatProvider):


ClrWString; overload; reintroduce;

673
.Net Runtime Library for Delphi

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.32 ToUpper Method

This is the overview for the ToUpper method overload.

Overload List

Name Description

TClrCharHelper.ToUpper Converts the value of a Unicode character to its uppercase


(ClrWChar) equivalent.

TClrCharHelper.ToUpper Converts the value of a specified Unicode character to its


(ClrWChar, _CultureInfo) uppercase equivalent using specified culture-specific
formatting information.

7.1.1.8.1.1.6.1.32 TClrCharHelper.ToUpper Method (ClrWChar)

Converts the value of a Unicode character to its uppercase equivalent.

Syntax
Delphi

class function ToUpper(C: ClrWChar): ClrWChar; overload;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.32 TClrCharHelper.ToUpper Method (ClrWChar, _CultureInfo)

Converts the value of a specified Unicode character to its uppercase equivalent using specified
culture-specific formatting information.

Syntax
Delphi

class function ToUpper(C: ClrWChar; ACulture: _CultureInfo): ClrWChar;


overload;

See Also

674
.Net Runtime Library for Delphi

TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.33 TClrCharHelper.ToUpperInvariant Method

Converts the value of a Unicode character to its uppercase equivalent using the casing rules of
the invariant culture.

Syntax
Delphi

class function ToUpperInvariant(C: ClrWChar): ClrWChar;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.6.1.34 TClrCharHelper.TryParse Method

Converts the value of the specified string to its equivalent Unicode character. A return code
indicates whether the conversion succeeded or failed.

Syntax
Delphi

class function TryParse(S: ClrWString; var AResult: ClrWChar):


ClrBoolean;

See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7 TClrConvert Class


Collapse All Expand All

Converts a base data type to another base data type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrConvert

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax

675
.Net Runtime Library for Delphi

Delphi

TClrConvert = class;

Methods

Name Description

ChangeObjectType(ClrVariant, _Type) Returns a variant of the specified type


and whose value is equivalent to the
specified variant.

ChangeObjectType(ClrVariant, string) Returns a variant of the specified


type name and whose value is
equivalent to the specified
variant.

ChangeType(ClrVariant, TTypeCode) Returns a variant of the specified type


whose value is equivalent to the
specified variant.

ChangeType(ClrVariant, _Type) Returns a variant of the specified type


and whose value is equivalent to the
specified variant.

ChangeType(ClrVariant, string) Returns a variant of the specified


type and whose value is
equivalent to the specified variant
using the type name.

CreateClrWrapper(ClrVariant, _Type) Create Clr wrapper of the


specified variant with the
specified type.

CreateClrWrapper(ClrVariant, string) Create Clr wrapper of the


specified variant with the
specified type using the type
name.

FromBase64CharArray(TClrWCharDynArray, ClrInt32, Converts a subset of a Unicode


ClrInt32) character dynamic array, which
encodes binary data as base-64 digits,
to an equivalent 8-bit unsigned integer
array. Parameters specify the subset in
the input array and the number of
elements to convert.

FromBase64CharArray(_CharArray, ClrInt32, ClrInt32) Converts a subset of a Unicode


character array, which encodes binary
data as base-64 digits, to an equivalent

676
.Net Runtime Library for Delphi

Name Description

8-bit unsigned integer array.


Parameters specify the subset in the
input array and the number of
elements to convert.

FromBase64CharArrayAsByteDynArray(TClrWCharDynArray, Converts a subset of a Unicode


ClrInt32, ClrInt32) character dynamic array, which
encodes binary data as base-64 digits,
to an equivalent 8-bit unsigned integer
dynamic array. Parameters specify the
subset in the input array and the
number of elements to convert.

FromBase64CharArrayAsByteDynArray(_CharArray, Converts a subset of an 8-bit


ClrInt32, ClrInt32) unsigned integer array to an
equivalent subset of a Unicode
character dynamic array encoded
with base-64 digits. Parameters
specify the subsets as offsets in
the input and output arrays, and
the number of elements in the
input array to convert.

FromBase64String Converts the specified string,


which encodes binary data as
base-64 digits, to an equivalent 8-
bit unsigned integer array.

FromBase64StringAsByteDynArray Converts the specified string,


which encodes binary data as
base-64 digits, to an equivalent 8-
bit unsigned integer dynamic
array.

GetDefaultInterface Get the default Clr convert


interface.

GetEnumValue(_Type, TOleEnum) Converts the specified TOleEnum


enumeration constant to an
equivalent clr enumeration
member.

GetEnumValue(string, TOleEnum) Converts the specified TOleEnum


enumeration constant to an
equivalent clr enumeration
member.

677
.Net Runtime Library for Delphi

Name Description

GetTypeCode Returns the TypeCode for the specified


variant.

IsDBNull Returns an indication whether the


specified object is of type DBNull .

ToAnsiChar(ClrChar) Converts the value of the specified clr


character to its equivalent ansi
character.

ToAnsiChar(ClrVariant) Converts the value of the specified


variant to its equivalent ansi character.

ToBase64CharArray(TClrByteDynArray, ClrInt32, ClrInt32, Converts a subset of an 8-bit unsigned


TClrWCharDynArray, ClrInt32) integer dynamic array to an equivalent
subset of a Unicode character array
encoded with base-64 digits.
Parameters specify the subsets as
offsets in the input and output arrays,
and the number of elements in the
input array to convert.

ToBase64CharArray(TClrByteDynArray, ClrInt32, ClrInt32, Converts a subset of an 8-bit unsigned


TClrWCharDynArray, ClrInt32, TBase64FormattingOptions) integer dynamic array to an equivalent
subset of a Unicode character array
encoded with base-64 digits.
Parameters specify the subsets as
offsets in the input and output arrays,
the number of elements in the input
array to convert, and whether line
breaks are inserted in the output array.

ToBase64CharArray(_ByteArray, ClrInt32, ClrInt32, Converts a subset of an 8-bit unsigned


_CharArray, ClrInt32) integer array to an equivalent subset of
a Unicode character array encoded
with base-64 digits. Parameters specify
the subsets as offsets in the input and
output arrays, and the number of
elements in the input array to convert.

ToBase64CharArray(_ByteArray, ClrInt32, ClrInt32, Converts a subset of an 8-bit unsigned


_CharArray, ClrInt32, TBase64FormattingOptions) integer array to an equivalent subset of
a Unicode character array encoded
with base-64 digits. Parameters specify
the subsets as offsets in the input and
output arrays, the number of elements
in the input array to convert, and
whether line breaks are inserted in the
output array.

678
.Net Runtime Library for Delphi

Name Description

ToBase64String(TClrByteDynArray) Converts a dynamic array of 8-bit


unsigned integers to its equivalent
string representation that is encoded
with base-64 digits.

ToBase64String(TClrByteDynArray, ClrInt32, ClrInt32) Converts a subset of a dynamic array


of 8-bit unsigned integers to its
equivalent string representation that is
encoded with base-64 digits.
Parameters specify the subset as an
offset in the input array, and the
number of elements in the array to
convert.

ToBase64String(TClrByteDynArray, ClrInt32, ClrInt32, Converts a subset of a dynamic array


TBase64FormattingOptions) of 8-bit unsigned integers to its
equivalent string representation that is
encoded with base-64 digits.
Parameters specify the subset as an
offset in the input array, the number of
elements in the array to convert, and
whether to insert line breaks in the
return value.

ToBase64String(TClrByteDynArray, Converts a dynamic array of 8-bit


TBase64FormattingOptions) unsigned integers to its equivalent
string representation that is encoded
with base-64 digits. A parameter
specifies whether to insert line breaks
in the return value.

ToBase64String(_ByteArray) Converts an array of 8-bit unsigned


integers to its equivalent string
representation that is encoded with
base-64 digits.

ToBase64String(_ByteArray, ClrInt32, ClrInt32) Converts a subset of an array of 8-bit


unsigned integers to its equivalent
string representation that is encoded
with base-64 digits. Parameters specify
the subset as an offset in the input
array, and the number of elements in
the array to convert.

ToBase64String(_ByteArray, ClrInt32, ClrInt32, Converts a subset of an array of


TBase64FormattingOptions) 8-bit unsigned integers to its
equivalent string representation
that is encoded with base-64
digits. Parameters specify the
subset as an offset in the input

679
.Net Runtime Library for Delphi

Name Description

array, the number of elements in


the array to convert, and whether
to insert line breaks in the return
value.

ToBase64String(_ByteArray, TBase64FormattingOptions) Converts an array of 8-bit


unsigned integers to its
equivalent string representation
that is encoded with base-64
digits. A parameter specifies
whether to insert line breaks in
the return value.

ToBoolean(ClrChar) Calling this method always throws


InvalidCastException .

ToBoolean(ClrVariant) Converts the value of a specified


variant to an equivalent Boolean value.

ToBoolean(ClrVariant, IFormatProvider) Converts the value of the specified


variant to an equivalent Boolean value,
using the specified culture-specific
formatting information.

ToBoolean(ClrWString, IFormatProvider) Converts the specified string


representation of a logical value to its
Boolean equivalent, using the specified
culture-specific formatting information.

ToByte(ClrChar) Converts the value of the


specified Unicode character to
the equivalent 8-bit unsigned
integer.

ToByte(ClrVariant) Converts the value of the


specified variant to an 8-bit
unsigned integer.

ToByte(ClrVariant, IFormatProvider) Converts the value of the


specified variant to an 8-bit
unsigned integer, using the
specified culture-specific
formatting information.

ToByte(ClrWString, ClrInt32) Converts the string


representation of a number in a

680
.Net Runtime Library for Delphi

Name Description

specified base to an equivalent 8-


bit unsigned integer.

ToByte(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 8-bit unsigned integer,
using specified culture-specific
formatting information.

ToChar(ClrChar) Converts clr unicode character to


it equivalent delphi wide
character.

ToChar(ClrVariant) Converts the value of the specified


variant to a Unicode character.

ToChar(ClrVariant, IFormatProvider) Converts the value of the specified


variant to its equivalent Unicode
character, using the specified culture-
specific formatting information.

ToChar(ClrWString, IFormatProvider) Converts the first character of a


specified string to a Unicode character,
using specified culture-specific
formatting information.

ToClrBaseObject Convert variant to the base clr


object.

ToClrChar(ClrInt32) Converts the value of the specified 32-


bit signed integer to its equivalent clr
Unicode character.

ToClrChar(ClrVariant) Converts the value of the specified


variant to a clr Unicode character.

ToClrChar(ClrVariant, IFormatProvider) Converts the value of the specified


variant to its equivalent clr Unicode
character, using the specified culture-
specific formatting information.

ToClrChar(ClrWChar) Converts the value of the specified


delphi wide character to a clr Unicode
character.

ToClrChar(ClrWString, IFormatProvider) Converts the first character of a


specified string to a Unicode character,

681
.Net Runtime Library for Delphi

Name Description

using specified culture-specific


formatting information.

ToClrObject Converts the value of the specified


variant to a clr object interface.

ToDateTime(ClrChar) Calling this method always throws


InvalidCastException.

ToDateTime(ClrVariant) Converts the value of the specified


variant to a DateTime .

ToDateTime(ClrVariant, IFormatProvider) Converts the value of the specified


variant to a DateTime object, using
the specified culture-specific
formatting information.

ToDateTime(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent date and time, using the
specified culture-specific formatting
information.

ToDecimal(ClrChar) Calling this method always throws


InvalidCastException.

ToDecimal(ClrVariant) Converts the value of the specified


variant to an equivalent decimal
number.

ToDecimal(ClrVariant, IFormatProvider) Converts the value of the specified


variant to an equivalent decimal
number, using the specified culture-
specific formatting information.

ToDecimal(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent decimal number, using the
specified culture-specific formatting
information.

ToDecimal(Extended) Converts the value of the specified


double-precision floating-point
number to an equivalent decimal
number.

ToDispatch Converts the value of the specified


variant to dispatch interface.

682
.Net Runtime Library for Delphi

Name Description

ToDouble(ClrChar) Calling this method always throws


InvalidCastException.

ToDouble(ClrDecimal) Converts the value of the specified


decimal number to an equivalent
double-precision floating-point
number.

ToDouble(ClrVariant) Converts the value of the specified


variant to a double-precision floating-
point number.

ToDouble(ClrVariant, IFormatProvider) Converts the value of the variant


variant to an double-precision floating-
point number, using the specified
culture-specific formatting information.

ToDouble(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent double-precision floating-
point number, using the specified
culture-specific formatting information.

ToFormatProvider(ClrVariant) Convert a format provider variant


to IFormatProvider interface.

ToFormatProvider(_CultureInfo) Convert CultureInfo interface to


IFormatProvider interface.

ToInt16(ClrChar) Converts the value of the specified clr


Unicode character to the equivalent
16-bit signed integer.

ToInt16(ClrVariant) Converts the value of the specified


variant to a 16-bit signed integer.

ToInt16(ClrVariant, IFormatProvider) Converts the value of the specified


variant to a 16-bit signed integer,
using the specified culture-specific
formatting information.

ToInt16(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an
equivalent 16-bit signed integer.

ToInt16(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 16-bit signed integer, using
the specified culture-specific

683
.Net Runtime Library for Delphi

Name Description

formatting information.

ToInt32(ClrChar) Converts the value of the specified clr


Unicode character to the equivalent
32-bit signed integer.

ToInt32(ClrVariant) Converts the value of the specified


variant to a 32-bit signed integer.

ToInt32(ClrVariant, IFormatProvider) Converts the value of the specified


variant to a 32-bit signed integer,
using the specified culture-specific
formatting information.

ToInt32(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an
equivalent 32-bit signed integer.

ToInt32(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 32-bit signed integer, using
the specified culture-specific
formatting information.

ToInt64(ClrChar) Converts the value of the specified clr


Unicode character to the equivalent
64-bit signed integer.

ToInt64(ClrVariant) Converts the value of the specified


variant to a 64-bit signed integer.

ToInt64(ClrVariant, IFormatProvider) Converts the value of the specified


variant to a 64-bit signed integer,
using the specified culture-specific
formatting information.

ToInt64(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an
equivalent 64-bit signed integer.

ToInt64(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 64-bit signed integer, using
the specified culture-specific
formatting information.

ToInterface Converts the value of the specified


variant to IInterface.

684
.Net Runtime Library for Delphi

Name Description

ToManagedPointer(ClrVariant) Converts the value of the specified


variant to clr managed pointer.

ToManagedPointer(Pointer) Converts the value of the specified


unmanaged pointer to clr managed
pointer.

ToManagedPointer(TObject) Converts the value of the specified


Object to clr managed pointer.

ToObject Converts the value of the specified


managed pointer to object.

ToPointer Converts the value of the specified


managed pointer to unmanaged
Pointer.

ToSByte(ClrChar) Converts the value of the specified clr


Unicode character to the equivalent 8-
bit signed integer.

ToSByte(ClrVariant) Converts the value of the specified


variant to an 8-bit signed integer.

ToSByte(ClrVariant, IFormatProvider) Converts the value of the specified


variant to an 8-bit signed integer,
using the specified culture-specific
formatting information.

ToSByte(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an
equivalent 8-bit signed integer.

ToSByte(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 8-bit signed integer, using
the specified culture-specific
formatting information.

ToSingle(ClrChar) Calling this method always throws


InvalidCastException.

ToSingle(ClrVariant) Converts the value of the specified


variant to a single-precision floating-
point number.

ToSingle(ClrVariant, IFormatProvider) Converts the value of the specified


variant to an single-precision floating-
point number, using the specified

685
.Net Runtime Library for Delphi

Name Description

culture-specific formatting information.

ToSingle(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent single-precision floating-
point number, using the specified
culture-specific formatting information.

ToString(Byte, ClrInt32) Converts the value of an 8-bit


unsigned integer to its equivalent
string representation in a specified
base.

ToString(Byte, IFormatProvider) Converts the value of the specified 8-


bit unsigned integer to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrBoolean, IFormatProvider) Converts the specified Boolean value


to its equivalent string representation.

ToString(ClrChar) Converts the value of the specified


Unicode character to its equivalent
string representation.

ToString(ClrChar, IFormatProvider) Converts the value of the specified clr


Unicode character to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrDateTime, IFormatProvider) Converts the value of the specified


DateTime to its equivalent string
representation, using the specified
culture-specific formatting information.

ToString(ClrDecimal) Converts the value of the specified


decimal number to its equivalent string
representation.

ToString(ClrDecimal, IFormatProvider) Converts the value of the specified


decimal number to its equivalent string
representation, using the specified
culture-specific formatting information.

ToString(ClrDouble, IFormatProvider) Converts the value of the specified


double-precision floating-point
number to its equivalent string

686
.Net Runtime Library for Delphi

Name Description

representation.

ToString(ClrInt16, ClrInt32) Converts the value of a 16-bit signed


integer to its equivalent string
representation in a specified base.

ToString(ClrInt16, IFormatProvider) Converts the value of the specified 16-


bit signed integer to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrInt32, ClrInt32) Converts the value of a 32-bit signed


integer to its equivalent string
representation in a specified base.

ToString(ClrInt32, IFormatProvider) Converts the value of the specified 32-


bit signed integer to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrInt64, ClrInt32) Converts the value of a 64-bit signed


integer to its equivalent string
representation in a specified base.

ToString(ClrSByte, IFormatProvider) Converts the value of the specified 8-


bit signed integer to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrSingle, IFormatProvider) Converts the value of the specified


single-precision floating-point number
to its equivalent string representation,
using the specified culture-specific
formatting information.

ToString(ClrUInt16, IFormatProvider) Converts the value of the specified 16-


bit unsigned integer to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrUInt32, IFormatProvider) Converts the value of the specified 32-


bit unsigned integer to its equivalent
string representation, using the
specified culture-specific formatting
information.

687
.Net Runtime Library for Delphi

Name Description

ToString(ClrUInt64, IFormatProvider) Converts the value of the specified 64-


bit unsigned integer to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrVariant) Converts the value of the specified


variant to its equivalent string
representation.

ToString(ClrVariant, IFormatProvider) Converts the value of the specified


variant to its equivalent string
representation using the specified
culture-specific formatting information.

ToString(ClrWChar, IFormatProvider) Converts the value of the specified


Unicode character to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrWString, IFormatProvider) Returns the specified string instance;


no actual conversion is performed.

ToUInt16(ClrChar) Converts the value of the specified clr


Unicode character to the equivalent
16-bit unsigned integer.

ToUInt16(ClrVariant) Converts the value of the specified


variant to a 16-bit unsigned integer.

ToUInt16(ClrVariant, IFormatProvider) Converts the value of the specified


variant to a 16-bit unsigned integer,
using the specified culture-specific
formatting information.

ToUInt16(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an
equivalent 16-bit unsigned integer.

ToUInt16(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 16-bit unsigned integer,
using the specified culture-specific
formatting information.

ToUInt32(ClrChar) Converts the value of the specified clr


Unicode character to the equivalent
32-bit unsigned integer.

688
.Net Runtime Library for Delphi

Name Description

ToUInt32(ClrVariant) Converts the value of the specified


variant to a 32-bit unsigned integer.

ToUInt32(ClrVariant, IFormatProvider) Converts the value of the specified


variant to a 32-bit unsigned integer,
using the specified culture-specific
formatting information.

ToUInt32(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an
equivalent 32-bit unsigned integer.

ToUInt32(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 32-bit unsigned integer,
using the specified culture-specific
formatting information.

ToUInt64(ClrChar) Converts the value of the specified clr


Unicode character to the equivalent
64-bit unsigned integer.

ToUInt64(ClrVariant) Converts the value of the specified


variant to a 64-bit unsigned integer.

ToUInt64(ClrVariant, IFormatProvider) Converts the value of the specified


variant to a 64-bit unsigned integer,
using the specified culture-specific
formatting information.

ToUInt64(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an
equivalent 64-bit unsigned integer.

ToUInt64(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 64-bit unsigned integer,
using the specified culture-specific
formatting information.

ToVariant(IDispatch) Convert the value of the specified


dispatch interface to variant.

ToVariant(TClrBaseObject) Convert the value of the specified


clr base object to variant.

TryChangeObjectType(ClrVariant, _Type, IDispatch) Convert the value of specified


variant to the dispatch interface

689
.Net Runtime Library for Delphi

Name Description

of the specified type.

TryChangeObjectType(ClrVariant, string, IDispatch) Convert the value of specified


variant to the dispatch interface
of the specified type using the
type name.

TryCreateClrWrapper(IDispatch, _Type, IDispatch) Wrap the value of the specified


dispatch interface to the dispatch
of the specified type.

TryCreateClrWrapper(IDispatch, string, IDispatch) Wrap the value of the specified


dispatch interface to the dispatch
of the specified type using the
type name.

Unwrap Unwrap the value of the specified


variant to the original .net object
as variant.

UnwrapToInterface Unwrap the value of the specified


variant to the original .net object as
interface.

See Also
TClrConvert Methods

7.1.1.8.1.1.7.1 TClrConvert Methods

The methods of the TClrConvert class are listed here.

Methods

Name Description

ChangeObjectType(ClrVariant, _Type) Returns a variant of the specified type


and whose value is equivalent to the
specified variant.

ChangeObjectType(ClrVariant, string) Returns a variant of the specified type


name and whose value is equivalent to
the specified variant.

ChangeType(ClrVariant, TTypeCode) Returns a variant of the specified type


whose value is equivalent to the

690
.Net Runtime Library for Delphi

Name Description

specified variant.

ChangeType(ClrVariant, _Type) Returns a variant of the specified type


and whose value is equivalent to the
specified variant.

ChangeType(ClrVariant, string) Returns a variant of the


specified type and whose value
is equivalent to the specified
variant using the type name.

CreateClrWrapper(ClrVariant, _Type) Create Clr wrapper of the


specified variant with the
specified type.

CreateClrWrapper(ClrVariant, string) Create Clr wrapper of the


specified variant with the
specified type using the type
name.

FromBase64CharArray(TClrWCharDynArray, ClrInt32, Converts a subset of a Unicode


ClrInt32) character dynamic array, which
encodes binary data as base-64 digits,
to an equivalent 8-bit unsigned integer
array. Parameters specify the subset in
the input array and the number of
elements to convert.

FromBase64CharArray(_CharArray, ClrInt32, ClrInt32) Converts a subset of a Unicode


character array, which encodes binary
data as base-64 digits, to an equivalent
8-bit unsigned integer array.
Parameters specify the subset in the
input array and the number of
elements to convert.

FromBase64CharArrayAsByteDynArray(TClrWCharDynArray, Converts a subset of a Unicode


ClrInt32, ClrInt32) character dynamic array, which
encodes binary data as base-64 digits,
to an equivalent 8-bit unsigned integer
dynamic array. Parameters specify the
subset in the input array and the
number of elements to convert.

FromBase64CharArrayAsByteDynArray(_CharArray, Converts a subset of an 8-bit unsigned


ClrInt32, ClrInt32) integer array to an equivalent subset of
a Unicode character dynamic array
encoded with base-64 digits.

691
.Net Runtime Library for Delphi

Name Description

Parameters specify the subsets as


offsets in the input and output arrays,
and the number of elements in the
input array to convert.

FromBase64String Converts the specified string, which


encodes binary data as base-64 digits,
to an equivalent 8-bit unsigned integer
array.

FromBase64StringAsByteDynArray Converts the specified string, which


encodes binary data as base-64 digits,
to an equivalent 8-bit unsigned integer
dynamic array.

GetDefaultInterface Get the default Clr convert


interface.

GetEnumValue(_Type, TOleEnum) Converts the specified TOleEnum


enumeration constant to an
equivalent clr enumeration
member.

GetEnumValue(string, TOleEnum) Converts the specified TOleEnum


enumeration constant to an
equivalent clr enumeration
member.

GetTypeCode Returns the TypeCode for the specified


variant.

IsDBNull Returns an indication whether the


specified object is of type DBNull.

ToAnsiChar(ClrChar) Converts the value of the specified clr


character to its equivalent ansi
character.

ToAnsiChar(ClrVariant) Converts the value of the specified


variant to its equivalent ansi character.

ToBase64CharArray(TClrByteDynArray, ClrInt32, ClrInt32, Converts a subset of an 8-bit unsigned


TClrWCharDynArray, ClrInt32) integer dynamic array to an equivalent
subset of a Unicode character array
encoded with base-64 digits.
Parameters specify the subsets as
offsets in the input and output arrays,
and the number of elements in the

692
.Net Runtime Library for Delphi

Name Description

input array to convert.

ToBase64CharArray(TClrByteDynArray, ClrInt32, ClrInt32, Converts a subset of an 8-bit unsigned


TClrWCharDynArray, ClrInt32, TBase64FormattingOptions) integer dynamic array to an equivalent
subset of a Unicode character array
encoded with base-64 digits.
Parameters specify the subsets as
offsets in the input and output arrays,
the number of elements in the input
array to convert, and whether line
breaks are inserted in the output array.

ToBase64CharArray(_ByteArray, ClrInt32, ClrInt32, Converts a subset of an 8-bit unsigned


_CharArray, ClrInt32) integer array to an equivalent subset of
a Unicode character array encoded
with base-64 digits. Parameters specify
the subsets as offsets in the input and
output arrays, and the number of
elements in the input array to convert.

ToBase64CharArray(_ByteArray, ClrInt32, ClrInt32, Converts a subset of an 8-bit unsigned


_CharArray, ClrInt32, TBase64FormattingOptions) integer array to an equivalent subset of
a Unicode character array encoded
with base-64 digits. Parameters specify
the subsets as offsets in the input and
output arrays, the number of elements
in the input array to convert, and
whether line breaks are inserted in the
output array.

ToBase64String(TClrByteDynArray) Converts a dynamic array of 8-bit


unsigned integers to its equivalent
string representation that is encoded
with base-64 digits.

ToBase64String(TClrByteDynArray, ClrInt32, ClrInt32) Converts a subset of a dynamic array


of 8-bit unsigned integers to its
equivalent string representation that is
encoded with base-64 digits.
Parameters specify the subset as an
offset in the input array, and the
number of elements in the array to
convert.

ToBase64String(TClrByteDynArray, ClrInt32, ClrInt32, Converts a subset of a dynamic array


TBase64FormattingOptions) of 8-bit unsigned integers to its
equivalent string representation that is
encoded with base-64 digits.
Parameters specify the subset as an
offset in the input array, the number of
elements in the array to convert, and

693
.Net Runtime Library for Delphi

Name Description

whether to insert line breaks in the


return value.

ToBase64String(TClrByteDynArray, Converts a dynamic array of 8-bit


TBase64FormattingOptions) unsigned integers to its equivalent
string representation that is encoded
with base-64 digits. A parameter
specifies whether to insert line breaks
in the return value.

ToBase64String(_ByteArray) Converts an array of 8-bit unsigned


integers to its equivalent string
representation that is encoded with
base-64 digits.

ToBase64String(_ByteArray, ClrInt32, ClrInt32) Converts a subset of an array of 8-bit


unsigned integers to its equivalent
string representation that is encoded
with base-64 digits. Parameters specify
the subset as an offset in the input
array, and the number of elements in
the array to convert.

ToBase64String(_ByteArray, ClrInt32, ClrInt32, Converts a subset of an array of 8-bit


TBase64FormattingOptions) unsigned integers to its equivalent
string representation that is encoded
with base-64 digits. Parameters specify
the subset as an offset in the input
array, the number of elements in the
array to convert, and whether to insert
line breaks in the return value.

ToBase64String(_ByteArray, TBase64FormattingOptions) Converts an array of 8-bit unsigned


integers to its equivalent string
representation that is encoded with
base-64 digits. A parameter specifies
whether to insert line breaks in the
return value.

ToBoolean(ClrChar) Calling this method always throws


InvalidCastException.

ToBoolean(ClrVariant) Converts the value of a specified


variant to an equivalent Boolean value.

ToBoolean(ClrVariant, IFormatProvider) Converts the value of the specified


variant to an equivalent Boolean value,
using the specified culture-specific
formatting information.

694
.Net Runtime Library for Delphi

Name Description

ToBoolean(ClrWString, IFormatProvider) Converts the specified string


representation of a logical value to its
Boolean equivalent, using the specified
culture-specific formatting information.

ToByte(ClrChar) Converts the value of the specified


Unicode character to the equivalent 8-
bit unsigned integer.

ToByte(ClrVariant) Converts the value of the specified


variant to an 8-bit unsigned integer.

ToByte(ClrVariant, IFormatProvider) Converts the value of the specified


variant to an 8-bit unsigned integer,
using the specified culture-specific
formatting information.

ToByte(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an
equivalent 8-bit unsigned integer.

ToByte(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 8-bit unsigned integer,
using specified culture-specific
formatting information.

ToChar(ClrChar) Converts clr unicode character to


it equivalent delphi wide
character.

ToChar(ClrVariant) Converts the value of the specified


variant to a Unicode character.

ToChar(ClrVariant, IFormatProvider) Converts the value of the specified


variant to its equivalent Unicode
character, using the specified culture-
specific formatting information.

ToChar(ClrWString, IFormatProvider) Converts the first character of a


specified string to a Unicode character,
using specified culture-specific
formatting information.

ToClrBaseObject Convert variant to the base clr


object.

ToClrChar(ClrInt32) Converts the value of the specified 32-

695
.Net Runtime Library for Delphi

Name Description

bit signed integer to its equivalent clr


Unicode character.

ToClrChar(ClrVariant) Converts the value of the specified


variant to a clr Unicode character.

ToClrChar(ClrVariant, IFormatProvider) Converts the value of the specified


variant to its equivalent clr Unicode
character, using the specified culture-
specific formatting information.

ToClrChar(ClrWChar) Converts the value of the specified


delphi wide character to a clr Unicode
character.

ToClrChar(ClrWString, IFormatProvider) Converts the first character of a


specified string to a Unicode character,
using specified culture-specific
formatting information.

ToClrObject Converts the value of the specified


variant to a clr object interface.

ToDateTime(ClrChar) Calling this method always throws


InvalidCastException.

ToDateTime(ClrVariant) Converts the value of the specified


variant to a DateTime.

ToDateTime(ClrVariant, IFormatProvider) Converts the value of the specified


variant to a DateTime object, using
the specified culture-specific
formatting information.

ToDateTime(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent date and time, using the
specified culture-specific formatting
information.

ToDecimal(ClrChar) Calling this method always throws


InvalidCastException.

ToDecimal(ClrVariant) Converts the value of the specified


variant to an equivalent decimal
number.

ToDecimal(ClrVariant, IFormatProvider) Converts the value of the specified


variant to an equivalent decimal

696
.Net Runtime Library for Delphi

Name Description

number, using the specified culture-


specific formatting information.

ToDecimal(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent decimal number, using the
specified culture-specific formatting
information.

ToDecimal(Extended) Converts the value of the specified


double-precision floating-point
number to an equivalent decimal
number.

ToDispatch Converts the value of the specified


variant to dispatch interface.

ToDouble(ClrChar) Calling this method always throws


InvalidCastException.

ToDouble(ClrDecimal) Converts the value of the specified


decimal number to an equivalent
double-precision floating-point
number.

ToDouble(ClrVariant) Converts the value of the specified


variant to a double-precision floating-
point number.

ToDouble(ClrVariant, IFormatProvider) Converts the value of the variant


variant to an double-precision floating-
point number, using the specified
culture-specific formatting information.

ToDouble(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent double-precision floating-
point number, using the specified
culture-specific formatting information.

ToFormatProvider(ClrVariant) Convert a format provider variant


to IFormatProvider interface.

ToFormatProvider(_CultureInfo) Convert CultureInfo interface to


IFormatProvider interface.

ToInt16(ClrChar) Converts the value of the specified clr


Unicode character to the equivalent

697
.Net Runtime Library for Delphi

Name Description

16-bit signed integer.

ToInt16(ClrVariant) Converts the value of the specified


variant to a 16-bit signed integer.

ToInt16(ClrVariant, IFormatProvider) Converts the value of the specified


variant to a 16-bit signed integer,
using the specified culture-specific
formatting information.

ToInt16(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an
equivalent 16-bit signed integer.

ToInt16(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 16-bit signed integer, using
the specified culture-specific
formatting information.

ToInt32(ClrChar) Converts the value of the specified clr


Unicode character to the equivalent
32-bit signed integer.

ToInt32(ClrVariant) Converts the value of the specified


variant to a 32-bit signed integer.

ToInt32(ClrVariant, IFormatProvider) Converts the value of the specified


variant to a 32-bit signed integer,
using the specified culture-specific
formatting information.

ToInt32(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an
equivalent 32-bit signed integer.

ToInt32(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 32-bit signed integer, using
the specified culture-specific
formatting information.

ToInt64(ClrChar) Converts the value of the specified clr


Unicode character to the equivalent
64-bit signed integer.

ToInt64(ClrVariant) Converts the value of the specified


variant to a 64-bit signed integer.

698
.Net Runtime Library for Delphi

Name Description

ToInt64(ClrVariant, IFormatProvider) Converts the value of the specified


variant to a 64-bit signed integer,
using the specified culture-specific
formatting information.

ToInt64(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an
equivalent 64-bit signed integer.

ToInt64(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 64-bit signed integer, using
the specified culture-specific
formatting information.

ToInterface Converts the value of the specified


variant to IInterface.

ToManagedPointer(ClrVariant) Converts the value of the specified


variant to clr managed pointer.

ToManagedPointer(Pointer) Converts the value of the specified


unmanaged pointer to clr managed
pointer.

ToManagedPointer(TObject) Converts the value of the specified


Object to clr managed pointer.

ToObject Converts the value of the specified


managed pointer to object.

ToPointer Converts the value of the specified


managed pointer to unmanaged
Pointer.

ToSByte(ClrChar) Converts the value of the specified clr


Unicode character to the equivalent 8-
bit signed integer.

ToSByte(ClrVariant) Converts the value of the specified


variant to an 8-bit signed integer.

ToSByte(ClrVariant, IFormatProvider) Converts the value of the specified


variant to an 8-bit signed integer,
using the specified culture-specific
formatting information.

ToSByte(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an

699
.Net Runtime Library for Delphi

Name Description

equivalent 8-bit signed integer.

ToSByte(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 8-bit signed integer, using
the specified culture-specific
formatting information.

ToSingle(ClrChar) Calling this method always throws


InvalidCastException.

ToSingle(ClrVariant) Converts the value of the specified


variant to a single-precision floating-
point number.

ToSingle(ClrVariant, IFormatProvider) Converts the value of the specified


variant to an single-precision floating-
point number, using the specified
culture-specific formatting information.

ToSingle(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent single-precision floating-
point number, using the specified
culture-specific formatting information.

ToString(Byte, ClrInt32) Converts the value of an 8-bit


unsigned integer to its equivalent
string representation in a specified
base.

ToString(Byte, IFormatProvider) Converts the value of the specified 8-


bit unsigned integer to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrBoolean, IFormatProvider) Converts the specified Boolean value


to its equivalent string representation.

ToString(ClrChar) Converts the value of the specified


Unicode character to its equivalent
string representation.

ToString(ClrChar, IFormatProvider) Converts the value of the specified clr


Unicode character to its equivalent
string representation, using the
specified culture-specific formatting
information.

700
.Net Runtime Library for Delphi

Name Description

ToString(ClrDateTime, IFormatProvider) Converts the value of the specified


DateTime to its equivalent string
representation, using the specified
culture-specific formatting information.

ToString(ClrDecimal) Converts the value of the specified


decimal number to its equivalent string
representation.

ToString(ClrDecimal, IFormatProvider) Converts the value of the specified


decimal number to its equivalent string
representation, using the specified
culture-specific formatting information.

ToString(ClrDouble, IFormatProvider) Converts the value of the specified


double-precision floating-point
number to its equivalent string
representation.

ToString(ClrInt16, ClrInt32) Converts the value of a 16-bit signed


integer to its equivalent string
representation in a specified base.

ToString(ClrInt16, IFormatProvider) Converts the value of the specified 16-


bit signed integer to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrInt32, ClrInt32) Converts the value of a 32-bit signed


integer to its equivalent string
representation in a specified base.

ToString(ClrInt32, IFormatProvider) Converts the value of the specified 32-


bit signed integer to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrInt64, ClrInt32) Converts the value of a 64-bit signed


integer to its equivalent string
representation in a specified base.

ToString(ClrSByte, IFormatProvider) Converts the value of the specified 8-


bit signed integer to its equivalent
string representation, using the
specified culture-specific formatting
information.

701
.Net Runtime Library for Delphi

Name Description

ToString(ClrSingle, IFormatProvider) Converts the value of the specified


single-precision floating-point number
to its equivalent string representation,
using the specified culture-specific
formatting information.

ToString(ClrUInt16, IFormatProvider) Converts the value of the specified 16-


bit unsigned integer to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrUInt32, IFormatProvider) Converts the value of the specified 32-


bit unsigned integer to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrUInt64, IFormatProvider) Converts the value of the specified 64-


bit unsigned integer to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrVariant) Converts the value of the specified


variant to its equivalent string
representation.

ToString(ClrVariant, IFormatProvider) Converts the value of the specified


variant to its equivalent string
representation using the specified
culture-specific formatting information.

ToString(ClrWChar, IFormatProvider) Converts the value of the specified


Unicode character to its equivalent
string representation, using the
specified culture-specific formatting
information.

ToString(ClrWString, IFormatProvider) Returns the specified string instance;


no actual conversion is performed.

ToUInt16(ClrChar) Converts the value of the specified clr


Unicode character to the equivalent
16-bit unsigned integer.

ToUInt16(ClrVariant) Converts the value of the specified


variant to a 16-bit unsigned integer.

702
.Net Runtime Library for Delphi

Name Description

ToUInt16(ClrVariant, IFormatProvider) Converts the value of the specified


variant to a 16-bit unsigned integer,
using the specified culture-specific
formatting information.

ToUInt16(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an
equivalent 16-bit unsigned integer.

ToUInt16(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 16-bit unsigned integer,
using the specified culture-specific
formatting information.

ToUInt32(ClrChar) Converts the value of the specified clr


Unicode character to the equivalent
32-bit unsigned integer.

ToUInt32(ClrVariant) Converts the value of the specified


variant to a 32-bit unsigned integer.

ToUInt32(ClrVariant, IFormatProvider) Converts the value of the specified


variant to a 32-bit unsigned integer,
using the specified culture-specific
formatting information.

ToUInt32(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an
equivalent 32-bit unsigned integer.

ToUInt32(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 32-bit unsigned integer,
using the specified culture-specific
formatting information.

ToUInt64(ClrChar) Converts the value of the specified clr


Unicode character to the equivalent
64-bit unsigned integer.

ToUInt64(ClrVariant) Converts the value of the specified


variant to a 64-bit unsigned integer.

ToUInt64(ClrVariant, IFormatProvider) Converts the value of the specified


variant to a 64-bit unsigned integer,
using the specified culture-specific
formatting information.

703
.Net Runtime Library for Delphi

Name Description

ToUInt64(ClrWString, ClrInt32) Converts the string representation of a


number in a specified base to an
equivalent 64-bit unsigned integer.

ToUInt64(ClrWString, IFormatProvider) Converts the specified string


representation of a number to an
equivalent 64-bit unsigned integer,
using the specified culture-specific
formatting information.

ToVariant(IDispatch) Convert the value of the specified


dispatch interface to variant.

ToVariant(TClrBaseObject) Convert the value of the specified


clr base object to variant.

TryChangeObjectType(ClrVariant, _Type, IDispatch) Convert the value of specified


variant to the dispatch interface
of the specified type.

TryChangeObjectType(ClrVariant, string, IDispatch) Convert the value of specified


variant to the dispatch interface
of the specified type using the
type name.

TryCreateClrWrapper(IDispatch, _Type, IDispatch) Wrap the value of the specified


dispatch interface to the dispatch
of the specified type.

TryCreateClrWrapper(IDispatch, string, IDispatch) Wrap the value of the specified


dispatch interface to the dispatch
of the specified type using the
type name.

Unwrap Unwrap the value of the specified


variant to the original .net object
as variant.

UnwrapToInterface Unwrap the value of the specified


variant to the original .net object as
interface.

7.1.1.8.1.1.7.1.1 ChangeObjectType Method

This is the overview for the ChangeObjectType method overload.

704
.Net Runtime Library for Delphi

Overload List

Name Description

TClrConvert.ChangeObjectType Returns a variant of the specified type and whose value is


(ClrVariant, _Type) equivalent to the specified variant.

TClrConvert.ChangeObjectType Returns a variant of the specified type name and whose


(ClrVariant, string) value is equivalent to the specified variant.

7.1.1.8.1.1.7.1.1 TClrConvert.ChangeObjectType Method (ClrVariant, _Type)

Returns a variant of the specified type and whose value is equivalent to the specified variant.

Syntax
Delphi

class function ChangeObjectType(AValue: ClrVariant; AConversionType:


_Type): IDispatch; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.1 TClrConvert.ChangeObjectType Method (ClrVariant, string)


Returns a variant of the specified type name and whose value is equivalent to the specified
variant.

Syntax
Delphi

class function ChangeObjectType(AValue: ClrVariant;


AConversionTypeName: string): IDispatch; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.2 ChangeType Method

This is the overview for the ChangeType method overload.

Overload List

705
.Net Runtime Library for Delphi

Name Description

TClrConvert.ChangeType Returns a variant of the specified type whose value is


(ClrVariant, TTypeCode) equivalent to the specified variant.

TClrConvert.ChangeType Returns a variant of the specified type and whose value is equivalent
(ClrVariant, _Type) to the specified variant.

TClrConvert.ChangeType Returns a variant of the specified type and whose value is


(ClrVariant, string) equivalent to the specified variant using the type name.

7.1.1.8.1.1.7.1.2 TClrConvert.ChangeType Method (ClrVariant, TTypeCode)

Returns a variant of the specified type whose value is equivalent to the specified variant.

Syntax
Delphi

class function ChangeType(AValue: ClrVariant; ATypeCode: TTypeCode):


ClrVariant; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.2 TClrConvert.ChangeType Method (ClrVariant, _Type)


Returns a variant of the specified type and whose value is equivalent to the specified variant.

Syntax
Delphi

class function ChangeType(AValue: ClrVariant; AConversionType: _Type):


ClrVariant; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.2 TClrConvert.ChangeType Method (ClrVariant, string)

Returns a variant of the specified type and whose value is equivalent to the specified variant
using the type name.

Syntax

706
.Net Runtime Library for Delphi

Delphi

class function ChangeType(AValue: ClrVariant; AConversionTypeName:


string): ClrVariant; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.3 CreateClrWrapper Method

This is the overview for the CreateClrWrapper method overload.

Overload List

Name Description

TClrConvert.CreateClrWrapper Create Clr wrapper of the specified variant with the


(ClrVariant, _Type) specified type.

TClrConvert.CreateClrWrapper Create Clr wrapper of the specified variant with the


(ClrVariant, string) specified type using the type name.

7.1.1.8.1.1.7.1.3 TClrConvert.CreateClrWrapper Method (ClrVariant, _Type)

Create Clr wrapper of the specified variant with the specified type.

Syntax
Delphi

class function CreateClrWrapper(AValue: ClrVariant; AWrapType: _Type):


IDispatch; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.3 TClrConvert.CreateClrWrapper Method (ClrVariant, string)


Create Clr wrapper of the specified variant with the specified type using the type name.

Syntax
Delphi

class function CreateClrWrapper(AValue: ClrVariant; AWrapTypeName:


string): IDispatch; overload;

707
.Net Runtime Library for Delphi

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.4 FromBase64CharArray Method

This is the overview for the FromBase64CharArray method overload.

Overload List

Name Description

TClrConvert.FromBase64CharArray Converts a subset of a Unicode character dynamic array, which


(TClrWCharDynArray, ClrInt32, encodes binary data as base-64 digits, to an equivalent 8-bit
unsigned integer array. Parameters specify the subset in the input
ClrInt32)
array and the number of elements to convert.

TClrConvert.FromBase64CharArray Converts a subset of a Unicode character array, which


(_CharArray, ClrInt32, ClrInt32) encodes binary data as base-64 digits, to an equivalent 8-
bit unsigned integer array. Parameters specify the subset
in the input array and the number of elements to convert.

7.1.1.8.1.1.7.1.4 TClrConvert.FromBase64CharArray Method (TClrWCharDynArray, ClrInt32,


ClrInt32)
Converts a subset of a Unicode character dynamic array, which encodes binary data as base-64 digits, to an equivalent
8-bit unsigned integer array. Parameters specify the subset in the input array and the number of elements to convert.

Syntax
Delphi

class function FromBase64CharArray(AInArray: TClrWCharDynArray;


AOffset: ClrInt32; ALength: ClrInt32): _ByteArray; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.4 TClrConvert.FromBase64CharArray Method (_CharArray, ClrInt32, ClrInt32)

Converts a subset of a Unicode character array, which encodes binary data as base-64 digits, to
an equivalent 8-bit unsigned integer array. Parameters specify the subset in the input array and
the number of elements to convert.

Syntax
Delphi

708
.Net Runtime Library for Delphi

class function FromBase64CharArray(AInArray: _CharArray; AOffset:


ClrInt32; ALength: ClrInt32): _ByteArray; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.5 FromBase64CharArrayAsByteDynArray Method

This is the overview for the FromBase64CharArrayAsByteDynArray method overload.

Overload List

Name Description

TClrConvert.FromBase64CharArrayAsByteDynArray Converts a subset of a Unicode character


(TClrWCharDynArray, ClrInt32, ClrInt32) dynamic array, which encodes binary data
as base-64 digits, to an equivalent 8-bit
unsigned integer dynamic array.
Parameters specify the subset in the input
array and the number of elements to
convert.

TClrConvert.FromBase64CharArrayAsByteDynArray Converts a subset of an 8-bit unsigned


(_CharArray, ClrInt32, ClrInt32) integer array to an equivalent subset of a
Unicode character dynamic array encoded
with base-64 digits. Parameters specify the
subsets as offsets in the input and output
arrays, and the number of elements in the
input array to convert.

7.1.1.8.1.1.7.1.5 TClrConvert.FromBase64CharArrayAsByteDynArray Method


(TClrWCharDynArray, ClrInt32, ClrInt32)

Converts a subset of a Unicode character dynamic array, which encodes binary data as base-64
digits, to an equivalent 8-bit unsigned integer dynamic array. Parameters specify the subset in
the input array and the number of elements to convert.

Syntax
Delphi

class function FromBase64CharArrayAsByteDynArray(AInArray:


TClrWCharDynArray; AOffset: ClrInt32; ALength: ClrInt32):
TClrByteDynArray; overload;

See Also

709
.Net Runtime Library for Delphi

TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.5 TClrConvert.FromBase64CharArrayAsByteDynArray Method (_CharArray,


ClrInt32, ClrInt32)

Converts a subset of an 8-bit unsigned integer array to an equivalent subset of a Unicode


character dynamic array encoded with base-64 digits. Parameters specify the subsets as offsets
in the input and output arrays, and the number of elements in the input array to convert.

Syntax
Delphi

class function FromBase64CharArrayAsByteDynArray(AInArray: _CharArray;


AOffset: ClrInt32; ALength: ClrInt32): TClrByteDynArray; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.6 TClrConvert.FromBase64String Method

Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-
bit unsigned integer array.

Syntax
Delphi

class function FromBase64String(S: ClrWString): _ByteArray;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.7 TClrConvert.FromBase64StringAsByteDynArray Method


Syntax
Delphi

class function FromBase64StringAsByteDynArray(S: ClrWString):


TClrByteDynArray;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

710
.Net Runtime Library for Delphi

7.1.1.8.1.1.7.1.8 TClrConvert.GetDefaultInterface Method


Syntax
Delphi

class function GetDefaultInterface: _Convert;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.9 GetEnumValue Method

This is the overview for the GetEnumValue method overload.

Overload List

Name Description

TClrConvert.GetEnumValue Converts the specified TOleEnum enumeration constant to


(_Type, TOleEnum) an equivalent clr enumeration member.

TClrConvert.GetEnumValue Converts the specified TOleEnum enumeration constant to


(string, TOleEnum) an equivalent clr enumeration member.

7.1.1.8.1.1.7.1.9 TClrConvert.GetEnumValue Method (_Type, TOleEnum)


Converts the specified TOleEnum enumeration constant to an equivalent clr enumeration member.

Syntax
Delphi

class function GetEnumValue(AEnumType: _Type; AValue: TOleEnum):


ClrVariant; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.9 TClrConvert.GetEnumValue Method (string, TOleEnum)


Syntax
Delphi

class function GetEnumValue(AEnumTypeName: string; AValue: TOleEnum):


ClrVariant; overload;

711
.Net Runtime Library for Delphi

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.10 TClrConvert.GetTypeCode Method


Returns the TypeCode for the specified variant.

Syntax
Delphi

class function GetTypeCode(AValue: ClrVariant): TTypeCode;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.11 TClrConvert.IsDBNull Method


Returns an indication whether the specified object is of type DBNull.

Syntax
Delphi

class function IsDBNull(AValue: ClrVariant): ClrBoolean;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.12 ToAnsiChar Method

This is the overview for the ToAnsiChar method overload.

Overload List

Name Description

TClrConvert.ToAnsiChar Converts the value of the specified clr character to its


(ClrChar) equivalent ansi character.

TClrConvert.ToAnsiChar Converts the value of the specified variant to its equivalent ansi
(ClrVariant) character.

7.1.1.8.1.1.7.1.12 TClrConvert.ToAnsiChar Method (ClrChar)

712
.Net Runtime Library for Delphi

Converts the value of the specified clr character to its equivalent ansi character.

Syntax
Delphi

class function ToAnsiChar(const AChar: ClrChar): ClrAChar; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.12 TClrConvert.ToAnsiChar Method (ClrVariant)


Converts the value of the specified variant to its equivalent ansi character.

Syntax
Delphi

class function ToAnsiChar(const AChar: ClrVariant): ClrAChar;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.13 ToBase64CharArray Method

This is the overview for the ToBase64CharArray method overload.

Overload List

Name Description

TClrConvert.ToBase64CharArray Converts a subset of an 8-bit unsigned integer dynamic array to an


(TClrByteDynArray, ClrInt32, equivalent subset of a Unicode character array encoded with base-
64 digits. Parameters specify the subsets as offsets in the input and
ClrInt32, TClrWCharDynArray,
output arrays, and the number of elements in the input array to
ClrInt32)
convert.

TClrConvert.ToBase64CharArray Converts a subset of an 8-bit unsigned integer dynamic array to an


(TClrByteDynArray, ClrInt32, equivalent subset of a Unicode character array encoded with base-
64 digits. Parameters specify the subsets as offsets in the input and
ClrInt32, TClrWCharDynArray,
output arrays, the number of elements in the input array to convert,
ClrInt32,
and whether line breaks are inserted in the output array.
TBase64FormattingOptions)

TClrConvert.ToBase64CharArray Converts a subset of an 8-bit unsigned integer array to an


(_ByteArray, ClrInt32, ClrInt32, equivalent subset of a Unicode character array encoded

713
.Net Runtime Library for Delphi

Name Description

_CharArray, ClrInt32) with base-64 digits. Parameters specify the subsets as


offsets in the input and output arrays, and the number of
elements in the input array to convert.

TClrConvert.ToBase64CharArray Converts a subset of an 8-bit unsigned integer array to an


(_ByteArray, ClrInt32, ClrInt32, equivalent subset of a Unicode character array encoded with base-
64 digits. Parameters specify the subsets as offsets in the input and
_CharArray, ClrInt32,
output arrays, the number of elements in the input array to convert,
TBase64FormattingOptions)
and whether line breaks are inserted in the output array.

7.1.1.8.1.1.7.1.13 TClrConvert.ToBase64CharArray Method (TClrByteDynArray, ClrInt32,


ClrInt32, TClrWCharDynArray, ClrInt32)
Converts a subset of an 8-bit unsigned integer dynamic array to an equivalent subset of a Unicode character array
encoded with base-64 digits. Parameters specify the subsets as offsets in the input and output arrays, and the number
of elements in the input array to convert.

Syntax
Delphi

class function ToBase64CharArray(AInArray: TClrByteDynArray;


AOffsetIn: ClrInt32; ALength: ClrInt32; AOutArray: TClrWCharDynArray;

AOffsetOut: ClrInt32): ClrInt32; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.13 TClrConvert.ToBase64CharArray Method (TClrByteDynArray, ClrInt32,


ClrInt32, TClrWCharDynArray, ClrInt32, TBase64FormattingOptions)
Converts a subset of an 8-bit unsigned integer dynamic array to an equivalent subset of a Unicode character array
encoded with base-64 digits. Parameters specify the subsets as offsets in the input and output arrays, the number of
elements in the input array to convert, and whether line breaks are inserted in the output array.

Syntax
Delphi

class function ToBase64CharArray(AInArray: TClrByteDynArray;


AOffsetIn: ClrInt32; ALength: ClrInt32; AOutArray: TClrWCharDynArray;

AOffsetOut: ClrInt32; AOptions: TBase64FormattingOptions):


ClrInt32; overload;

See Also

714
.Net Runtime Library for Delphi

TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.13 TClrConvert.ToBase64CharArray Method (_ByteArray, ClrInt32, ClrInt32,


_CharArray, ClrInt32)

Converts a subset of an 8-bit unsigned integer array to an equivalent subset of a Unicode


character array encoded with base-64 digits. Parameters specify the subsets as offsets in the
input and output arrays, and the number of elements in the input array to convert.

Syntax
Delphi

class function ToBase64CharArray(AInArray: _ByteArray; AOffsetIn:


ClrInt32; ALength: ClrInt32; AOutArray: _CharArray;

AOffsetOut: ClrInt32): ClrInt32; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.13 TClrConvert.ToBase64CharArray Method (_ByteArray, ClrInt32, ClrInt32,


_CharArray, ClrInt32, TBase64FormattingOptions)
Converts a subset of an 8-bit unsigned integer array to an equivalent subset of a Unicode character array encoded with
base-64 digits. Parameters specify the subsets as offsets in the input and output arrays, the number of elements in the
input array to convert, and whether line breaks are inserted in the output array.

Syntax
Delphi

class function ToBase64CharArray(AInArray: _ByteArray; AOffsetIn:


ClrInt32; ALength: ClrInt32; AOutArray: _CharArray;

AOffsetOut: ClrInt32; AOptions: TBase64FormattingOptions):


ClrInt32; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.14 ToBase64String Method

This is the overview for the ToBase64String method overload.

Overload List

Name Description

715
.Net Runtime Library for Delphi

Name Description

TClrConvert.ToBase64String Converts a dynamic array of 8-bit unsigned integers to its equivalent


(TClrByteDynArray) string representation that is encoded with base-64 digits.

TClrConvert.ToBase64String Converts a subset of a dynamic array of 8-bit unsigned integers to its


(TClrByteDynArray, ClrInt32, equivalent string representation that is encoded with base-64 digits.
Parameters specify the subset as an offset in the input array, and the
ClrInt32)
number of elements in the array to convert.

TClrConvert.ToBase64String Converts a subset of a dynamic array of 8-bit unsigned integers


(TClrByteDynArray, ClrInt32, to its equivalent string representation that is encoded with base-64
ClrInt32, digits. Parameters specify the subset as an offset in the input array, the
number of elements in the array to convert, and whether to insert line
TBase64FormattingOptions)
breaks in the return value.

TClrConvert.ToBase64String Converts a dynamic array of 8-bit unsigned integers to its equivalent


(TClrByteDynArray, string representation that is encoded with base-64 digits. A parameter
specifies whether to insert line breaks in the return value.
TBase64FormattingOptions)

TClrConvert.ToBase64String Converts an array of 8-bit unsigned integers to its equivalent


(_ByteArray) string representation that is encoded with base-64 digits.

TClrConvert.ToBase64String Converts a subset of an array of 8-bit unsigned integers to its


(_ByteArray, ClrInt32, equivalent string representation that is encoded with base-64 digits.
Parameters specify the subset as an offset in the input array, and the
ClrInt32)
number of elements in the array to convert.

TClrConvert.ToBase64String Converts a subset of an array of 8-bit unsigned integers to its


(_ByteArray, ClrInt32, equivalent string representation that is encoded with base-
ClrInt32, 64 digits. Parameters specify the subset as an offset in the
TBase64FormattingOptions) input array, the number of elements in the array to convert,
and whether to insert line breaks in the return value.

TClrConvert.ToBase64String Converts an array of 8-bit unsigned integers to its equivalent


(_ByteArray, string representation that is encoded with base-64 digits. A
TBase64FormattingOptions) parameter specifies whether to insert line breaks in the
return value.

7.1.1.8.1.1.7.1.14 TClrConvert.ToBase64String Method (TClrByteDynArray)


converts a dynamic array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64
digits.

Syntax
Delphi

716
.Net Runtime Library for Delphi

class function ToBase64String(AInArray: TClrByteDynArray): ClrWString;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.14 TClrConvert.ToBase64String Method (TClrByteDynArray, ClrInt32, ClrInt32)


Converts a subset of a dynamic array of 8-bit unsigned integers to its equivalent string representation that is encoded
with base-64 digits. Parameters specify the subset as an offset in the input array, and the number of elements in the
array to convert.

Syntax
Delphi

class function ToBase64String(AInArray: TClrByteDynArray; AOffset:


ClrInt32; ALength: ClrInt32): ClrWString; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.14 TClrConvert.ToBase64String Method (TClrByteDynArray, ClrInt32, ClrInt32,


TBase64FormattingOptions)

Converts a subset of a dynamic array of 8-bit unsigned integers to its equivalent string representation that is
encoded with base-64 digits. Parameters specify the subset as an offset in the input array, the number of elements in
the array to convert, and whether to insert line breaks in the return value.

Syntax
Delphi

class function ToBase64String(AInArray: TClrByteDynArray; AOffset:


ClrInt32; ALength: ClrInt32; AOptions: TBase64FormattingOptions):
ClrWString; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.14 TClrConvert.ToBase64String Method (TClrByteDynArray,


TBase64FormattingOptions)

Converts a dynamic array of 8-bit unsigned integers to its equivalent string representation that
is encoded with base-64 digits. A parameter specifies whether to insert line breaks in the return
value.

Syntax

717
.Net Runtime Library for Delphi

Delphi

class function ToBase64String(AInArray: TClrByteDynArray; AOptions:


TBase64FormattingOptions): ClrWString; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.14 TClrConvert.ToBase64String Method (_ByteArray)

Converts an array of 8-bit unsigned integers to its equivalent string representation that is
encoded with base-64 digits.

Syntax
Delphi

class function ToBase64String(AInArray: _ByteArray): ClrWString;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.14 TClrConvert.ToBase64String Method (_ByteArray, ClrInt32, ClrInt32)


Converts a subset of an array of 8-bit unsigned integers to its equivalent string representation that is encoded with
base-64 digits. Parameters specify the subset as an offset in the input array, and the number of elements in the array to
convert.

Syntax
Delphi

class function ToBase64String(AInArray: _ByteArray; AOffset: ClrInt32;


ALength: ClrInt32): ClrWString; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.14 TClrConvert.ToBase64String Method (_ByteArray, ClrInt32, ClrInt32,


TBase64FormattingOptions)

Converts a subset of an array of 8-bit unsigned integers to its equivalent string representation
that is encoded with base-64 digits. Parameters specify the subset as an offset in the input
array, the number of elements in the array to convert, and whether to insert line breaks in the
return value.

718
.Net Runtime Library for Delphi

Syntax
Delphi

class function ToBase64String(AInArray: _ByteArray; AOffset: ClrInt32;


ALength: ClrInt32; AOptions: TBase64FormattingOptions): ClrWString;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.14 TClrConvert.ToBase64String Method (_ByteArray,


TBase64FormattingOptions)

Converts an array of 8-bit unsigned integers to its equivalent string representation that is
encoded with base-64 digits. A parameter specifies whether to insert line breaks in the return
value.

Syntax
Delphi

class function ToBase64String(AInArray: _ByteArray; AOptions:


TBase64FormattingOptions): ClrWString; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.15 ToBoolean Method

This is the overview for the ToBoolean method overload.

Overload List

Name Description

TClrConvert.ToBoolean Calling this method always throws InvalidCastException.


(ClrChar)

TClrConvert.ToBoolean Converts the value of a specified variant to an equivalent Boolean


(ClrVariant) value.

TClrConvert.ToBoolean Converts the value of the specified variant to an equivalent Boolean


(ClrVariant, value, using the specified culture-specific formatting information.

IFormatProvider)

719
.Net Runtime Library for Delphi

Name Description

TClrConvert.ToBoolean Converts the specified string representation of a logical value to its


(ClrWString, Boolean equivalent, using the specified culture-specific formatting
information.
IFormatProvider)

7.1.1.8.1.1.7.1.15 TClrConvert.ToBoolean Method (ClrChar)


Calling this method always throws InvalidCastException.

Syntax
Delphi

class function ToBoolean(const AValue: ClrChar): ClrBoolean; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.15 TClrConvert.ToBoolean Method (ClrVariant)


Converts the value of a specified variant to an equivalent Boolean value.

Syntax
Delphi

class function ToBoolean(const AValue: ClrVariant): ClrBoolean;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.15 TClrConvert.ToBoolean Method (ClrVariant, IFormatProvider)


Converts the value of the specified variant to an equivalent Boolean value, using the specified culture-specific
formatting information.

Syntax
Delphi

class function ToBoolean(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrBoolean; overload;

See Also

720
.Net Runtime Library for Delphi

TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.15 TClrConvert.ToBoolean Method (ClrWString, IFormatProvider)


Converts the specified string representation of a logical value to its Boolean equivalent, using the specified culture-
specific formatting information.

Syntax
Delphi

class function ToBoolean(const AValue: ClrWString; AProvider:


IFormatProvider): ClrBoolean; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.16 ToByte Method

This is the overview for the ToByte method overload.

Overload List

Name Description

TClrConvert.ToByte (ClrChar) Converts the value of the specified Unicode character to the
equivalent 8-bit unsigned integer.

TClrConvert.ToByte Converts the value of the specified variant to an 8-bit


(ClrVariant) unsigned integer.

TClrConvert.ToByte Converts the value of the specified variant to an 8-bit


(ClrVariant, unsigned integer, using the specified culture-specific
IFormatProvider) formatting information.

TClrConvert.ToByte Converts the string representation of a number in a specified


(ClrWString, ClrInt32) base to an equivalent 8-bit unsigned integer.

TClrConvert.ToByte Converts the specified string representation of a number to


(ClrWString, an equivalent 8-bit unsigned integer, using specified culture-
IFormatProvider) specific formatting information.

7.1.1.8.1.1.7.1.16 TClrConvert.ToByte Method (ClrChar)


Converts the value of the specified Unicode character to the equivalent 8-bit unsigned integer.

721
.Net Runtime Library for Delphi

Syntax
Delphi

class function ToByte(const AValue: ClrChar): Byte; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.16 TClrConvert.ToByte Method (ClrVariant)


Converts the value of the specified variant to an 8-bit unsigned integer.

Syntax
Delphi

class function ToByte(const AValue: ClrVariant): Byte; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.16 TClrConvert.ToByte Method (ClrVariant, IFormatProvider)


Converts the value of the specified variant to an 8-bit unsigned integer, using the specified
culture-specific formatting information.

Syntax
Delphi

class function ToByte(const AValue: ClrVariant; AProvider:


IFormatProvider): Byte; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.16 TClrConvert.ToByte Method (ClrWString, ClrInt32)


Converts the string representation of a number in a specified base to an equivalent 8-bit
unsigned integer.

Syntax
Delphi

class function ToByte(const AValue: ClrWString; AFromBase: ClrInt32):


Byte; overload;

722
.Net Runtime Library for Delphi

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.16 TClrConvert.ToByte Method (ClrWString, IFormatProvider)


Converts the specified string representation of a number to an equivalent 8-bit unsigned
integer, using specified culture-specific formatting information.

Syntax
Delphi

class function ToByte(const AValue: ClrWString; AProvider:


IFormatProvider): Byte; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.17 ToChar Method

This is the overview for the ToChar method overload.

Overload List

Name Description

TClrConvert.ToChar Converts clr unicode character to it equivalent delphi wide


(ClrChar) character.

TClrConvert.ToChar Converts the value of the specified variant to a Unicode character.


(ClrVariant)

TClrConvert.ToChar Converts the value of the specified variant to its equivalent Unicode
(ClrVariant, character, using the specified culture-specific formatting information.

IFormatProvider)

TClrConvert.ToChar Converts the first character of a specified string to a Unicode


(ClrWString, character, using specified culture-specific formatting information.

IFormatProvider)

7.1.1.8.1.1.7.1.17 TClrConvert.ToChar Method (ClrChar)


Converts clr unicode character to it equivalent delphi wide character.

Syntax

723
.Net Runtime Library for Delphi

Delphi

class function ToChar(const AValue: ClrChar): ClrWChar; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.17 TClrConvert.ToChar Method (ClrVariant)


Converts the value of the specified variant to a Unicode character.

Syntax
Delphi

class function ToChar(const AValue: ClrVariant): ClrWChar; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.17 TClrConvert.ToChar Method (ClrVariant, IFormatProvider)


Converts the value of the specified variant to its equivalent Unicode character, using the specified culture-specific
formatting information.

Syntax
Delphi

class function ToChar(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrWChar; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.17 TClrConvert.ToChar Method (ClrWString, IFormatProvider)


Converts the first character of a specified string to a Unicode character, using specified culture-specific formatting
information.

Syntax
Delphi

class function ToChar(const AValue: ClrWString; AProvider:


IFormatProvider): ClrWChar; overload;

See Also

724
.Net Runtime Library for Delphi

TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.18 TClrConvert.ToClrBaseObject Method

Convert variant to the base clr object.

Syntax
Delphi

class function ToClrBaseObject(AValue: ClrVariant): TClrBaseObject;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.19 ToClrChar Method

This is the overview for the ToClrChar method overload.

Overload List

Name Description

TClrConvert.ToClrChar Converts the value of the specified 32-bit signed integer to its
(ClrInt32) equivalent clr Unicode character.

TClrConvert.ToClrChar Converts the value of the specified variant to a clr Unicode character.
(ClrVariant)

TClrConvert.ToClrChar Converts the value of the specified variant to its equivalent clr Unicode
(ClrVariant, character, using the specified culture-specific formatting information.

IFormatProvider)

TClrConvert.ToClrChar Converts the value of the specified delphi wide character to a clr
(ClrWChar) Unicode character.

TClrConvert.ToClrChar Converts the first character of a specified string to a Unicode


(ClrWString, character, using specified culture-specific formatting information.

IFormatProvider)

7.1.1.8.1.1.7.1.19 TClrConvert.ToClrChar Method (ClrInt32)


Converts the value of the specified 32-bit signed integer to its equivalent clr Unicode character.

Syntax

725
.Net Runtime Library for Delphi

Delphi

class function ToClrChar(const AValue: ClrInt32): ClrChar; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.19 TClrConvert.ToClrChar Method (ClrVariant)


Converts the value of the specified variant to a clr Unicode character.

Syntax
Delphi

class function ToClrChar(const AValue: ClrVariant): ClrChar; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.19 TClrConvert.ToClrChar Method (ClrVariant, IFormatProvider)


Converts the value of the specified variant to its equivalent clr Unicode character, using the specified culture-specific
formatting information.

Syntax
Delphi

class function ToClrChar(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrChar; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.19 TClrConvert.ToClrChar Method (ClrWChar)


Converts the value of the specified delphi wide character to a clr Unicode character.

Syntax
Delphi

class function ToClrChar(const AValue: ClrWChar): ClrChar; overload;

See Also

726
.Net Runtime Library for Delphi

TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.19 TClrConvert.ToClrChar Method (ClrWString, IFormatProvider)


Converts the first character of a specified string to a Unicode character, using specified culture-specific formatting
information.

Syntax
Delphi

class function ToClrChar(const AValue: ClrWString; AProvider:


IFormatProvider): ClrChar; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.20 TClrConvert.ToClrObject Method

Converts the value of the specified variant to a clr object interface.

Syntax
Delphi

class function ToClrObject(AValue: ClrVariant): _ClrObject;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.21 ToDateTime Method

This is the overview for the ToDateTime method overload.

Overload List

Name Description

TClrConvert.ToDateTime Calling this method always throws InvalidCastException.


(ClrChar)

TClrConvert.ToDateTime Converts the value of the specified variant to a DateTime.


(ClrVariant)

TClrConvert.ToDateTime Converts the value of the specified variant to a DateTime object,


(ClrVariant, using the specified culture-specific formatting information.

727
.Net Runtime Library for Delphi

Name Description

IFormatProvider)

TClrConvert.ToDateTime Converts the specified string representation of a number to an


(ClrWString, equivalent date and time, using the specified culture-specific
formatting information.
IFormatProvider)

7.1.1.8.1.1.7.1.21 TClrConvert.ToDateTime Method (ClrChar)


Calling this method always throws InvalidCastException.

Syntax
Delphi

class function ToDateTime(const AValue: ClrChar): ClrDateTime;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.21 TClrConvert.ToDateTime Method (ClrVariant)

Converts the value of the specified variant to a DateTime.

Syntax
Delphi

class function ToDateTime(const AValue: ClrVariant): ClrDateTime;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.21 TClrConvert.ToDateTime Method (ClrVariant, IFormatProvider)

Converts the value of the specified variant to a DateTime object, using the specified culture-specific formatting
information.

Syntax
Delphi

class function ToDateTime(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrDateTime; overload;

728
.Net Runtime Library for Delphi

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.21 TClrConvert.ToDateTime Method (ClrWString, IFormatProvider)


Converts the specified string representation of a number to an equivalent date and time, using the specified culture-
specific formatting information.

Syntax
Delphi

class function ToDateTime(const AValue: ClrWString; AProvider:


IFormatProvider): ClrDateTime; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.22 ToDecimal Method

This is the overview for the ToDecimal method overload.

Overload List

Name Description

TClrConvert.ToDecimal Calling this method always throws InvalidCastException.


(ClrChar)

TClrConvert.ToDecimal Converts the value of the specified variant to an equivalent decimal


(ClrVariant) number.

TClrConvert.ToDecimal Converts the value of the specified variant to an equivalent decimal


(ClrVariant, number, using the specified culture-specific formatting information.

IFormatProvider)

TClrConvert.ToDecimal Converts the specified string representation of a number to an


(ClrWString, equivalent decimal number, using the specified culture-specific
formatting information.
IFormatProvider)

TClrConvert.ToDecimal Converts the value of the specified double-precision floating-point


(Extended) number to an equivalent decimal number.

7.1.1.8.1.1.7.1.22 TClrConvert.ToDecimal Method (ClrChar)

729
.Net Runtime Library for Delphi

Calling this method always throws InvalidCastException.

Syntax
Delphi

class function ToDecimal(const AValue: ClrChar): ClrDecimal; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.22 TClrConvert.ToDecimal Method (ClrVariant)


Converts the value of the specified variant to an equivalent decimal number.

Syntax
Delphi

class function ToDecimal(const AValue: ClrVariant): ClrDecimal;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.22 TClrConvert.ToDecimal Method (ClrVariant, IFormatProvider)


Converts the value of the specified variant to an equivalent decimal number, using the specified culture-specific
formatting information.

Syntax
Delphi

class function ToDecimal(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrDecimal; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.22 TClrConvert.ToDecimal Method (ClrWString, IFormatProvider)


Converts the specified string representation of a number to an equivalent decimal number, using the specified culture-
specific formatting information.

Syntax
Delphi

730
.Net Runtime Library for Delphi

class function ToDecimal(const AValue: ClrWString; AProvider:


IFormatProvider): ClrDecimal; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.22 TClrConvert.ToDecimal Method (Extended)


Converts the value of the specified double-precision floating-point number to an equivalent decimal number.

Syntax
Delphi

class function ToDecimal(const AValue: Extended): ClrDecimal;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.23 TClrConvert.ToDispatch Method

Converts the value of the specified variant to dispatch interface.

Syntax
Delphi

class function ToDispatch(AValue: ClrVariant): IDispatch;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.24 ToDouble Method

This is the overview for the ToDouble method overload.

Overload List

Name Description

TClrConvert.ToDouble Calling this method always throws InvalidCastException.


(ClrChar)

TClrConvert.ToDouble Converts the value of the specified decimal number to an equivalent

731
.Net Runtime Library for Delphi

Name Description

(ClrDecimal) double-precision floating-point number.

TClrConvert.ToDouble Converts the value of the specified variant to a double-precision


(ClrVariant) floating-point number.

TClrConvert.ToDouble Converts the value of the variant variant to an double-precision


(ClrVariant, floating-point number, using the specified culture-specific formatting
information.
IFormatProvider)

TClrConvert.ToDouble Converts the specified string representation of a number to an


(ClrWString, equivalent double-precision floating-point number, using the
specified culture-specific formatting information.
IFormatProvider)

7.1.1.8.1.1.7.1.24 TClrConvert.ToDouble Method (ClrChar)


Calling this method always throws InvalidCastException.

Syntax
Delphi

class function ToDouble(const AValue: ClrChar): ClrDouble; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.24 TClrConvert.ToDouble Method (ClrDecimal)


Converts the value of the specified decimal number to an equivalent double-precision floating-point number.

Syntax
Delphi

class function ToDouble(const AValue: ClrDecimal): ClrDouble;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.24 TClrConvert.ToDouble Method (ClrVariant)


Converts the value of the specified variant to a double-precision floating-point number.

732
.Net Runtime Library for Delphi

Syntax
Delphi

class function ToDouble(const AValue: ClrVariant): ClrDouble;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.24 TClrConvert.ToDouble Method (ClrVariant, IFormatProvider)


Converts the value of the variant variant to an double-precision floating-point number, using the specified culture-
specific formatting information.

Syntax
Delphi

class function ToDouble(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrDouble; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.24 TClrConvert.ToDouble Method (ClrWString, IFormatProvider)


Converts the specified string representation of a number to an equivalent double-precision floating-point number,
using the specified culture-specific formatting information.

Syntax
Delphi

class function ToDouble(const AValue: ClrWString; AProvider:


IFormatProvider): ClrDouble; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.25 ToFormatProvider Method

This is the overview for the ToFormatProvider method overload.

Overload List

733
.Net Runtime Library for Delphi

Name Description

TClrConvert.ToFormatProvider Convert a format provider variant to IFormatProvider interface.


(ClrVariant)

TClrConvert.ToFormatProvider Convert CultureInfo interface to IFormatProvider interface.


(_CultureInfo)

7.1.1.8.1.1.7.1.25 TClrConvert.ToFormatProvider Method (ClrVariant)

Convert a format provider variant to IFormatProvider interface.

Syntax
Delphi

class function ToFormatProvider(AValue: ClrVariant): IFormatProvider;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.25 TClrConvert.ToFormatProvider Method (_CultureInfo)

Convert CultureInfo interface to IFormatProvider interface.

Syntax
Delphi

class function ToFormatProvider(AValue: _CultureInfo):


IFormatProvider; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.26 ToInt16 Method

This is the overview for the ToInt16 method overload.

Overload List

Name Description

734
.Net Runtime Library for Delphi

Name Description

TClrConvert.ToInt16 Converts the value of the specified clr Unicode character to the
(ClrChar) equivalent 16-bit signed integer.

TClrConvert.ToInt16 Converts the value of the specified variant to a 16-bit signed integer.
(ClrVariant)

TClrConvert.ToInt16 Converts the value of the specified variant to a 16-bit signed integer,
(ClrVariant, using the specified culture-specific formatting information.

IFormatProvider)

TClrConvert.ToInt16 Converts the string representation of a number in a specified base to


(ClrWString, ClrInt32) an equivalent 16-bit signed integer.

TClrConvert.ToInt16 Converts the specified string representation of a number to an


(ClrWString, equivalent 16-bit signed integer, using the specified culture-specific
formatting information.
IFormatProvider)

7.1.1.8.1.1.7.1.26 TClrConvert.ToInt16 Method (ClrChar)


Converts the value of the specified clr Unicode character to the equivalent 16-bit signed integer.

Syntax
Delphi

class function ToInt16(const AValue: ClrChar): ClrInt16; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.26 TClrConvert.ToInt16 Method (ClrVariant)


Converts the value of the specified variant to a 16-bit signed integer.

Syntax
Delphi

class function ToInt16(const AValue: ClrVariant): ClrInt16; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

735
.Net Runtime Library for Delphi

7.1.1.8.1.1.7.1.26 TClrConvert.ToInt16 Method (ClrVariant, IFormatProvider)


Converts the value of the specified variant to a 16-bit signed integer, using the specified culture-specific formatting
information.

Syntax
Delphi

class function ToInt16(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrInt16; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.26 TClrConvert.ToInt16 Method (ClrWString, ClrInt32)


Converts the string representation of a number in a specified base to an equivalent 16-bit signed integer.

Syntax
Delphi

class function ToInt16(const AValue: ClrWString; AFromBase: ClrInt32):


ClrInt16; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.26 TClrConvert.ToInt16 Method (ClrWString, IFormatProvider)


Converts the specified string representation of a number to an equivalent 16-bit signed integer, using the specified
culture-specific formatting information.

Syntax
Delphi

class function ToInt16(const AValue: ClrWString; AProvider:


IFormatProvider): ClrInt16; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.27 ToInt32 Method

This is the overview for the ToInt32 method overload.

736
.Net Runtime Library for Delphi

Overload List

Name Description

TClrConvert.ToInt32 Converts the value of the specified clr Unicode character to the
(ClrChar) equivalent 32-bit signed integer.

TClrConvert.ToInt32 Converts the value of the specified variant to a 32-bit signed integer.
(ClrVariant)

TClrConvert.ToInt32 Converts the value of the specified variant to a 32-bit signed integer,
(ClrVariant, using the specified culture-specific formatting information.

IFormatProvider)

TClrConvert.ToInt32 Converts the string representation of a number in a specified base to


(ClrWString, ClrInt32) an equivalent 32-bit signed integer.

TClrConvert.ToInt32 Converts the specified string representation of a number to an


(ClrWString, equivalent 32-bit signed integer, using the specified culture-specific
formatting information.
IFormatProvider)

7.1.1.8.1.1.7.1.27 TClrConvert.ToInt32 Method (ClrChar)


Converts the value of the specified clr Unicode character to the equivalent 32-bit signed integer.

Syntax
Delphi

class function ToInt32(const AValue: ClrChar): ClrInt32; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.27 TClrConvert.ToInt32 Method (ClrVariant)


Converts the value of the specified variant to a 32-bit signed integer.

Syntax
Delphi

class function ToInt32(const AValue: ClrVariant): ClrInt32; overload;

See Also

737
.Net Runtime Library for Delphi

TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.27 TClrConvert.ToInt32 Method (ClrVariant, IFormatProvider)


Converts the value of the specified variant to a 32-bit signed integer, using the specified culture-specific formatting
information.

Syntax
Delphi

class function ToInt32(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrInt32; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.27 TClrConvert.ToInt32 Method (ClrWString, ClrInt32)


Converts the string representation of a number in a specified base to an equivalent 32-bit signed integer.

Syntax
Delphi

class function ToInt32(const AValue: ClrWString; AFromBase: ClrInt32):


ClrInt32; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.27 TClrConvert.ToInt32 Method (ClrWString, IFormatProvider)


Converts the specified string representation of a number to an equivalent 32-bit signed integer, using the specified
culture-specific formatting information.

Syntax
Delphi

class function ToInt32(const AValue: ClrWString; AProvider:


IFormatProvider): ClrInt32; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

738
.Net Runtime Library for Delphi

7.1.1.8.1.1.7.1.28 ToInt64 Method

This is the overview for the ToInt64 method overload.

Overload List

Name Description

TClrConvert.ToInt64 Converts the value of the specified clr Unicode character to the
(ClrChar) equivalent 64-bit signed integer.

TClrConvert.ToInt64 Converts the value of the specified variant to a 64-bit signed integer.
(ClrVariant)

TClrConvert.ToInt64 Converts the value of the specified variant to a 64-bit signed integer,
(ClrVariant, using the specified culture-specific formatting information.

IFormatProvider)

TClrConvert.ToInt64 Converts the string representation of a number in a specified base to


(ClrWString, ClrInt32) an equivalent 64-bit signed integer.

TClrConvert.ToInt64 Converts the specified string representation of a number to an


(ClrWString, equivalent 64-bit signed integer, using the specified culture-specific
formatting information.
IFormatProvider)

7.1.1.8.1.1.7.1.28 TClrConvert.ToInt64 Method (ClrChar)


Converts the value of the specified clr Unicode character to the equivalent 64-bit signed integer.

Syntax
Delphi

class function ToInt64(const AValue: ClrChar): ClrInt64; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.28 TClrConvert.ToInt64 Method (ClrVariant)


Converts the value of the specified variant to a 64-bit signed integer.

Syntax
Delphi

class function ToInt64(const AValue: ClrVariant): ClrInt64; overload;

739
.Net Runtime Library for Delphi

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.28 TClrConvert.ToInt64 Method (ClrVariant, IFormatProvider)


Converts the value of the specified variant to a 64-bit signed integer, using the specified culture-specific formatting
information.

Syntax
Delphi

class function ToInt64(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrInt64; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.28 TClrConvert.ToInt64 Method (ClrWString, ClrInt32)


Converts the string representation of a number in a specified base to an equivalent 64-bit signed integer.

Syntax
Delphi

class function ToInt64(const AValue: ClrWString; AFromBase: ClrInt32):


ClrInt64; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.28 TClrConvert.ToInt64 Method (ClrWString, IFormatProvider)


Converts the specified string representation of a number to an equivalent 64-bit signed integer, using the specified
culture-specific formatting information.

Syntax
Delphi

class function ToInt64(const AValue: ClrWString; AProvider:


IFormatProvider): ClrInt64; overload;

See Also

740
.Net Runtime Library for Delphi

TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.29 TClrConvert.ToInterface Method

Converts the value of the specified variant to IInterface.

Syntax
Delphi

class function ToInterface(AValue: ClrVariant): IInterface;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.30 ToManagedPointer Method

This is the overview for the ToManagedPointer method overload.

Overload List

Name Description

TClrConvert.ToManagedPointer Converts the value of the specified variant to clr managed pointer.
(ClrVariant)

TClrConvert.ToManagedPointer Converts the value of the specified unmanaged pointer to clr


(Pointer) managed pointer.

TClrConvert.ToManagedPointer Converts the value of the specified Object to clr managed pointer.
(TObject)

7.1.1.8.1.1.7.1.30 TClrConvert.ToManagedPointer Method (ClrVariant)


Converts the value of the specified variant to clr managed pointer.

Syntax
Delphi

class function ToManagedPointer(AValue: ClrVariant): _IntPtr;


overload;

See Also

741
.Net Runtime Library for Delphi

TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.30 TClrConvert.ToManagedPointer Method (Pointer)


Converts the value of the specified unmanaged pointer to clr managed pointer.

Syntax
Delphi

class function ToManagedPointer(APtr: Pointer): _IntPtr; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.30 TClrConvert.ToManagedPointer Method (TObject)


Converts the value of the specified Object to clr managed pointer.

Syntax
Delphi

class function ToManagedPointer(AObject: TObject): _IntPtr; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.31 TClrConvert.ToObject Method

Converts the value of the specified managed pointer to object.

Syntax
Delphi

class function ToObject(AManagedPtr: _IntPtr): TObject; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.32 TClrConvert.ToPointer Method

Converts the value of the specified managed pointer to unmanaged Pointer.

Syntax

742
.Net Runtime Library for Delphi

Delphi

class function ToPointer(AManagedPtr: _IntPtr): Pointer; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.33 ToSByte Method

This is the overview for the ToSByte method overload.

Overload List

Name Description

TClrConvert.ToSByte Converts the value of the specified clr Unicode character to the
(ClrChar) equivalent 8-bit signed integer.

TClrConvert.ToSByte Converts the value of the specified variant to an 8-bit signed integer.
(ClrVariant)

TClrConvert.ToSByte Converts the value of the specified variant to an 8-bit signed integer,
(ClrVariant, using the specified culture-specific formatting information.

IFormatProvider)

TClrConvert.ToSByte Converts the string representation of a number in a specified base to


(ClrWString, ClrInt32) an equivalent 8-bit signed integer.

TClrConvert.ToSByte Converts the specified string representation of a number to an


(ClrWString, equivalent 8-bit signed integer, using the specified culture-specific
formatting information.
IFormatProvider)

7.1.1.8.1.1.7.1.33 TClrConvert.ToSByte Method (ClrChar)


Converts the value of the specified clr Unicode character to the equivalent 8-bit signed integer.

Syntax
Delphi

class function ToSByte(const AValue: ClrChar): ClrSByte; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

743
.Net Runtime Library for Delphi

7.1.1.8.1.1.7.1.33 TClrConvert.ToSByte Method (ClrVariant)


Converts the value of the specified variant to an 8-bit signed integer.

Syntax
Delphi

class function ToSByte(const AValue: ClrVariant): ClrSByte; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.33 TClrConvert.ToSByte Method (ClrVariant, IFormatProvider)


Converts the value of the specified variant to an 8-bit signed integer, using the specified culture-specific formatting
information.

Syntax
Delphi

class function ToSByte(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrSByte; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.33 TClrConvert.ToSByte Method (ClrWString, ClrInt32)


Converts the string representation of a number in a specified base to an equivalent 8-bit signed integer.

Syntax
Delphi

class function ToSByte(const AValue: ClrWString; AFromBase: ClrInt32):


ClrSByte; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.33 TClrConvert.ToSByte Method (ClrWString, IFormatProvider)


Converts the specified string representation of a number to an equivalent 8-bit signed integer, using the specified
culture-specific formatting information.

Syntax

744
.Net Runtime Library for Delphi

Delphi

class function ToSByte(const AValue: ClrWString; AProvider:


IFormatProvider): ClrSByte; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.34 ToSingle Method

This is the overview for the ToSingle method overload.

Overload List

Name Description

TClrConvert.ToSingle Calling this method always throws InvalidCastException.


(ClrChar)

TClrConvert.ToSingle Converts the value of the specified variant to a single-precision


(ClrVariant) floating-point number.

TClrConvert.ToSingle Converts the value of the specified variant to an single-precision


(ClrVariant, floating-point number, using the specified culture-specific formatting
information.
IFormatProvider)

TClrConvert.ToSingle Converts the specified string representation of a number to an


(ClrWString, equivalent single-precision floating-point number, using the specified
culture-specific formatting information.
IFormatProvider)

7.1.1.8.1.1.7.1.34 TClrConvert.ToSingle Method (ClrChar)


Calling this method always throws InvalidCastException.

Syntax
Delphi

class function ToSingle(const AValue: ClrChar): ClrSingle; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.34 TClrConvert.ToSingle Method (ClrVariant)

745
.Net Runtime Library for Delphi

Converts the value of the specified variant to a single-precision floating-point number.

Syntax
Delphi

class function ToSingle(const AValue: ClrVariant): ClrSingle;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.34 TClrConvert.ToSingle Method (ClrVariant, IFormatProvider)


Converts the value of the specified variant to an single-precision floating-point number, using the specified culture-
specific formatting information.

Syntax
Delphi

class function ToSingle(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrSingle; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.34 TClrConvert.ToSingle Method (ClrWString, IFormatProvider)


Converts the specified string representation of a number to an equivalent single-precision floating-point number, using
the specified culture-specific formatting information.

Syntax
Delphi

class function ToSingle(const AValue: ClrWString; AProvider:


IFormatProvider): ClrSingle; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 ToString Method

This is the overview for the ToString method overload.

Overload List

746
.Net Runtime Library for Delphi

Name Description

TClrConvert.ToString (Byte, Converts the value of an 8-bit unsigned integer to its equivalent string
ClrInt32) representation in a specified base.

TClrConvert.ToString (Byte, Converts the value of the specified 8-bit unsigned integer to its
IFormatProvider) equivalent string representation, using the specified culture-specific
formatting information.

TClrConvert.ToString Converts the specified Boolean value to its equivalent string


(ClrBoolean, representation.

IFormatProvider)

TClrConvert.ToString Converts the value of the specified Unicode character to its equivalent
(ClrChar) string representation.

TClrConvert.ToString Converts the value of the specified clr Unicode character to its
(ClrChar, IFormatProvider) equivalent string representation, using the specified culture-specific
formatting information.

TClrConvert.ToString Converts the value of the specified DateTime to its equivalent string
(ClrDateTime, representation, using the specified culture-specific formatting

IFormatProvider) information.

TClrConvert.ToString Converts the value of the specified decimal number to its equivalent
(ClrDecimal) string representation.

TClrConvert.ToString Converts the value of the specified decimal number to its equivalent
(ClrDecimal, string representation, using the specified culture-specific formatting
information.
IFormatProvider)

TClrConvert.ToString Converts the value of the specified double-precision floating-point


(ClrDouble, IFormatProvider) number to its equivalent string representation.

TClrConvert.ToString Converts the value of a 16-bit signed integer to its equivalent string
(ClrInt16, ClrInt32) representation in a specified base.

TClrConvert.ToString Converts the value of the specified 16-bit signed integer to its
(ClrInt16, IFormatProvider) equivalent string representation, using the specified culture-specific
formatting information.

TClrConvert.ToString Converts the value of a 32-bit signed integer to its equivalent string
(ClrInt32, ClrInt32) representation in a specified base.

TClrConvert.ToString Converts the value of the specified 32-bit signed integer to its
(ClrInt32, IFormatProvider) equivalent string representation, using the specified culture-specific
formatting information.

747
.Net Runtime Library for Delphi

Name Description

TClrConvert.ToString Converts the value of a 64-bit signed integer to its equivalent string
(ClrInt64, ClrInt32) representation in a specified base.

TClrConvert.ToString Converts the value of the specified 8-bit signed integer to its
(ClrSByte, IFormatProvider) equivalent string representation, using the specified culture-specific
formatting information.

TClrConvert.ToString Converts the value of the specified single-precision floating-point


(ClrSingle, IFormatProvider) number to its equivalent string representation, using the specified
culture-specific formatting information.

TClrConvert.ToString Converts the value of the specified 16-bit unsigned integer to its
(ClrUInt16, IFormatProvider) equivalent string representation, using the specified culture-specific
formatting information.

TClrConvert.ToString Converts the value of the specified 32-bit unsigned integer to its
(ClrUInt32, IFormatProvider) equivalent string representation, using the specified culture-specific
formatting information.

TClrConvert.ToString Converts the value of the specified 64-bit unsigned integer to its
(ClrUInt64, IFormatProvider) equivalent string representation, using the specified culture-specific
formatting information.

TClrConvert.ToString Converts the value of the specified variant to its equivalent string
(ClrVariant) representation.

TClrConvert.ToString Converts the value of the specified variant to its equivalent string
(ClrVariant, representation using the specified culture-specific formatting
information.
IFormatProvider)

TClrConvert.ToString Converts the value of the specified Unicode character to its equivalent
(ClrWChar, IFormatProvider) string representation, using the specified culture-specific formatting
information.

TClrConvert.ToString Returns the specified string instance; no actual conversion is


(ClrWString, performed.

IFormatProvider)

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (Byte, ClrInt32)


Converts the value of an 8-bit unsigned integer to its equivalent string representation in a specified base.

Syntax
Delphi

748
.Net Runtime Library for Delphi

class function ToString(const AValue: Byte; AToBase: ClrInt32):


ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (Byte, IFormatProvider)


Converts the value of the specified 8-bit unsigned integer to its equivalent string representation, using the specified
culture-specific formatting information.

Syntax
Delphi

class function ToString(const AValue: Byte; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrBoolean, IFormatProvider)


Converts the specified Boolean value to its equivalent string representation.

Syntax
Delphi

class function ToString(const AValue: ClrBoolean; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrChar)


Converts the value of the specified Unicode character to its equivalent string representation.

Syntax
Delphi

class function ToString(const AValue: ClrChar): ClrWString; overload;


reintroduce;

See Also

749
.Net Runtime Library for Delphi

TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrChar, IFormatProvider)


Converts the value of the specified clr Unicode character to its equivalent string representation, using the specified
culture-specific formatting information.

Syntax
Delphi

class function ToString(const AValue: ClrChar; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrDateTime, IFormatProvider)

Converts the value of the specified DateTime to its equivalent string representation, using the specified culture-specific
formatting information.

Syntax
Delphi

class function ToString(const AValue: ClrDateTime; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrDecimal)


Converts the value of the specified decimal number to its equivalent string representation.

Syntax
Delphi

class function ToString(const AValue: ClrDecimal): ClrWString;


overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrDecimal, IFormatProvider)

750
.Net Runtime Library for Delphi

Converts the value of the specified decimal number to its equivalent string representation, using the specified culture-
specific formatting information.

Syntax
Delphi

class function ToString(const AValue: ClrDecimal; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrDouble, IFormatProvider)


Converts the value of the specified double-precision floating-point number to its equivalent string representation.

Syntax
Delphi

class function ToString(const AValue: ClrDouble; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrInt16, ClrInt32)


Converts the value of a 16-bit signed integer to its equivalent string representation in a specified base.

Syntax
Delphi

class function ToString(const AValue: ClrInt16; AToBase: ClrInt32):


ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrInt16, IFormatProvider)


Converts the value of the specified 16-bit signed integer to its equivalent string representation, using the specified
culture-specific formatting information.

Syntax

751
.Net Runtime Library for Delphi

Delphi

class function ToString(const AValue: ClrInt16; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrInt32, ClrInt32)


Converts the value of a 32-bit signed integer to its equivalent string representation in a specified base.

Syntax
Delphi

class function ToString(const AValue: ClrInt32; AToBase: ClrInt32):


ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrInt32, IFormatProvider)


Converts the value of the specified 32-bit signed integer to its equivalent string representation, using the specified
culture-specific formatting information.

Syntax
Delphi

class function ToString(const AValue: ClrInt32; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrInt64, ClrInt32)


Converts the value of a 64-bit signed integer to its equivalent string representation in a specified base.

Syntax
Delphi

class function ToString(const AValue: ClrInt64; AToBase: ClrInt32):


ClrWString; overload; reintroduce;

752
.Net Runtime Library for Delphi

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrSByte, IFormatProvider)


Converts the value of the specified 8-bit signed integer to its equivalent string representation, using the specified
culture-specific formatting information.

Syntax
Delphi

class function ToString(const AValue: ClrSByte; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrSingle, IFormatProvider)


Converts the value of the specified single-precision floating-point number to its equivalent string representation, using
the specified culture-specific formatting information.

Syntax
Delphi

class function ToString(const AValue: ClrSingle; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrUInt16, IFormatProvider)


Converts the value of the specified 16-bit unsigned integer to its equivalent string representation, using the specified
culture-specific formatting information.

Syntax
Delphi

class function ToString(const AValue: ClrUInt16; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also

753
.Net Runtime Library for Delphi

TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrUInt32, IFormatProvider)


Converts the value of the specified 32-bit unsigned integer to its equivalent string representation, using the specified
culture-specific formatting information.

Syntax
Delphi

class function ToString(const AValue: ClrUInt32; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrUInt64, IFormatProvider)


Converts the value of the specified 64-bit unsigned integer to its equivalent string representation, using the specified
culture-specific formatting information.

Syntax
Delphi

class function ToString(const AValue: ClrUInt64; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrVariant)


Converts the value of the specified variant to its equivalent string representation.

Syntax
Delphi

class function ToString(const AValue: ClrVariant): ClrWString;


overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrVariant, IFormatProvider)

754
.Net Runtime Library for Delphi

Converts the value of the specified variant to its equivalent string representation using the specified culture-specific
formatting information.

Syntax
Delphi

class function ToString(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrWChar, IFormatProvider)


Converts the value of the specified Unicode character to its equivalent string representation, using the specified culture-
specific formatting information.

Syntax
Delphi

class function ToString(const AValue: ClrWChar; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.35 TClrConvert.ToString Method (ClrWString, IFormatProvider)


Returns the specified string instance; no actual conversion is performed.

Syntax
Delphi

class function ToString(const AValue: ClrWString; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.36 ToUInt16 Method

This is the overview for the ToUInt16 method overload.

Overload List

755
.Net Runtime Library for Delphi

Name Description

TClrConvert.ToUInt16 Converts the value of the specified clr Unicode character to the
(ClrChar) equivalent 16-bit unsigned integer.

TClrConvert.ToUInt16 Converts the value of the specified variant to a 16-bit unsigned


(ClrVariant) integer.

TClrConvert.ToUInt16 Converts the value of the specified variant to a 16-bit unsigned


(ClrVariant, integer, using the specified culture-specific formatting information.

IFormatProvider)

TClrConvert.ToUInt16 Converts the string representation of a number in a specified base to


(ClrWString, ClrInt32) an equivalent 16-bit unsigned integer.

TClrConvert.ToUInt16 Converts the specified string representation of a number to an


(ClrWString, equivalent 16-bit unsigned integer, using the specified culture-specific
formatting information.
IFormatProvider)

7.1.1.8.1.1.7.1.36 TClrConvert.ToUInt16 Method (ClrChar)


Converts the value of the specified clr Unicode character to the equivalent 16-bit unsigned integer.

Syntax
Delphi

class function ToUInt16(const AValue: ClrChar): ClrUInt16; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.36 TClrConvert.ToUInt16 Method (ClrVariant)


Converts the value of the specified variant to a 16-bit unsigned integer.

Syntax
Delphi

class function ToUInt16(const AValue: ClrVariant): ClrUInt16;


overload;

See Also

756
.Net Runtime Library for Delphi

TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.36 TClrConvert.ToUInt16 Method (ClrVariant, IFormatProvider)


Converts the value of the specified variant to a 16-bit unsigned integer, using the specified culture-specific formatting
information.

Syntax
Delphi

class function ToUInt16(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrUInt16; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.36 TClrConvert.ToUInt16 Method (ClrWString, ClrInt32)


Converts the string representation of a number in a specified base to an equivalent 16-bit unsigned integer.

Syntax
Delphi

class function ToUInt16(const AValue: ClrWString; AFromBase:


ClrInt32): ClrUInt16; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.36 TClrConvert.ToUInt16 Method (ClrWString, IFormatProvider)


Converts the specified string representation of a number to an equivalent 16-bit unsigned integer, using the specified
culture-specific formatting information.

Syntax
Delphi

class function ToUInt16(const AValue: ClrWString; AProvider:


IFormatProvider): ClrUInt16; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

757
.Net Runtime Library for Delphi

7.1.1.8.1.1.7.1.37 ToUInt32 Method

This is the overview for the ToUInt32 method overload.

Overload List

Name Description

TClrConvert.ToUInt32 Converts the value of the specified clr Unicode character to the
(ClrChar) equivalent 32-bit unsigned integer.

TClrConvert.ToUInt32 Converts the value of the specified variant to a 32-bit unsigned


(ClrVariant) integer.

TClrConvert.ToUInt32 Converts the value of the specified variant to a 32-bit unsigned


(ClrVariant, integer, using the specified culture-specific formatting information.

IFormatProvider)

TClrConvert.ToUInt32 Converts the string representation of a number in a specified base to


(ClrWString, ClrInt32) an equivalent 32-bit unsigned integer.

TClrConvert.ToUInt32 Converts the specified string representation of a number to an


(ClrWString, equivalent 32-bit unsigned integer, using the specified culture-specific
formatting information.
IFormatProvider)

7.1.1.8.1.1.7.1.37 TClrConvert.ToUInt32 Method (ClrChar)


Converts the value of the specified clr Unicode character to the equivalent 32-bit unsigned integer.

Syntax
Delphi

class function ToUInt32(const AValue: ClrChar): ClrUInt32; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.37 TClrConvert.ToUInt32 Method (ClrVariant)


Converts the value of the specified variant to a 32-bit unsigned integer.

Syntax
Delphi

758
.Net Runtime Library for Delphi

class function ToUInt32(const AValue: ClrVariant): ClrUInt32;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.37 TClrConvert.ToUInt32 Method (ClrVariant, IFormatProvider)


Converts the value of the specified variant to a 32-bit unsigned integer, using the specified culture-specific formatting
information.

Syntax
Delphi

class function ToUInt32(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrUInt32; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.37 TClrConvert.ToUInt32 Method (ClrWString, ClrInt32)


Converts the string representation of a number in a specified base to an equivalent 32-bit unsigned integer.

Syntax
Delphi

class function ToUInt32(const AValue: ClrWString; AFromBase:


ClrInt32): ClrUInt32; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.37 TClrConvert.ToUInt32 Method (ClrWString, IFormatProvider)


Converts the specified string representation of a number to an equivalent 32-bit unsigned integer, using the specified
culture-specific formatting information.

Syntax
Delphi

class function ToUInt32(const AValue: ClrWString; AProvider:


IFormatProvider): ClrUInt32; overload;

See Also

759
.Net Runtime Library for Delphi

TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.38 ToUInt64 Method

This is the overview for the ToUInt64 method overload.

Overload List

Name Description

TClrConvert.ToUInt64 Converts the value of the specified clr Unicode character to the
(ClrChar) equivalent 64-bit unsigned integer.

TClrConvert.ToUInt64 Converts the value of the specified variant to a 64-bit unsigned


(ClrVariant) integer.

TClrConvert.ToUInt64 Converts the value of the specified variant to a 64-bit unsigned


(ClrVariant, integer, using the specified culture-specific formatting information.

IFormatProvider)

TClrConvert.ToUInt64 Converts the string representation of a number in a specified base to


(ClrWString, ClrInt32) an equivalent 64-bit unsigned integer.

TClrConvert.ToUInt64 Converts the specified string representation of a number to an


(ClrWString, equivalent 64-bit unsigned integer, using the specified culture-specific
formatting information.
IFormatProvider)

7.1.1.8.1.1.7.1.38 TClrConvert.ToUInt64 Method (ClrChar)


Converts the value of the specified clr Unicode character to the equivalent 64-bit unsigned integer.

Syntax
Delphi

class function ToUInt64(const AValue: ClrChar): ClrUInt64; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.38 TClrConvert.ToUInt64 Method (ClrVariant)


Converts the value of the specified variant to a 64-bit unsigned integer.

Syntax

760
.Net Runtime Library for Delphi

Delphi

class function ToUInt64(const AValue: ClrVariant): ClrUInt64;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.38 TClrConvert.ToUInt64 Method (ClrVariant, IFormatProvider)


Converts the value of the specified variant to a 64-bit unsigned integer, using the specified culture-specific formatting
information.

Syntax
Delphi

class function ToUInt64(const AValue: ClrVariant; AProvider:


IFormatProvider): ClrUInt64; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.38 TClrConvert.ToUInt64 Method (ClrWString, ClrInt32)


Converts the string representation of a number in a specified base to an equivalent 64-bit unsigned integer.

Syntax
Delphi

class function ToUInt64(const AValue: ClrWString; AFromBase:


ClrInt32): ClrUInt64; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.38 TClrConvert.ToUInt64 Method (ClrWString, IFormatProvider)


Converts the specified string representation of a number to an equivalent 64-bit unsigned integer, using the specified
culture-specific formatting information.

Syntax
Delphi

class function ToUInt64(const AValue: ClrWString; AProvider:


IFormatProvider): ClrUInt64; overload;

761
.Net Runtime Library for Delphi

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.39 ToVariant Method

This is the overview for the ToVariant method overload.

Overload List

Name Description

TClrConvert.ToVariant Convert the value of the specified dispatch interface to variant.


(IDispatch)

TClrConvert.ToVariant Convert the value of the specified clr base object to variant.
(TClrBaseObject)

7.1.1.8.1.1.7.1.39 TClrConvert.ToVariant Method (IDispatch)


Convert the value of the specified dispatch interface to variant.

Syntax
Delphi

class function ToVariant(AObject: IDispatch): ClrVariant; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.39 TClrConvert.ToVariant Method (TClrBaseObject)

Convert the value of the specified clr base object to variant.

Syntax
Delphi

class function ToVariant(AObject: TClrBaseObject): ClrVariant;


overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

762
.Net Runtime Library for Delphi

7.1.1.8.1.1.7.1.40 TryChangeObjectType Method

This is the overview for the TryChangeObjectType method overload.

Overload List

Name Description

TClrConvert.TryChangeObjectType Convert the value of specified variant to the dispatch interface


(ClrVariant, _Type, IDispatch) of the specified type.

TClrConvert.TryChangeObjectType Convert the value of specified variant to the dispatch interface


(ClrVariant, string, IDispatch) of the specified type using the type name.

7.1.1.8.1.1.7.1.40 TClrConvert.TryChangeObjectType Method (ClrVariant, _Type, IDispatch)

Convert the value of specified variant to the dispatch interface of the specified type.

Syntax
Delphi

class function TryChangeObjectType(AValue: ClrVariant;


AConversionType: _Type; var AResult: IDispatch): ClrBoolean; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.40 TClrConvert.TryChangeObjectType Method (ClrVariant, string, IDispatch)

Convert the value of specified variant to the dispatch interface of the specified type using the type name.

Syntax
Delphi

class function TryChangeObjectType(AValue: ClrVariant;


AConversionTypeName: string; var AResult: IDispatch): ClrBoolean;
overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.41 TryCreateClrWrapper Method

This is the overview for the TryCreateClrWrapper method overload.

763
.Net Runtime Library for Delphi

Overload List

Name Description

TClrConvert.TryCreateClrWrapper Wrap the value of the specified dispatch interface to the


(IDispatch, _Type, IDispatch) dispatch of the specified type.

TClrConvert.TryCreateClrWrapper Wrap the value of the specified dispatch interface to the


(IDispatch, string, IDispatch) dispatch of the specified type using the type name.

7.1.1.8.1.1.7.1.41 TClrConvert.TryCreateClrWrapper Method (IDispatch, _Type, IDispatch)

Wrap the value of the specified dispatch interface to the dispatch of the specified type.

Syntax
Delphi

class function TryCreateClrWrapper(AValue: IDispatch; AWrapType:


_Type; var AResult: IDispatch): ClrBoolean; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.41 TClrConvert.TryCreateClrWrapper Method (IDispatch, string, IDispatch)

Wrap the value of the specified dispatch interface to the dispatch of the specified type using the type name.

Syntax
Delphi

class function TryCreateClrWrapper(AValue: IDispatch; AWrapTypeName:


string; var AResult: IDispatch): ClrBoolean; overload;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.42 TClrConvert.Unwrap Method

Unwrap the value of the specified variant to the original .net object as variant.

Syntax
Delphi

764
.Net Runtime Library for Delphi

class function Unwrap(AValue: ClrVariant): ClrVariant;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.7.1.43 TClrConvert.UnwrapToInterface Method

Unwrap the value of the specified variant to the original .net object as interface.

Syntax
Delphi

class function UnwrapToInterface(AValue: ClrVariant): IInterface;

See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8 TClrDateTimeHelper Class


Collapse All Expand All

Helper class for TDateTime Data Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrDateTimeHelper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrDateTimeHelper = class;

Methods

Name Description

Add Returns a new DateTime that adds the value of the specified
_TimeSpan to the value of this instance.

AddDays Returns a new DateTime that adds the specified number of days to
the value of this instance.

765
.Net Runtime Library for Delphi

Name Description

AddHours Returns a new DateTime that adds the specified number of hours
to the value of this instance.

AddMilliseconds Returns a new DateTime that adds the specified number of


milliseconds to the value of this instance.

AddMinutes Returns a new DateTime that adds the specified number of


minutes to the value of this instance.

AddMonths Returns a new DateTime that adds the specified number of


months to the value of this instance.

AddSeconds Returns a new DateTime that adds the specified number of


seconds to the value of this instance.

AddTicks Returns a new DateTime that adds the specified number of ticks to
the value of this instance.

AddYears Returns a new DateTime that adds the specified number of years
to the value of this instance.

CompareTo(ClrDateTime, Compares two instances of TDateTime and returns an integer that


ClrDateTime) indicates whether the first instance is earlier than, the same as, or
later than the second instance.

CompareTo(ClrDateTime, Compares the value of this instance to a specified variant that


ClrVariant) contains a specified TDateTime value, and returns an integer that
indicates whether this instance is earlier than, the same as, or later
than the specified DateTime value.

Equals(ClrDateTime, ClrDateTime) Returns a value indicating whether two DateTime instances have
the same date and time value.

Equals(ClrDateTime, ClrVariant) Returns a value indicating whether this instance is equal to a


specified variant.

FromBinary Deserializes a 64-bit binary value and recreates an original


serialized DateTime object.

FromFileTime Converts the specified Windows file time to an equivalent local


time.

FromFileTimeUtc Converts the specified Windows file time to an equivalent UTC


time.

FromOADate Returns a DateTime equivalent to the specified OLE Automation


Date.

766
.Net Runtime Library for Delphi

Name Description

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, and day.
ClrInt32)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, day, hour,
ClrInt32, ClrInt32, ClrInt32, minute, and second.

ClrInt32)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, day, hour,
ClrInt32, ClrInt32, ClrInt32, minute, second, and millisecond.

ClrInt32, ClrInt32)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, day, hour,
ClrInt32, ClrInt32, ClrInt32, minute, second, millisecond, and Coordinated Universal Time
(UTC) or local time.
ClrInt32, ClrInt32, TDateTimeKind)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, day, hour,
ClrInt32, ClrInt32, ClrInt32, minute, second, and millisecond for the specified calendar.

ClrInt32, ClrInt32, _Calendar)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, day, hour,
ClrInt32, ClrInt32, ClrInt32, minute, second, millisecond, and Coordinated Universal Time
(UTC) or local time for the specified calendar.
ClrInt32, ClrInt32, _Calendar,
TDateTimeKind)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, day, hour,
ClrInt32, ClrInt32, ClrInt32, minute, second, and Coordinated Universal Time (UTC) or local
time.
ClrInt32, TDateTimeKind)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, day, hour,
ClrInt32, ClrInt32, ClrInt32, minute, and second for the specified calendar.

ClrInt32, _Calendar)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, and day for
ClrInt32, _Calendar) the specified calendar.

GetDateTime(ClrInt64) Returns a DateTime using a specified number of ticks.

GetDateTime(ClrInt64, Returns a DateTime using a specified number of ticks and to


TDateTimeKind) Coordinated Universal Time (UTC) or local time.

GetDateTime(ClrVariant) Returns a DateTime equivalent of the specified variant.

GetDateTimeFormats(ClrDateTime) Converts the value of this instance to all the string representations
supported by the standard date and time format specifiers.

767
.Net Runtime Library for Delphi

Name Description

GetDateTimeFormats(ClrDateTime, Converts the value of this instance to all the string representations
ClrChar) supported by the specified standard date and time format
specifier.

GetDateTimeFormats(ClrDateTime, Converts the value of this instance to all the string representations
ClrChar, IFormatProvider) supported by the specified standard date and time format
specifier and culture-specific formatting information.

GetDateTimeFormats(ClrDateTime, Converts the value of this instance to all the string representations
ClrWChar) supported by the specified standard date and time format
specifier.

GetDateTimeFormats(ClrDateTime, Converts the value of this instance to all the string representations
ClrWChar, IFormatProvider) supported by the specified standard date and time format
specifier and culture-specific formatting information.

GetDateTimeFormats(ClrDateTime, Converts the value of this instance to all the string representations
IFormatProvider) supported by the standard date and time format specifiers and the
specified culture-specific formatting information.

GetDay Gets the day of the month represented by this instance.

GetDayOfWeek Gets the day of the week represented by this instance.

GetDayOfYear Gets the day of the year represented by this instance.

GetHashCode Returns the hash code for this instance.

GetHour Gets the hour component of the date represented by this instance.

GetKind Gets a value that indicates whether the time represented by this
instance is based on local time, Coordinated Universal Time (UTC),
or neither.

GetMillisecond Gets the milliseconds component of the date represented by this


instance.

GetMinute Gets the minute component of the date represented by this


instance.

GetMonth Gets the month component of the date represented by this


instance.

GetSecond Gets the seconds component of the date represented by this


instance.

768
.Net Runtime Library for Delphi

Name Description

GetTicks Gets the number of ticks that represent the date and time of this
instance.

GetTimeOfDay Gets the time of day for this instance.

GetYear Gets the year component of the date represented by this instance.

IsDaylightSavingTime Indicates whether this instance of DateTime is within the daylight


saving time range for the current time zone.

IsLeapYear Returns an indication whether the specified year is a leap year.

MaxValue Represents the largest possible value of DateTime.

MinValue Represents the smallest possible value of DateTime.

Parse(ClrWString) Converts the string representation of a date and time to its


DateTime equivalent.

Parse(ClrWString, IFormatProvider) Converts the string representation of a date and time to its
DateTime equivalent by using culture-specific format information.

Parse(ClrWString, IFormatProvider, Converts the string representation of a date and time to its
TDateTimeStyles) DateTime equivalent by using culture-specific format information
and formatting style.

ParseExact(ClrWString, ClrWString, Converts the specified string representation of a date and time to
IFormatProvider) its DateTime equivalent using the specified format and culture-
specific format information. The format of the string
representation must match the specified format exactly.

ParseExact(ClrWString, ClrWString, Converts the specified string representation of a date and time to
IFormatProvider, TDateTimeStyles) its DateTime equivalent using the specified format, culture-specific
format information, and style. The format of the string
representation must match the specified format exactly or an
exception is thrown.

ParseExact(ClrWString, Converts the specified string representation of a date and time to


TClrWStringDynArray, its DateTime equivalent using the specified array of formats,
culture-specific format information, and style. The format of the
IFormatProvider, TDateTimeStyles)
string representation must match at least one of the specified
formats exactly or an exception is thrown.

ParseExact(ClrWString, Converts the specified string representation of a date and time to


_StringArray, IFormatProvider, its DateTime equivalent using the specified array of formats,
culture-specific format information, and style. The format of the
TDateTimeStyles)
string representation must match at least one of the specified

769
.Net Runtime Library for Delphi

Name Description

formats exactly or an exception is thrown.

SpecifyKind Creates a new DateTime object that has the same number of ticks
as the specified DateTime, but is designated as either local time,
Coordinated Universal Time (UTC), or neither, as indicated by the
specified DateTimeKind value.

Subtract(ClrDateTime, Subtracts the specified date and time from this instance.
ClrDateTime)

Subtract(ClrDateTime, _TimeSpan) Subtracts the specified duration from this instance.

ToBinary Serializes the current DateTime object to a 64-bit binary value that
subsequently can be used to recreate the DateTime object.

Today Gets the current date.

ToFileTime Converts the value of the current DateTime object to a Windows


file time.

ToFileTimeUtc Converts the value of the current DateTime object to a Windows


file time.

ToLocalTime Converts the value of the current DateTime object to local time.

ToLongDateString Converts the value of the current DateTime object to its equivalent
long date string representation.

ToLongTimeString Converts the value of the current DateTime object to its equivalent
long time string representation.

ToOADate Converts the value of this instance to the equivalent OLE


Automation date.

ToShortDateString Converts the value of the current DateTime object to its equivalent
short date string representation.

ToShortTimeString Converts the value of the current DateTime object to its equivalent
short time string representation.

ToString(ClrDateTime) Converts the value of the current DateTime object to its equivalent
string representation using the formatting conventions of the
current culture.

ToString(ClrDateTime, ClrWString) Converts the value of the current DateTime object to its equivalent
string representation using the specified format and the

770
.Net Runtime Library for Delphi

Name Description

formatting conventions of the current culture.

ToString(ClrDateTime, ClrWString, Converts the value of the current DateTime object to its equivalent
IFormatProvider) string representation using the specified format and culture-
specific format information.

ToString(ClrDateTime, Converts the value of the current DateTime object to its equivalent
IFormatProvider) string representation using the specified culture-specific format
information.

ToUniversalTime Converts the value of the current DateTime object to Coordinated


Universal Time (UTC).

TryParse(ClrWString, ClrDateTime) Converts the specified string representation of a date and time to
its DateTime equivalent and returns a value that indicates whether
the conversion succeeded.

TryParse(ClrWString, Converts the specified string representation of a date and time to


IFormatProvider, TDateTimeStyles, its DateTime equivalent using the specified culture-specific format
information and formatting style, and returns a value that indicates
ClrDateTime)
whether the conversion succeeded.

TryParseExact(ClrWString, Converts the specified string representation of a date and time to


ClrWString, IFormatProvider, its DateTime equivalent using the specified format, culture-specific
format information, and style. The format of the string
TDateTimeStyles, ClrDateTime)
representation must match the specified format exactly. The
method returns a value that indicates whether the conversion
succeeded.

TryParseExact(ClrWString, Converts the specified string representation of a date and time to


TClrWStringDynArray, its DateTime equivalent using the specified array of formats,
culture-specific format information, and style. The format of the
IFormatProvider, TDateTimeStyles,
string representation must match at least one of the specified
ClrDateTime)
formats exactly. The method returns a value that indicates whether
the conversion succeeded.

TryParseExact(ClrWString, Converts the specified string representation of a date and time to


_StringArray, IFormatProvider, its DateTime equivalent using the specified array of formats,
culture-specific format information, and style. The format of the
TDateTimeStyles, ClrDateTime)
string representation must match at least one of the specified
formats exactly. The method returns a value that indicates whether
the conversion succeeded.

UtcNow Gets a DateTime object that is set to the current date and time on
this computer, expressed as the Coordinated Universal Time (UTC).

See Also
TClrDateTimeHelper Methods

771
.Net Runtime Library for Delphi

7.1.1.8.1.1.8.1 TClrDateTimeHelper Methods

The methods of the TClrDateTimeHelper class are listed here.

Methods

Name Description

Add Returns a new DateTime that adds the value of the specified _
TimeSpan to the value of this instance.

AddDays Returns a new DateTime that adds the specified number of days to
the value of this instance.

AddHours Returns a new DateTime that adds the specified number of hours
to the value of this instance.

AddMilliseconds Returns a new DateTime that adds the specified number of


milliseconds to the value of this instance.

AddMinutes Returns a new DateTime that adds the specified number of


minutes to the value of this instance.

AddMonths Returns a new DateTime that adds the specified number of


months to the value of this instance.

AddSeconds Returns a new DateTime that adds the specified number of


seconds to the value of this instance.

AddTicks Returns a new DateTime that adds the specified number of ticks to
the value of this instance.

AddYears Returns a new DateTime that adds the specified number of years
to the value of this instance.

CompareTo(ClrDateTime, Compares two instances of T DateTime and returns an integer that


ClrDateTime) indicates whether the first instance is earlier than, the same as, or
later than the second instance.

CompareTo(ClrDateTime, Compares the value of this instance to a specified variant that


ClrVariant) contains a specified T DateTime value, and returns an integer that
indicates whether this instance is earlier than, the same as, or later
than the specified DateTime value.

Equals(ClrDateTime, ClrDateTime) Returns a value indicating whether two DateTime instances have
the same date and time value.

Equals(ClrDateTime, ClrVariant) Returns a value indicating whether this instance is equal to a

772
.Net Runtime Library for Delphi

Name Description

specified variant.

FromBinary Deserializes a 64-bit binary value and recreates an original


serialized DateTime object.

FromFileTime Converts the specified Windows file time to an equivalent local


time.

FromFileTimeUtc Converts the specified Windows file time to an equivalent UTC


time.

FromOADate Returns a DateTime equivalent to the specified OLE Automation


Date.

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, and day.
ClrInt32)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, day, hour,
ClrInt32, ClrInt32, ClrInt32, minute, and second.

ClrInt32)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, day, hour,
ClrInt32, ClrInt32, ClrInt32, minute, second, and millisecond.

ClrInt32, ClrInt32)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, day, hour,
ClrInt32, ClrInt32, ClrInt32, minute, second, millisecond, and Coordinated Universal Time
(UTC) or local time.
ClrInt32, ClrInt32, TDateTimeKind)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, day, hour,
ClrInt32, ClrInt32, ClrInt32, minute, second, and millisecond for the specified calendar.

ClrInt32, ClrInt32, _Calendar)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, day, hour,
ClrInt32, ClrInt32, ClrInt32, minute, second, millisecond, and Coordinated Universal Time
(UTC) or local time for the specified calendar.
ClrInt32, ClrInt32, _Calendar,
TDateTimeKind)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, day, hour,
ClrInt32, ClrInt32, ClrInt32, minute, second, and Coordinated Universal Time (UTC) or local
time.
ClrInt32, TDateTimeKind)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, day, hour,
ClrInt32, ClrInt32, ClrInt32, minute, and second for the specified calendar.

773
.Net Runtime Library for Delphi

Name Description

ClrInt32, _Calendar)

GetDateTime(ClrInt32, ClrInt32, Returns a DateTime using the specified year, month, and day for
ClrInt32, _Calendar) the specified calendar.

GetDateTime(ClrInt64) Returns a DateTime using a specified number of ticks.

GetDateTime(ClrInt64, Returns a DateTime using a specified number of ticks and to


TDateTimeKind) Coordinated Universal Time (UTC) or local time.

GetDateTime(ClrVariant) Returns a DateTime equivalent of the specified variant.

GetDateTimeFormats(ClrDateTime) Converts the value of this instance to all the string representations
supported by the standard date and time format specifiers.

GetDateTimeFormats(ClrDateTime, Converts the value of this instance to all the string representations
ClrChar) supported by the specified standard date and time format
specifier.

GetDateTimeFormats(ClrDateTime, Converts the value of this instance to all the string representations
ClrChar, IFormatProvider) supported by the specified standard date and time format
specifier and culture-specific formatting information.

GetDateTimeFormats(ClrDateTime, Converts the value of this instance to all the string representations
ClrWChar) supported by the specified standard date and time format
specifier.

GetDateTimeFormats(ClrDateTime, Converts the value of this instance to all the string representations
ClrWChar, IFormatProvider) supported by the specified standard date and time format
specifier and culture-specific formatting information.

GetDateTimeFormats(ClrDateTime, Converts the value of this instance to all the string representations
IFormatProvider) supported by the standard date and time format specifiers and the
specified culture-specific formatting information.

GetDay Gets the day of the month represented by this instance.

GetDayOfWeek Gets the day of the week represented by this instance.

GetDayOfYear Gets the day of the year represented by this instance.

GetHashCode Returns the hash code for this instance.

GetHour Gets the hour component of the date represented by this instance.

774
.Net Runtime Library for Delphi

Name Description

GetKind Gets a value that indicates whether the time represented by this
instance is based on local time, Coordinated Universal Time (UTC),
or neither.

GetMillisecond Gets the milliseconds component of the date represented by this


instance.

GetMinute Gets the minute component of the date represented by this


instance.

GetMonth Gets the month component of the date represented by this


instance.

GetSecond Gets the seconds component of the date represented by this


instance.

GetTicks Gets the number of ticks that represent the date and time of this
instance.

GetTimeOfDay Gets the time of day for this instance.

GetYear Gets the year component of the date represented by this


instance.

IsDaylightSavingTime Indicates whether this instance of DateTime is within the daylight


saving time range for the current time zone.

IsLeapYear Returns an indication whether the specified year is a leap year.

MaxValue Represents the largest possible value of DateTime .

MinValue Represents the smallest possible value of DateTime .

Parse(ClrWString) Converts the string representation of a date and time to its


DateTime equivalent.

Parse(ClrWString, IFormatProvider) Converts the string representation of a date and time to its
DateTime equivalent by using culture-specific format information.

Parse(ClrWString, IFormatProvider, Converts the string representation of a date and time to its
TDateTimeStyles) DateTime equivalent by using culture-specific format information
and formatting style.

ParseExact(ClrWString, ClrWString, Converts the specified string representation of a date and time to
IFormatProvider) its DateTime equivalent using the specified format and culture-
specific format information. The format of the string

775
.Net Runtime Library for Delphi

Name Description

representation must match the specified format exactly.

ParseExact(ClrWString, ClrWString, Converts the specified string representation of a date and time to
IFormatProvider, TDateTimeStyles) its DateTime equivalent using the specified format, culture-specific
format information, and style. The format of the string
representation must match the specified format exactly or an
exception is thrown.

ParseExact(ClrWString, Converts the specified string representation of a date and time to


TClrWStringDynArray, its DateTime equivalent using the specified array of formats,
culture-specific format information, and style. The format of the
IFormatProvider, TDateTimeStyles)
string representation must match at least one of the specified
formats exactly or an exception is thrown.

ParseExact(ClrWString, Converts the specified string representation of a date and time to


_StringArray, IFormatProvider, its DateTime equivalent using the specified array of formats,
culture-specific format information, and style. The format of the
TDateTimeStyles)
string representation must match at least one of the specified
formats exactly or an exception is thrown.

SpecifyKind Creates a new DateTime object that has the same number of ticks
as the specified DateTime, but is designated as either local time,
Coordinated Universal Time (UTC), or neither, as indicated by the
specified DateTimeKind value.

Subtract(ClrDateTime, Subtracts the specified date and time from this instance.
ClrDateTime)

Subtract(ClrDateTime, _TimeSpan) Subtracts the specified duration from this instance.

ToBinary Serializes the current DateTime object to a 64-bit binary value that
subsequently can be used to recreate the DateTime object.

Today Gets the current date.

ToFileTime Converts the value of the current DateTime object to a Windows


file time.

ToFileTimeUtc Converts the value of the current DateTime object to a Windows


file time.

ToLocalTime Converts the value of the current DateTime object to local time.

ToLongDateString Converts the value of the current DateTime object to its equivalent
long date string representation.

ToLongTimeString Converts the value of the current DateTime object to its equivalent

776
.Net Runtime Library for Delphi

Name Description

long time string representation.

ToOADate Converts the value of this instance to the equivalent OLE


Automation date.

ToShortDateString Converts the value of the current DateTime object to its equivalent
short date string representation.

ToShortTimeString Converts the value of the current DateTime object to its equivalent
short time string representation.

ToString(ClrDateTime) Converts the value of the current DateTime object to its equivalent
string representation using the formatting conventions of the
current culture.

ToString(ClrDateTime, ClrWString) Converts the value of the current DateTime object to its equivalent
string representation using the specified format and the
formatting conventions of the current culture.

ToString(ClrDateTime, ClrWString, Converts the value of the current DateTime object to its equivalent
IFormatProvider) string representation using the specified format and culture-
specific format information.

ToString(ClrDateTime, Converts the value of the current DateTime object to its equivalent
IFormatProvider) string representation using the specified culture-specific format
information.

ToUniversalTime Converts the value of the current DateTime object to Coordinated


Universal Time (UTC).

TryParse(ClrWString, ClrDateTime) Converts the specified string representation of a date and time to
its DateTime equivalent and returns a value that indicates whether
the conversion succeeded.

TryParse(ClrWString, Converts the specified string representation of a date and time to


IFormatProvider, TDateTimeStyles, its DateTime equivalent using the specified culture-specific format
information and formatting style, and returns a value that indicates
ClrDateTime)
whether the conversion succeeded.

TryParseExact(ClrWString, Converts the specified string representation of a date and time to


ClrWString, IFormatProvider, its DateTime equivalent using the specified format, culture-specific
format information, and style. The format of the string
TDateTimeStyles, ClrDateTime)
representation must match the specified format exactly. The
method returns a value that indicates whether the conversion
succeeded.

TryParseExact(ClrWString, Converts the specified string representation of a date and time to


TClrWStringDynArray, its DateTime equivalent using the specified array of formats,
culture-specific format information, and style. The format of the

777
.Net Runtime Library for Delphi

Name Description

IFormatProvider, TDateTimeStyles, string representation must match at least one of the specified
ClrDateTime) formats exactly. The method returns a value that indicates whether
the conversion succeeded.

TryParseExact(ClrWString, Converts the specified string representation of a date and time to


_StringArray, IFormatProvider, its DateTime equivalent using the specified array of formats,
culture-specific format information, and style. The format of the
TDateTimeStyles, ClrDateTime)
string representation must match at least one of the specified
formats exactly. The method returns a value that indicates whether
the conversion succeeded.

UtcNow Gets a DateTime object that is set to the current date and time on
this computer, expressed as the Coordinated Universal Time (UTC).

7.1.1.8.1.1.8.1.1 TClrDateTimeHelper.Add Method

Returns a new DateTime that adds the value of the specified _TimeSpan to the value of this instance.

Syntax
Delphi

class function Add(D: ClrDateTime; AValue: _TimeSpan): ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.2 TClrDateTimeHelper.AddDays Method


Returns a new DateTime that adds the specified number of days to the value of this instance.

Syntax
Delphi

class function AddDays(D: ClrDateTime; AValue: ClrDouble):


ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.3 TClrDateTimeHelper.AddHours Method


Returns a new DateTime that adds the specified number of hours to the value of this instance.

Syntax

778
.Net Runtime Library for Delphi

Delphi

class function AddHours(D: ClrDateTime; AValue: ClrDouble):


ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.4 TClrDateTimeHelper.AddMilliseconds Method


Returns a new DateTime that adds the specified number of milliseconds to the value of this instance.

Syntax
Delphi

class function AddMilliseconds(D: ClrDateTime; AValue: ClrDouble):


ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.5 TClrDateTimeHelper.AddMinutes Method


Returns a new DateTime that adds the specified number of minutes to the value of this instance.

Syntax
Delphi

class function AddMinutes(D: ClrDateTime; AValue: ClrDouble):


ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.6 TClrDateTimeHelper.AddMonths Method


Returns a new DateTime that adds the specified number of months to the value of this instance.

Syntax
Delphi

class function AddMonths(D: ClrDateTime; AMonths: ClrInt32):


ClrDateTime;

See Also

779
.Net Runtime Library for Delphi

TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.7 TClrDateTimeHelper.AddSeconds Method


Returns a new DateTime that adds the specified number of seconds to the value of this instance.

Syntax
Delphi

class function AddSeconds(D: ClrDateTime; AValue: ClrDouble):


ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.8 TClrDateTimeHelper.AddTicks Method


Returns a new DateTime that adds the specified number of ticks to the value of this instance.

Syntax
Delphi

class function AddTicks(D: ClrDateTime; AValue: ClrInt64):


ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.9 TClrDateTimeHelper.AddYears Method


Returns a new DateTime that adds the specified number of years to the value of this instance.

Syntax
Delphi

class function AddYears(D: ClrDateTime; AValue: ClrInt32):


ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.10 CompareTo Method

This is the overview for the CompareTo method overload.

780
.Net Runtime Library for Delphi

Overload List

Name Description

TClrDateTimeHelper.CompareTo Compares two instances of TDateTime and returns an integer that


(ClrDateTime, ClrDateTime) indicates whether the first instance is earlier than, the same as, or
later than the second instance.

TClrDateTimeHelper.CompareTo Compares the value of this instance to a specified variant that


(ClrDateTime, ClrVariant) contains a specified TDateTime value, and returns an integer that
indicates whether this instance is earlier than, the same as, or later
than the specified DateTime value.

7.1.1.8.1.1.8.1.10 TClrDateTimeHelper.CompareTo Method (ClrDateTime, ClrDateTime)


Compares two instances of TDateTime and returns an integer that indicates whether the first instance is earlier than, the
same as, or later than the second instance.

Syntax
Delphi

class function CompareTo(X: ClrDateTime; Y: ClrDateTime): ClrInt32;


overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.10 TClrDateTimeHelper.CompareTo Method (ClrDateTime, ClrVariant)


Compares the value of this instance to a specified variant that contains a specified TDateTime value, and returns an
integer that indicates whether this instance is earlier than, the same as, or later than the specified DateTime value.

Syntax
Delphi

class function CompareTo(D: ClrDateTime; AValue: ClrVariant):


ClrInt32; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.11 Equals Method

This is the overview for the Equals method overload.

Overload List

781
.Net Runtime Library for Delphi

Name Description

TClrDateTimeHelper.Equals Returns a value indicating whether two DateTime instances have the
(ClrDateTime, ClrDateTime) same date and time value.

TClrDateTimeHelper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrDateTime, ClrVariant) variant.

7.1.1.8.1.1.8.1.11 TClrDateTimeHelper.Equals Method (ClrDateTime, ClrDateTime)


Returns a value indicating whether two DateTime instances have the same date and time value.

Syntax
Delphi

class function Equals(T1: ClrDateTime; T2: ClrDateTime): ClrBoolean;


overload; reintroduce;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.11 TClrDateTimeHelper.Equals Method (ClrDateTime, ClrVariant)


Returns a value indicating whether this instance is equal to a specified variant.

Syntax
Delphi

class function Equals(D: ClrDateTime; AValue: ClrVariant): ClrBoolean;


overload; reintroduce;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.12 TClrDateTimeHelper.FromBinary Method


Deserializes a 64-bit binary value and recreates an original serialized DateTime object.

Syntax
Delphi

class function FromBinary(ADateData: ClrInt64): ClrDateTime;

See Also

782
.Net Runtime Library for Delphi

TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.13 TClrDateTimeHelper.FromFileTime Method


Converts the specified Windows file time to an equivalent local time.

Syntax
Delphi

class function FromFileTime(AFileTime: ClrInt64): ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.14 TClrDateTimeHelper.FromFileTimeUtc Method


Converts the specified Windows file time to an equivalent UTC time.

Syntax
Delphi

class function FromFileTimeUtc(AFileTime: ClrInt64): ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.15 TClrDateTimeHelper.FromOADate Method


Returns a DateTime equivalent to the specified OLE Automation Date.

Syntax
Delphi

class function FromOADate(D: ClrDouble): ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.16 GetDateTime Method

This is the overview for the GetDateTime method overload.

Overload List

783
.Net Runtime Library for Delphi

Name Description

TClrDateTimeHelper.GetDateTime Returns a DateTime using the specified year, month, and day.
(ClrInt32, ClrInt32, ClrInt32)

TClrDateTimeHelper.GetDateTime Returns a DateTime using the specified year, month, day, hour,
(ClrInt32, ClrInt32, ClrInt32, minute, and second.

ClrInt32, ClrInt32, ClrInt32)

TClrDateTimeHelper.GetDateTime Returns a DateTime using the specified year, month, day, hour,
(ClrInt32, ClrInt32, ClrInt32, minute, second, and millisecond.

ClrInt32, ClrInt32, ClrInt32,


ClrInt32)

TClrDateTimeHelper.GetDateTime Returns a DateTime using the specified year, month, day, hour,
(ClrInt32, ClrInt32, ClrInt32, minute, second, millisecond, and Coordinated Universal Time (UTC)
or local time.
ClrInt32, ClrInt32, ClrInt32,
ClrInt32, TDateTimeKind)

TClrDateTimeHelper.GetDateTime Returns a DateTime using the specified year, month, day, hour,
(ClrInt32, ClrInt32, ClrInt32, minute, second, and millisecond for the specified calendar.

ClrInt32, ClrInt32, ClrInt32,


ClrInt32, _Calendar)

TClrDateTimeHelper.GetDateTime Returns a DateTime using the specified year, month, day, hour,
(ClrInt32, ClrInt32, ClrInt32, minute, second, millisecond, and Coordinated Universal Time (UTC)
or local time for the specified calendar.
ClrInt32, ClrInt32, ClrInt32,
ClrInt32, _Calendar,
TDateTimeKind)

TClrDateTimeHelper.GetDateTime Returns a DateTime using the specified year, month, day, hour,
(ClrInt32, ClrInt32, ClrInt32, minute, second, and Coordinated Universal Time (UTC) or local
time.
ClrInt32, ClrInt32, ClrInt32,
TDateTimeKind)

TClrDateTimeHelper.GetDateTime Returns a DateTime using the specified year, month, day, hour,
(ClrInt32, ClrInt32, ClrInt32, minute, and second for the specified calendar.

ClrInt32, ClrInt32, ClrInt32,


_Calendar)

TClrDateTimeHelper.GetDateTime Returns a DateTime using the specified year, month, and day for
(ClrInt32, ClrInt32, ClrInt32, the specified calendar.

_Calendar)

TClrDateTimeHelper.GetDateTime Returns a DateTime using a specified number of ticks.


(ClrInt64)

784
.Net Runtime Library for Delphi

Name Description

TClrDateTimeHelper.GetDateTime Returns a DateTime using a specified number of ticks and to


(ClrInt64, TDateTimeKind) Coordinated Universal Time (UTC) or local time.

TClrDateTimeHelper.GetDateTime Returns a DateTime equivalent of the specified variant.


(ClrVariant)

7.1.1.8.1.1.8.1.16 TClrDateTimeHelper.GetDateTime Method (ClrInt32, ClrInt32, ClrInt32)


Returns a DateTime using the specified year, month, and day.

Syntax
Delphi

class function GetDateTime(AYear: ClrInt32; AMonth: ClrInt32; ADay:


ClrInt32): ClrDateTime; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.16 TClrDateTimeHelper.GetDateTime Method (ClrInt32, ClrInt32, ClrInt32,


ClrInt32, ClrInt32, ClrInt32)
Returns a DateTime using the specified year, month, day, hour, minute, and second.

Syntax
Delphi

class function GetDateTime(AYear: ClrInt32; AMonth: ClrInt32; ADay:


ClrInt32; AHour: ClrInt32; AMinute: ClrInt32; ASecond: ClrInt32):
ClrDateTime; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.16 TClrDateTimeHelper.GetDateTime Method (ClrInt32, ClrInt32, ClrInt32,


ClrInt32, ClrInt32, ClrInt32, ClrInt32)
Returns a DateTime using the specified year, month, day, hour, minute, second, and millisecond.

Syntax
Delphi

785
.Net Runtime Library for Delphi

class function GetDateTime(AYear: ClrInt32; AMonth: ClrInt32; ADay:


ClrInt32; AHour: ClrInt32; AMinute: ClrInt32; ASecond: ClrInt32;

AMillisecond: ClrInt32): ClrDateTime; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.16 TClrDateTimeHelper.GetDateTime Method (ClrInt32, ClrInt32, ClrInt32,


ClrInt32, ClrInt32, ClrInt32, ClrInt32, TDateTimeKind)
Returns a DateTime using the specified year, month, day, hour, minute, second, millisecond, and Coordinated Universal
Time (UTC) or local time.

Syntax
Delphi

class function GetDateTime(AYear: ClrInt32; AMonth: ClrInt32; ADay:


ClrInt32; AHour: ClrInt32; AMinute: ClrInt32; ASecond: ClrInt32;

AMillisecond: ClrInt32; AKind: TDateTimeKind): ClrDateTime;


overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.16 TClrDateTimeHelper.GetDateTime Method (ClrInt32, ClrInt32, ClrInt32,


ClrInt32, ClrInt32, ClrInt32, ClrInt32, _Calendar)
Returns a DateTime using the specified year, month, day, hour, minute, second, and millisecond for the specified
calendar.

Syntax
Delphi

class function GetDateTime(AYear: ClrInt32; AMonth: ClrInt32; ADay:


ClrInt32; AHour: ClrInt32; AMinute:

ClrInt32; ASecond: ClrInt32; AMillisecond: ClrInt32; ACalendar:


_Calendar): ClrDateTime; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.16 TClrDateTimeHelper.GetDateTime Method (ClrInt32, ClrInt32, ClrInt32,


ClrInt32, ClrInt32, ClrInt32, ClrInt32, _Calendar, TDateTimeKind)

786
.Net Runtime Library for Delphi

Returns a DateTime using the specified year, month, day, hour, minute, second, millisecond, and Coordinated Universal
Time (UTC) or local time for the specified calendar.

Syntax
Delphi

class function GetDateTime(AYear: ClrInt32; AMonth: ClrInt32; ADay:


ClrInt32; AHour: ClrInt32; AMinute: ClrInt32; ASecond: ClrInt32;

AMillisecond: ClrInt32; ACalendar: _Calendar; AKind:


TDateTimeKind): TDateTime; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.16 TClrDateTimeHelper.GetDateTime Method (ClrInt32, ClrInt32, ClrInt32,


ClrInt32, ClrInt32, ClrInt32, TDateTimeKind)
Returns a DateTime using the specified year, month, day, hour, minute, second, and Coordinated Universal Time (UTC)
or local time.

Syntax
Delphi

class function GetDateTime(AYear: ClrInt32; AMonth: ClrInt32; ADay:


ClrInt32; AHour: ClrInt32; AMninute: ClrInt32; ASecond: ClrInt32;

AKind: TDateTimeKind): ClrDateTime; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.16 TClrDateTimeHelper.GetDateTime Method (ClrInt32, ClrInt32, ClrInt32,


ClrInt32, ClrInt32, ClrInt32, _Calendar)
Returns a DateTime using the specified year, month, day, hour, minute, and second for the specified calendar.

Syntax
Delphi

class function GetDateTime(AYear: ClrInt32; AMonth: ClrInt32; ADay:


ClrInt32; AHour: ClrInt32; Aminute: ClrInt32; ASecond: ClrInt32;

ACalendar: _Calendar): ClrDateTime ; overload;

See Also

787
.Net Runtime Library for Delphi

TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.16 TClrDateTimeHelper.GetDateTime Method (ClrInt32, ClrInt32, ClrInt32,


_Calendar)
Returns a DateTime using the specified year, month, and day for the specified calendar.

Syntax
Delphi

class function GetDateTime(AYear: ClrInt32; AMonth: ClrInt32; ADay:


ClrInt32; ACalendar: _Calendar): ClrDateTime; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.16 TClrDateTimeHelper.GetDateTime Method (ClrInt64)


Returns a DateTime using a specified number of ticks.

Syntax
Delphi

class function GetDateTime(ATicks: ClrInt64): ClrDateTime; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.16 TClrDateTimeHelper.GetDateTime Method (ClrInt64, TDateTimeKind)


Returns a DateTime using a specified number of ticks and to Coordinated Universal Time (UTC) or local time.

Syntax
Delphi

class function GetDateTime(ATicks: ClrInt64; AKind: TDateTimeKind):


ClrDateTime; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.16 TClrDateTimeHelper.GetDateTime Method (ClrVariant)


Returns a DateTime equivalent of the specified variant.

Syntax

788
.Net Runtime Library for Delphi

Delphi

class function GetDateTime(AValue: ClrVariant): ClrDateTime; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.17 GetDateTimeFormats Method

This is the overview for the GetDateTimeFormats method overload.

Overload List

Name Description

TClrDateTimeHelper.GetDateTimeFormats Converts the value of this instance to all the string


(ClrDateTime) representations supported by the standard date and time
format specifiers.

TClrDateTimeHelper.GetDateTimeFormats Converts the value of this instance to all the string


(ClrDateTime, ClrChar) representations supported by the specified standard date
and time format specifier.

TClrDateTimeHelper.GetDateTimeFormats Converts the value of this instance to all the string


(ClrDateTime, ClrChar, IFormatProvider) representations supported by the specified standard date
and time format specifier and culture-specific formatting
information.

TClrDateTimeHelper.GetDateTimeFormats Converts the value of this instance to all the string


(ClrDateTime, ClrWChar) representations supported by the specified standard date
and time format specifier.

TClrDateTimeHelper.GetDateTimeFormats Converts the value of this instance to all the string


(ClrDateTime, ClrWChar, IFormatProvider) representations supported by the specified standard date
and time format specifier and culture-specific formatting
information.

TClrDateTimeHelper.GetDateTimeFormats Converts the value of this instance to all the string


(ClrDateTime, IFormatProvider) representations supported by the standard date and time
format specifiers and the specified culture-specific
formatting information.

7.1.1.8.1.1.8.1.17 TClrDateTimeHelper.GetDateTimeFormats Method (ClrDateTime)


Converts the value of this instance to all the string representations supported by the standard date and time format
specifiers.

Syntax

789
.Net Runtime Library for Delphi

Delphi

class function GetDateTimeFormats(D: ClrDateTime): _StringArray;


overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.17 TClrDateTimeHelper.GetDateTimeFormats Method (ClrDateTime, ClrChar)


Converts the value of this instance to all the string representations supported by the specified standard date and time
format specifier.

Syntax
Delphi

class function GetDateTimeFormats(D: ClrDateTime; AFormat: ClrChar):


_StringArray; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.17 TClrDateTimeHelper.GetDateTimeFormats Method (ClrDateTime, ClrChar,


IFormatProvider)
Converts the value of this instance to all the string representations supported by the specified standard date and time
format specifier and culture-specific formatting information.

Syntax
Delphi

class function GetDateTimeFormats(D: ClrDateTime; AFormat: ClrChar;


AProvider: IFormatProvider): _StringArray; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.17 TClrDateTimeHelper.GetDateTimeFormats Method (ClrDateTime, ClrWChar)


Converts the value of this instance to all the string representations supported by the specified standard date and time
format specifier.

Syntax
Delphi

class function GetDateTimeFormats(D: ClrDateTime; AFormat: ClrWChar):


_StringArray; overload;

790
.Net Runtime Library for Delphi

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.17 TClrDateTimeHelper.GetDateTimeFormats Method (ClrDateTime, ClrWChar,


IFormatProvider)
Converts the value of this instance to all the string representations supported by the specified standard date and time
format specifier and culture-specific formatting information.

Syntax
Delphi

class function GetDateTimeFormats(D: ClrDateTime; AFormat: ClrWChar;


AProvider: IFormatProvider): _StringArray; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.17 TClrDateTimeHelper.GetDateTimeFormats Method (ClrDateTime,


IFormatProvider)
Converts the value of this instance to all the string representations supported by the standard date and time format
specifiers and the specified culture-specific formatting information.

Syntax
Delphi

class function GetDateTimeFormats(D: ClrDateTime; AProvider:


IFormatProvider): _StringArray; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.18 TClrDateTimeHelper.GetDay Method


Gets the day of the month represented by this instance.

Syntax
Delphi

class function GetDay(D: ClrDateTime): ClrInt32;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

791
.Net Runtime Library for Delphi

7.1.1.8.1.1.8.1.19 TClrDateTimeHelper.GetDayOfWeek Method


Gets the day of the week represented by this instance.

Syntax
Delphi

class function GetDayOfWeek(D: ClrDateTime): TDayOfWeek;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.20 TClrDateTimeHelper.GetDayOfYear Method


Gets the day of the year represented by this instance.

Syntax
Delphi

class function GetDayOfYear(D: ClrDateTime): ClrInt32;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.21 TClrDateTimeHelper.GetHashCode Method


Returns the hash code for this instance.

Syntax
Delphi

class function GetHashCode(D: ClrDateTime): ClrInt32; reintroduce;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.22 TClrDateTimeHelper.GetHour Method


Gets the hour component of the date represented by this instance.

Syntax
Delphi

class function GetHour(D: ClrDateTime): ClrInt32;

See Also

792
.Net Runtime Library for Delphi

TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.23 TClrDateTimeHelper.GetKind Method


Gets a value that indicates whether the time represented by this instance is based on local time, Coordinated Universal
Time (UTC), or neither.

Syntax
Delphi

class function GetKind(D: ClrDateTime): TDateTimeKind;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.24 TClrDateTimeHelper.GetMillisecond Method


Gets the milliseconds component of the date represented by this instance.

Syntax
Delphi

class function GetMillisecond(D: ClrDateTime): ClrInt32;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.25 TClrDateTimeHelper.GetMinute Method


Gets the minute component of the date represented by this instance.

Syntax
Delphi

class function GetMinute(D: ClrDateTime): ClrInt32;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.26 TClrDateTimeHelper.GetMonth Method


Gets the month component of the date represented by this instance.

Syntax
Delphi

793
.Net Runtime Library for Delphi

class function GetMonth(D: ClrDateTime): ClrInt32;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.27 TClrDateTimeHelper.GetSecond Method


Gets the seconds component of the date represented by this instance.

Syntax
Delphi

class function GetSecond(D: ClrDateTime): ClrInt32;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.28 TClrDateTimeHelper.GetTicks Method


Gets the number of ticks that represent the date and time of this instance.

Syntax
Delphi

class function GetTicks(D: ClrDateTime): ClrInt64;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.29 TClrDateTimeHelper.GetTimeOfDay Method


Gets the time of day for this instance.

Syntax
Delphi

class function GetTimeOfDay(D: ClrDateTime): _TimeSpan;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.30 TClrDateTimeHelper.GetYear Method


Gets the year component of the date represented by this instance.

794
.Net Runtime Library for Delphi

Syntax
Delphi

class function GetYear(D: ClrDateTime): ClrInt32;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.31 TClrDateTimeHelper.IsDaylightSavingTime Method


Indicates whether this instance of DateTime is within the daylight saving time range for the current time zone.

Syntax
Delphi

class function IsDaylightSavingTime(D: ClrDateTime): ClrBoolean;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.32 TClrDateTimeHelper.IsLeapYear Method


Returns an indication whether the specified year is a leap year.

Syntax
Delphi

class function IsLeapYear(AYear: ClrInt32): ClrBoolean;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.33 TClrDateTimeHelper.MaxValue Method


Represents the largest possible value of DateTime.

Syntax
Delphi

class function MaxValue: ClrDateTime;

See Also

795
.Net Runtime Library for Delphi

TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.34 TClrDateTimeHelper.MinValue Method


Represents the smallest possible value of DateTime.

Syntax
Delphi

class function MinValue: ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.35 Parse Method

This is the overview for the Parse method overload.

Overload List

Name Description

TClrDateTimeHelper.Parse Converts the string representation of a date and time to its DateTime
(ClrWString) equivalent.

TClrDateTimeHelper.Parse Converts the string representation of a date and time to its DateTime
(ClrWString, equivalent by using culture-specific format information.

IFormatProvider)

TClrDateTimeHelper.Parse Converts the string representation of a date and time to its DateTime
(ClrWString, equivalent by using culture-specific format information and
formatting style.
IFormatProvider,
TDateTimeStyles)

7.1.1.8.1.1.8.1.35 TClrDateTimeHelper.Parse Method (ClrWString)


Converts the string representation of a date and time to its DateTime equivalent.

Syntax
Delphi

class function Parse(S: ClrWString): ClrDateTime; overload;

See Also

796
.Net Runtime Library for Delphi

TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.35 TClrDateTimeHelper.Parse Method (ClrWString, IFormatProvider)


Converts the string representation of a date and time to its DateTime equivalent by using culture-specific format
information.

Syntax
Delphi

class function Parse(S: ClrWString; AProvider: IFormatProvider):


ClrDateTime; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.35 TClrDateTimeHelper.Parse Method (ClrWString, IFormatProvider,


TDateTimeStyles)
Converts the string representation of a date and time to its DateTime equivalent by using culture-specific format
information and formatting style.

Syntax
Delphi

class function Parse(S: ClrWString; AProvider: IFormatProvider;


Styles: TDateTimeStyles): ClrDateTime; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.36 ParseExact Method

This is the overview for the ParseExact method overload.

Overload List

Name Description

TClrDateTimeHelper.ParseExact Converts the specified string representation of a date and time to its
(ClrWString, ClrWString, DateTime equivalent using the specified format and culture-specific
format information. The format of the string representation must
IFormatProvider)
match the specified format exactly.

TClrDateTimeHelper.ParseExact Converts the specified string representation of a date and time to its
(ClrWString, ClrWString, DateTime equivalent using the specified format, culture-specific
format information, and style. The format of the string

797
.Net Runtime Library for Delphi

Name Description

IFormatProvider, representation must match the specified format exactly or an


TDateTimeStyles) exception is thrown.

TClrDateTimeHelper.ParseExact Converts the specified string representation of a date and time to its
(ClrWString, DateTime equivalent using the specified array of formats, culture-
specific format information, and style. The format of the string
TClrWStringDynArray,
representation must match at least one of the specified formats
IFormatProvider,
exactly or an exception is thrown.
TDateTimeStyles)

TClrDateTimeHelper.ParseExact Converts the specified string representation of a date and time to its
(ClrWString, _StringArray, DateTime equivalent using the specified array of formats, culture-
specific format information, and style. The format of the string
IFormatProvider,
representation must match at least one of the specified formats
TDateTimeStyles)
exactly or an exception is thrown.

7.1.1.8.1.1.8.1.36 TClrDateTimeHelper.ParseExact Method (ClrWString, ClrWString,


IFormatProvider)
Converts the specified string representation of a date and time to its DateTime equivalent using the specified format
and culture-specific format information. The format of the string representation must match the specified format
exactly.

Syntax
Delphi

class function ParseExact(S: ClrWString; AFormat: ClrWString;


AProvider: IFormatProvider): ClrDateTime; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.36 TClrDateTimeHelper.ParseExact Method (ClrWString, ClrWString,


IFormatProvider, TDateTimeStyles)
Converts the specified string representation of a date and time to its DateTime equivalent using the specified format,
culture-specific format information, and style. The format of the string representation must match the specified format
exactly or an exception is thrown.

Syntax
Delphi

class function ParseExact(S: ClrWString; AFormat: ClrWString;


AProvider: IFormatProvider; AStyle: TDateTimeStyles): ClrDateTime;
overload;

798
.Net Runtime Library for Delphi

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.36 TClrDateTimeHelper.ParseExact Method (ClrWString, TClrWStringDynArray,


IFormatProvider, TDateTimeStyles)
Converts the specified string representation of a date and time to its DateTime equivalent using the specified array of
formats, culture-specific format information, and style. The format of the string representation must match at least one
of the specified formats exactly or an exception is thrown.

Syntax
Delphi

class function ParseExact(S: ClrWString; AFormats:


TClrWStringDynArray; AProvider: IFormatProvider; AStyle:
TDateTimeStyles): ClrDateTime; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.36 TClrDateTimeHelper.ParseExact Method (ClrWString, _StringArray,


IFormatProvider, TDateTimeStyles)
Converts the specified string representation of a date and time to its DateTime equivalent using the specified array of
formats, culture-specific format information, and style. The format of the string representation must match at least one
of the specified formats exactly or an exception is thrown.

Syntax
Delphi

class function ParseExact(S: ClrWString; AFormats: _StringArray;


AProvider: IFormatProvider; AStyle: TDateTimeStyles): ClrDateTime;
overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.37 TClrDateTimeHelper.SpecifyKind Method


Creates a new DateTime object that has the same number of ticks as the specified DateTime, but is designated as either
local time, Coordinated Universal Time (UTC), or neither, as indicated by the specified DateTimeKind value.

Syntax
Delphi

799
.Net Runtime Library for Delphi

class function SpecifyKind(AValue: ClrDateTime; AKind: TDateTimeKind):


ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.38 Subtract Method

This is the overview for the Subtract method overload.

Overload List

Name Description

TClrDateTimeHelper.Subtract Subtracts the specified date and time from this instance.
(ClrDateTime, ClrDateTime)

TClrDateTimeHelper.Subtract Subtracts the specified duration from this instance.


(ClrDateTime, _TimeSpan)

7.1.1.8.1.1.8.1.38 TClrDateTimeHelper.Subtract Method (ClrDateTime, ClrDateTime)


Subtracts the specified date and time from this instance.

Syntax
Delphi

class function Subtract(D: ClrDateTime; AValue: ClrDateTime):


_TimeSpan; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.38 TClrDateTimeHelper.Subtract Method (ClrDateTime, _TimeSpan)


Subtracts the specified duration from this instance.

Syntax
Delphi

class function Subtract(D: ClrDateTime; AValue: _TimeSpan):


ClrDateTime; overload;

See Also

800
.Net Runtime Library for Delphi

TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.39 TClrDateTimeHelper.ToBinary Method


Serializes the current DateTime object to a 64-bit binary value that subsequently can be used to recreate the DateTime
object.

Syntax
Delphi

class function ToBinary(D: ClrDateTime): ClrInt64;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.40 TClrDateTimeHelper.Today Method


Gets the current date.

Syntax
Delphi

class function Today: ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.41 TClrDateTimeHelper.ToFileTime Method


Converts the value of the current DateTime object to a Windows file time.

Syntax
Delphi

class function ToFileTime(D: ClrDateTime): ClrInt64;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.42 TClrDateTimeHelper.ToFileTimeUtc Method


Converts the value of the current DateTime object to a Windows file time.

Syntax
Delphi

801
.Net Runtime Library for Delphi

class function ToFileTimeUtc(D: ClrDateTime): ClrInt64;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.43 TClrDateTimeHelper.ToLocalTime Method


Converts the value of the current DateTime object to local time.

Syntax
Delphi

class function ToLocalTime(D: ClrDateTime): ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.44 TClrDateTimeHelper.ToLongDateString Method


Converts the value of the current DateTime object to its equivalent long date string representation.

Syntax
Delphi

class function ToLongDateString(D: ClrDateTime): ClrWString;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.45 TClrDateTimeHelper.ToLongTimeString Method


Converts the value of the current DateTime object to its equivalent long time string representation.

Syntax
Delphi

class function ToLongTimeString(D: ClrDateTime): ClrWString;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.46 TClrDateTimeHelper.ToOADate Method


Converts the value of this instance to the equivalent OLE Automation date.

802
.Net Runtime Library for Delphi

Syntax
Delphi

class function ToOADate(D: ClrDateTime): ClrDouble;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.47 TClrDateTimeHelper.ToShortDateString Method


Converts the value of the current DateTime object to its equivalent short date string representation.

Syntax
Delphi

class function ToShortDateString(D: ClrDateTime): ClrWString;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.48 TClrDateTimeHelper.ToShortTimeString Method


Converts the value of the current DateTime object to its equivalent short time string representation.

Syntax
Delphi

class function ToShortTimeString(D: ClrDateTime): ClrWString;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.49 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrDateTimeHelper.ToString Converts the value of the current DateTime object to its equivalent
(ClrDateTime) string representation using the formatting conventions of the current
culture.

803
.Net Runtime Library for Delphi

Name Description

TClrDateTimeHelper.ToString Converts the value of the current DateTime object to its equivalent
(ClrDateTime, ClrWString) string representation using the specified format and the formatting
conventions of the current culture.

TClrDateTimeHelper.ToString Converts the value of the current DateTime object to its equivalent
(ClrDateTime, ClrWString, string representation using the specified format and culture-specific
format information.
IFormatProvider)

TClrDateTimeHelper.ToString Converts the value of the current DateTime object to its equivalent
(ClrDateTime, string representation using the specified culture-specific format
information.
IFormatProvider)

7.1.1.8.1.1.8.1.49 TClrDateTimeHelper.ToString Method (ClrDateTime)


Converts the value of the current DateTime object to its equivalent string representation using the formatting
conventions of the current culture.

Syntax
Delphi

class function ToString(D: ClrDateTime): ClrWString; overload;


reintroduce;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.49 TClrDateTimeHelper.ToString Method (ClrDateTime, ClrWString)


Converts the value of the current DateTime object to its equivalent string representation using the specified format and
the formatting conventions of the current culture.

Syntax
Delphi

class function ToString(D: ClrDateTime; AFormat: ClrWString):


ClrWString; overload; reintroduce;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.49 TClrDateTimeHelper.ToString Method (ClrDateTime, ClrWString,


IFormatProvider)

804
.Net Runtime Library for Delphi

Converts the value of the current DateTime object to its equivalent string representation using the specified format and
culture-specific format information.

Syntax
Delphi

class function ToString(D: ClrDateTime; AFormat: ClrWString;


AProvider: IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.49 TClrDateTimeHelper.ToString Method (ClrDateTime, IFormatProvider)


Converts the value of the current DateTime object to its equivalent string representation using the specified culture-
specific format information.

Syntax
Delphi

class function ToString(D: ClrDateTime; AProvider: IFormatProvider):


ClrWString; overload; reintroduce;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.50 TClrDateTimeHelper.ToUniversalTime Method


Converts the value of the current DateTime object to Coordinated Universal Time (UTC).

Syntax
Delphi

class function ToUniversalTime(D: ClrDateTime): ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.51 TryParse Method

This is the overview for the TryParse method overload.

Overload List

805
.Net Runtime Library for Delphi

Name Description

TClrDateTimeHelper.TryParse Converts the specified string representation of a date and time to its
(ClrWString, ClrDateTime) DateTime equivalent and returns a value that indicates whether the
conversion succeeded.

TClrDateTimeHelper.TryParse Converts the specified string representation of a date and time to its
(ClrWString, DateTime equivalent using the specified culture-specific format
information and formatting style, and returns a value that indicates
IFormatProvider,
whether the conversion succeeded.
TDateTimeStyles,
ClrDateTime)

7.1.1.8.1.1.8.1.51 TClrDateTimeHelper.TryParse Method (ClrWString, ClrDateTime)


Converts the specified string representation of a date and time to its DateTime equivalent and returns a value that
indicates whether the conversion succeeded.

Syntax
Delphi

class function TryParse(S: ClrWString; var AResult: ClrDateTime):


ClrBoolean; overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.51 TClrDateTimeHelper.TryParse Method (ClrWString, IFormatProvider,


TDateTimeStyles, ClrDateTime)
Converts the specified string representation of a date and time to its DateTime equivalent using the specified culture-
specific format information and formatting style, and returns a value that indicates whether the conversion succeeded.

Syntax
Delphi

class function TryParse(S: ClrWString; AProvider: IFormatProvider;


Styles: TDateTimeStyles; var AResult:ClrDateTime): ClrBoolean;
overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.52 TryParseExact Method

This is the overview for the TryParseExact method overload.

806
.Net Runtime Library for Delphi

Overload List

Name Description

TClrDateTimeHelper.TryParseExact Converts the specified string representation of a date and time to


(ClrWString, ClrWString, its DateTime equivalent using the specified format, culture-specific
format information, and style. The format of the string
IFormatProvider, TDateTimeStyles,
representation must match the specified format exactly. The
ClrDateTime)
method returns a value that indicates whether the conversion
succeeded.

TClrDateTimeHelper.TryParseExact Converts the specified string representation of a date and time to


(ClrWString, TClrWStringDynArray, its DateTime equivalent using the specified array of formats,
culture-specific format information, and style. The format of the
IFormatProvider, TDateTimeStyles,
string representation must match at least one of the specified
ClrDateTime)
formats exactly. The method returns a value that indicates whether
the conversion succeeded.

TClrDateTimeHelper.TryParseExact Converts the specified string representation of a date and time to


(ClrWString, _StringArray, its DateTime equivalent using the specified array of formats,
culture-specific format information, and style. The format of the
IFormatProvider, TDateTimeStyles,
string representation must match at least one of the specified
ClrDateTime)
formats exactly. The method returns a value that indicates whether
the conversion succeeded.

7.1.1.8.1.1.8.1.52 TClrDateTimeHelper.TryParseExact Method (ClrWString, ClrWString,


IFormatProvider, TDateTimeStyles, ClrDateTime)
Converts the specified string representation of a date and time to its DateTime equivalent using the specified format,
culture-specific format information, and style. The format of the string representation must match the specified format
exactly. The method returns a value that indicates whether the conversion succeeded.

Syntax
Delphi

class function TryParseExact(S: ClrWString; AFormat: ClrWString;


AProvider: IFormatProvider;

AStyle: TDateTimeStyles; arv AResult: ClrDateTime): ClrBoolean;


overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.52 TClrDateTimeHelper.TryParseExact Method (ClrWString,


TClrWStringDynArray, IFormatProvider, TDateTimeStyles, ClrDateTime)
Converts the specified string representation of a date and time to its DateTime equivalent using the specified array of
formats, culture-specific format information, and style. The format of the string representation must match at least one
of the specified formats exactly. The method returns a value that indicates whether the conversion succeeded.

807
.Net Runtime Library for Delphi

Syntax
Delphi

class function TryParseExact(S: ClrWString; AFormats:


TClrWStringDynArray; AProvider: IFormatProvider;

AStyle: TDateTimeStyles; arv AResult: ClrDateTime): ClrBoolean;


overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.52 TClrDateTimeHelper.TryParseExact Method (ClrWString, _StringArray,


IFormatProvider, TDateTimeStyles, ClrDateTime)
Converts the specified string representation of a date and time to its DateTime equivalent using the specified array of
formats, culture-specific format information, and style. The format of the string representation must match at least one
of the specified formats exactly. The method returns a value that indicates whether the conversion succeeded.

Syntax
Delphi

class function TryParseExact(S: ClrWString; AFormats: _StringArray;


AProvider: IFormatProvider;

AStyle: TDateTimeStyles; arv AResult: ClrDateTime): ClrBoolean;


overload;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.8.1.53 TClrDateTimeHelper.UtcNow Method


Gets a DateTime object that is set to the current date and time on this computer, expressed as the Coordinated
Universal Time (UTC).

Syntax
Delphi

class function UtcNow: ClrDateTime;

See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace

808
.Net Runtime Library for Delphi

7.1.1.8.1.1.9 TClrDecimalHelper Class


Collapse All Expand All

Helper class for _Decimal Interface Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrDecimalHelper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrDecimalHelper = record

end;

Methods

Name Description

Add Adds two specified Decimal values.

Ceiling Returns the smallest integral value that is greater than or equal to
the specified decimal number.

Compare Compares two specified Decimal values.

CompareTo(ClrDecimal, Compares this instance to a specified Decimal object and returns a


ClrDecimal) comparison of their relative values.

CompareTo(ClrDecimal, Compares this instance to a specified variant and returns a


ClrVariant) comparison of their relative values.

Divide Divides two specified Decimal values. .

Equals(ClrDecimal, ClrDecimal) Returns a value indicating whether two specified instances of


Decimal represent the same value.

Equals(ClrDecimal, ClrVariant) Returns a value indicating whether this instance and a specified
Decimal object represent the same value.

Floor Rounds a specified Decimal number to the closest integer toward


negative infinity.

809
.Net Runtime Library for Delphi

Name Description

FromOACurrency Converts the specified 64-bit signed integer, which contains an OLE
Automation Currency value, to the equivalent Decimal value.

GetBits Converts the value of a specified instance of Decimal to its


equivalent binary representation.

GetBitsAsDynArray Converts the value of a specified instance of Decimal to its


equivalent binary representation.

GetDecimal(ClrDouble) Returns new instance of Decimal to the value of the specified


double-precision floating-point number.

GetDecimal(ClrInt32) Returns new instance of Decimal to the value of the specified 32-bit
signed integer.

GetDecimal(ClrInt32, ClrInt32, Returns new instance of Decimal from parameters specifying the
ClrInt32, ClrBoolean, ClrByte) instance's constituent parts.

GetDecimal(ClrInt64) Returns new instance of Decimal to the value of the specified 64-bit
signed integer.

GetDecimal(ClrSingle) Returns new instance of Decimal to the value of the specified single-
precision floating-point number.

GetDecimal(ClrUInt32) Returns new instance of Decimal to the value of the specified 32-bit
unsigned integer.

GetDecimal(ClrUInt64) Returns new instance of Decimal to the value of the specified 64-bit
unsigned integer.

GetDecimal(ClrVariant) Returns new instance of Decimal to the value of the specified variant.

GetDecimal(TClrInt32DynArray) Returns new instance of Decimal to a decimal value represented in


binary and contained in a specified array.

GetDecimal(_Int32Array) Returns new instance of Decimal to a decimal value represented in


binary and contained in a specified array.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of Decimal.

MinusOne Represents the number negative one (-1).

MinValue Represents the smallest possible value of Decimal.

810
.Net Runtime Library for Delphi

Name Description

Multiply Multiplies two specified Decimal values.

Negate Returns the result of multiplying the specified Decimal value by


negative one.

One Represents the number one (1).

Parse(ClrWString) Converts the string representation of a number to its Decimal


equivalent.

Parse(ClrWString, Converts the string representation of a number to its Decimal


IFormatProvider) equivalent using the specified culture-specific format information.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its Decimal equivalent.

Parse(ClrWString, Converts the string representation of a number to its Decimal


TNumberStyles, equivalent using the specified style and culture-specific format.

IFormatProvider)

Remainder Computes the remainder after dividing two Decimal values.

Round(ClrDecimal) Rounds a decimal value to the nearest integer.

Round(ClrDecimal, ClrInt32) Rounds a Decimal value to a specified number of decimal places.

Round(ClrDecimal, ClrInt32, Rounds a decimal value to a specified precision. A parameter


TMidpointRounding) specifies how to round the value if it is midway between two other
numbers.

Round(ClrDecimal, Rounds a decimal value to the nearest integer. A parameter specifies


TMidpointRounding) how to round the value if it is midway between two other numbers.

Subtract Subtracts one specified Decimal value from another.

ToByte Converts the value of the specified Decimal to the equivalent 8-bit
unsigned integer.

ToDouble Converts the value of the specified Decimal to the equivalent


double-precision floating-point number.

ToInt16 Converts the value of the specified Decimal to the equivalent 16-bit
signed integer.

811
.Net Runtime Library for Delphi

Name Description

ToInt32 Converts the value of the specified Decimal to the equivalent 32-bit
signed integer.

ToInt64 Converts the value of the specified Decimal to the equivalent 64-bit
signed integer.

ToOACurrency Converts the specified Decimal value to the equivalent OLE


Automation Currency value, which is contained in a 64-bit signed
integer.

ToSByte Converts the value of the specified Decimal to the equivalent 8-bit
signed integer.

ToSingle Converts the value of the specified Decimal to the equivalent single-
precision floating-point number.

ToString(ClrDecimal) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrDecimal, Converts the numeric value of this instance to its equivalent string
ClrWString) representation, using the specified format.

ToString(ClrDecimal, Converts the numeric value of this instance to its equivalent string
ClrWString, IFormatProvider) representation using the specified format and culture-specific format
information.

ToString(ClrDecimal, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format
information.

ToUInt16 Converts the value of the specified Decimal to the equivalent 16-bit
unsigned integer.

ToUInt32 Converts the value of the specified Decimal to the equivalent 32-bit
unsigned integer.

ToUInt64 Converts the value of the specified Decimal to the equivalent 64-bit
unsigned integer.

Truncate Returns the integral digits of the specified Decimal; any fractional
digits are discarded.

TryParse(ClrWString, Converts the string representation of a number to its Decimal


ClrDecimal) equivalent. A return value indicates whether the conversion
succeeded or failed.

TryParse(ClrWString, Converts the string representation of a number to its Decimal


equivalent using the specified style and culture-specific format. A

812
.Net Runtime Library for Delphi

Name Description

TNumberStyles, return value indicates whether the conversion succeeded or failed.


IFormatProvider, ClrDecimal)

Zero Represents the number zero (0).

See Also
TClrDecimalHelper Methods

7.1.1.8.1.1.9.1 TClrDecimalHelper Methods

The methods of the TClrDecimalHelper class are listed here.

Methods

Name Description

Add Adds two specified Decimal values.

Ceiling Returns the smallest integral value that is greater than or equal to
the specified decimal number.

Compare Compares two specified Decimal values.

CompareTo(ClrDecimal, Compares this instance to a specified Decimal object and returns a


ClrDecimal) comparison of their relative values.

CompareTo(ClrDecimal, Compares this instance to a specified variant and returns a


ClrVariant) comparison of their relative values.

Divide Divides two specified Decimal values. .

Equals(ClrDecimal, ClrDecimal) Returns a value indicating whether two specified instances of


Decimal represent the same value.

Equals(ClrDecimal, ClrVariant) Returns a value indicating whether this instance and a specified
Decimal object represent the same value.

Floor Rounds a specified Decimal number to the closest integer toward


negative infinity.

FromOACurrency Converts the specified 64-bit signed integer, which contains an OLE
Automation Currency value, to the equivalent Decimal value.

813
.Net Runtime Library for Delphi

Name Description

GetBits Converts the value of a specified instance of Decimal to its


equivalent binary representation.

GetBitsAsDynArray Converts the value of a specified instance of Decimal to its


equivalent binary representation.

GetDecimal(ClrDouble) Returns new instance of Decimal to the value of the specified


double-precision floating-point number.

GetDecimal(ClrInt32) Returns new instance of Decimal to the value of the specified 32-bit
signed integer.

GetDecimal(ClrInt32, ClrInt32, Returns new instance of Decimal from parameters specifying the
ClrInt32, ClrBoolean, ClrByte) instance's constituent parts.

GetDecimal(ClrInt64) Returns new instance of Decimal to the value of the specified 64-bit
signed integer.

GetDecimal(ClrSingle) Returns new instance of Decimal to the value of the specified single-
precision floating-point number.

GetDecimal(ClrUInt32) Returns new instance of Decimal to the value of the specified 32-bit
unsigned integer.

GetDecimal(ClrUInt64) Returns new instance of Decimal to the value of the specified 64-bit
unsigned integer.

GetDecimal(ClrVariant) Returns new instance of Decimal to the value of the specified variant.

GetDecimal(TClrInt32DynArray) Returns new instance of Decimal to a decimal value represented in


binary and contained in a specified array.

GetDecimal(_Int32Array) Returns new instance of Decimal to a decimal value represented in


binary and contained in a specified array.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of Decimal.

MinusOne Represents the number negative one (-1).

MinValue Represents the smallest possible value of Decimal.

Multiply Multiplies two specified Decimal values.

814
.Net Runtime Library for Delphi

Name Description

Negate Returns the result of multiplying the specified Decimal value by


negative one.

One Represents the number one (1).

Parse(ClrWString) Converts the string representation of a number to its Decimal


equivalent.

Parse(ClrWString, Converts the string representation of a number to its Decimal


IFormatProvider) equivalent using the specified culture-specific format information.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its Decimal equivalent.

Parse(ClrWString, Converts the string representation of a number to its Decimal


TNumberStyles, equivalent using the specified style and culture-specific format.

IFormatProvider)

Remainder Computes the remainder after dividing two Decimal values.

Round(ClrDecimal) Rounds a decimal value to the nearest integer.

Round(ClrDecimal, ClrInt32) Rounds a Decimal value to a specified number of decimal places.

Round(ClrDecimal, ClrInt32, Rounds a decimal value to a specified precision. A parameter


TMidpointRounding) specifies how to round the value if it is midway between two other
numbers.

Round(ClrDecimal, Rounds a decimal value to the nearest integer. A parameter specifies


TMidpointRounding) how to round the value if it is midway between two other numbers.

Subtract Subtracts one specified Decimal value from another.

ToByte Converts the value of the specified Decimal to the equivalent 8-bit
unsigned integer.

ToDouble Converts the value of the specified Decimal to the equivalent


double-precision floating-point number.

ToInt16 Converts the value of the specified Decimal to the equivalent 16-bit
signed integer.

ToInt32 Converts the value of the specified Decimal to the equivalent 32-bit
signed integer.

815
.Net Runtime Library for Delphi

Name Description

ToInt64 Converts the value of the specified Decimal to the equivalent 64-bit
signed integer.

ToOACurrency Converts the specified Decimal value to the equivalent OLE


Automation Currency value, which is contained in a 64-bit signed
integer.

ToSByte Converts the value of the specified Decimal to the equivalent 8-bit
signed integer.

ToSingle Converts the value of the specified Decimal to the equivalent single-
precision floating-point number.

ToString(ClrDecimal) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrDecimal, Converts the numeric value of this instance to its equivalent string
ClrWString) representation, using the specified format.

ToString(ClrDecimal, Converts the numeric value of this instance to its equivalent string
ClrWString, IFormatProvider) representation using the specified format and culture-specific format
information.

ToString(ClrDecimal, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format
information.

ToUInt16 Converts the value of the specified Decimal to the equivalent 16-bit
unsigned integer.

ToUInt32 Converts the value of the specified Decimal to the equivalent 32-bit
unsigned integer.

ToUInt64 Converts the value of the specified Decimal to the equivalent 64-bit
unsigned integer.

Truncate Returns the integral digits of the specified Decimal; any fractional
digits are discarded.

TryParse(ClrWString, Converts the string representation of a number to its Decimal


ClrDecimal) equivalent. A return value indicates whether the conversion
succeeded or failed.

TryParse(ClrWString, Converts the string representation of a number to its Decimal


TNumberStyles, equivalent using the specified style and culture-specific format. A
return value indicates whether the conversion succeeded or failed.
IFormatProvider, ClrDecimal)

816
.Net Runtime Library for Delphi

Name Description

Zero Represents the number zero (0).

7.1.1.8.1.1.9.1.1 TClrDecimalHelper.Add Method

Adds two specified Decimal values.

Syntax
Delphi

class function Add(D1: ClrDecimal; D2: ClrDecimal): ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.2 TClrDecimalHelper.Ceiling Method

Returns the smallest integral value that is greater than or equal to the specified decimal number.

Syntax
Delphi

class function Ceiling(D: ClrDecimal): ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.3 TClrDecimalHelper.Compare Method

Compares two specified Decimal values.

Syntax
Delphi

class function Compare(D1: ClrDecimal; D2: ClrDecimal): ClrInt32;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

817
.Net Runtime Library for Delphi

7.1.1.8.1.1.9.1.4 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

Name Description

TClrDecimalHelper.CompareTo Compares this instance to a specified Decimal object and returns a


(ClrDecimal, ClrDecimal) comparison of their relative values.

TClrDecimalHelper.CompareTo Compares this instance to a specified variant and returns a


(ClrDecimal, ClrVariant) comparison of their relative values.

7.1.1.8.1.1.9.1.4 TClrDecimalHelper.CompareTo Method (ClrDecimal, ClrDecimal)


Compares this instance to a specified Decimal object and returns a comparison of their relative values.

Syntax
Delphi

class function CompareTo(X: ClrDecimal; Y: ClrDecimal): ClrInt32;


overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.4 TClrDecimalHelper.CompareTo Method (ClrDecimal, ClrVariant)


Compares this instance to a specified variant and returns a comparison of their relative values.

Syntax
Delphi

class function CompareTo(D: ClrDecimal; AValue: ClrVariant): ClrInt32;


overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.5 TClrDecimalHelper.Divide Method

Divides two specified Decimal values. .

818
.Net Runtime Library for Delphi

Syntax
Delphi

class function Divide(D1: ClrDecimal; D2: ClrDecimal): ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.6 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrDecimalHelper.Equals Returns a value indicating whether two specified instances of Decimal


(ClrDecimal, ClrDecimal) represent the same value.

TClrDecimalHelper.Equals Returns a value indicating whether this instance and a specified


(ClrDecimal, ClrVariant) Decimal object represent the same value.

7.1.1.8.1.1.9.1.6 TClrDecimalHelper.Equals Method (ClrDecimal, ClrDecimal)


Returns a value indicating whether two specified instances of Decimal represent the same value.

Syntax
Delphi

class function Equals(D1: ClrDecimal; D2: ClrDecimal): ClrBoolean;


overload; reintroduce;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.6 TClrDecimalHelper.Equals Method (ClrDecimal, ClrVariant)


Returns a value indicating whether this instance and a specified Decimal object represent the same value.

Syntax
Delphi

819
.Net Runtime Library for Delphi

class function Equals(D: ClrDecimal; AValue: ClrVariant): ClrBoolean;


overload; reintroduce;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.7 TClrDecimalHelper.Floor Method

Rounds a specified Decimal number to the closest integer toward negative infinity.

Syntax
Delphi

class function Floor(D: ClrDecimal): ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.8 TClrDecimalHelper.FromOACurrency Method

Converts the specified 64-bit signed integer, which contains an OLE Automation Currency value, to the equivalent
Decimal value.

Syntax
Delphi

class function FromOACurrency(Cy: ClrInt64): ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.9 TClrDecimalHelper.GetBits Method

Converts the value of a specified instance of Decimal to its equivalent binary representation.

Syntax
Delphi

class function GetBits(D: ClrDecimal): _Int32Array;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

820
.Net Runtime Library for Delphi

7.1.1.8.1.1.9.1.10 TClrDecimalHelper.GetBitsAsDynArray Method

Converts the value of a specified instance of Decimal to its equivalent binary representation.

Syntax
Delphi

class function GetBitsAsDynArray(D: ClrDecimal): TClrInt32DynArray;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.11 GetDecimal Method

This is the overview for the GetDecimal method overload.

Overload List

Name Description

TClrDecimalHelper.GetDecimal Returns new instance of Decimal to the value of the specified


(ClrDouble) double-precision floating-point number.

TClrDecimalHelper.GetDecimal Returns new instance of Decimal to the value of the specified 32-bit
(ClrInt32) signed integer.

TClrDecimalHelper.GetDecimal Returns new instance of Decimal from parameters specifying the


(ClrInt32, ClrInt32, ClrInt32, instance's constituent parts.

ClrBoolean, ClrByte)

TClrDecimalHelper.GetDecimal Returns new instance of Decimal to the value of the specified 64-bit
(ClrInt64) signed integer.

TClrDecimalHelper.GetDecimal Returns new instance of Decimal to the value of the specified single-
(ClrSingle) precision floating-point number.

TClrDecimalHelper.GetDecimal Returns new instance of Decimal to the value of the specified 32-bit
(ClrUInt32) unsigned integer.

TClrDecimalHelper.GetDecimal Returns new instance of Decimal to the value of the specified 64-bit
(ClrUInt64) unsigned integer.

TClrDecimalHelper.GetDecimal Returns new instance of Decimal to the value of the specified variant.
(ClrVariant)

821
.Net Runtime Library for Delphi

Name Description

TClrDecimalHelper.GetDecimal Returns new instance of Decimal to a decimal value represented in


(TClrInt32DynArray) binary and contained in a specified array.

TClrDecimalHelper.GetDecimal Returns new instance of Decimal to a decimal value represented in


(_Int32Array) binary and contained in a specified array.

7.1.1.8.1.1.9.1.11 TClrDecimalHelper.GetDecimal Method (ClrDouble)


Returns new instance of Decimal to the value of the specified double-precision floating-point number.

Syntax
Delphi

class function GetDecimal(AValue: ClrDouble): ClrDecimal; overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.11 TClrDecimalHelper.GetDecimal Method (ClrInt32)


Returns new instance of Decimal to the value of the specified 32-bit signed integer.

Syntax
Delphi

class function GetDecimal(AValue: ClrInt32): ClrDecimal; overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.11 TClrDecimalHelper.GetDecimal Method (ClrInt32, ClrInt32, ClrInt32,


ClrBoolean, ClrByte)
Returns new instance of Decimal from parameters specifying the instance's constituent parts.

Syntax
Delphi

class function GetDecimal(ALow: ClrInt32; AMiddle: ClrInt32; AHigh:


ClrInt32; AIsNegative: ClrBoolean; AScale: ClrByte): ClrDecimal;
overload;

822
.Net Runtime Library for Delphi

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.11 TClrDecimalHelper.GetDecimal Method (ClrInt64)


Returns new instance of Decimal to the value of the specified 64-bit signed integer.

Syntax
Delphi

class function GetDecimal(AValue: ClrInt64): ClrDecimal; overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.11 TClrDecimalHelper.GetDecimal Method (ClrSingle)


Returns new instance of Decimal to the value of the specified single-precision floating-point number.

Syntax
Delphi

class function GetDecimal(AValue: ClrSingle): ClrDecimal; overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.11 TClrDecimalHelper.GetDecimal Method (ClrUInt32)


Returns new instance of Decimal to the value of the specified 32-bit unsigned integer.

Syntax
Delphi

class function GetDecimal(AValue: ClrUInt32): ClrDecimal; overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.11 TClrDecimalHelper.GetDecimal Method (ClrUInt64)


Returns new instance of Decimal to the value of the specified 64-bit unsigned integer.

823
.Net Runtime Library for Delphi

Syntax
Delphi

class function GetDecimal(AValue: ClrUInt64): ClrDecimal; overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.11 TClrDecimalHelper.GetDecimal Method (ClrVariant)


Returns new instance of Decimal to the value of the specified variant.

Syntax
Delphi

class function GetDecimal(AValue: ClrVariant): ClrDecimal; overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.11 TClrDecimalHelper.GetDecimal Method (TClrInt32DynArray)


Returns new instance of Decimal to a decimal value represented in binary and contained in a specified array.

Syntax
Delphi

class function GetDecimal(ABits: TClrInt32DynArray): ClrDecimal;


overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.11 TClrDecimalHelper.GetDecimal Method (_Int32Array)


Returns new instance of Decimal to a decimal value represented in binary and contained in a specified array.

Syntax
Delphi

class function GetDecimal(ABits: _Int32Array): ClrDecimal; overload;

See Also

824
.Net Runtime Library for Delphi

TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.12 TClrDecimalHelper.GetHashCode Method

Returns the hash code for this instance.

Syntax
Delphi

class function GetHashCode(D: ClrDecimal): ClrInt32; reintroduce;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.13 TClrDecimalHelper.MaxValue Method

Represents the largest possible value of Decimal.

Syntax
Delphi

class function MaxValue: ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.14 TClrDecimalHelper.MinusOne Method

Represents the number negative one (-1).

Syntax
Delphi

class function MinusOne: ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.15 TClrDecimalHelper.MinValue Method


Represents the smallest possible value of Decimal.

Syntax

825
.Net Runtime Library for Delphi

Delphi

class function MinValue: ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.16 TClrDecimalHelper.Multiply Method

Multiplies two specified Decimal values.

Syntax
Delphi

class function Multiply(D1: ClrDecimal; D2: ClrDecimal): ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.17 TClrDecimalHelper.Negate Method

Returns the result of multiplying the specified Decimal value by negative one.

Syntax
Delphi

class function Negate(D: ClrDecimal): ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.18 TClrDecimalHelper.One Method

Represents the number one (1).

Syntax
Delphi

class function One: ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

826
.Net Runtime Library for Delphi

7.1.1.8.1.1.9.1.19 Parse Method

This is the overview for the Parse method overload.

Overload List

Name Description

TClrDecimalHelper.Parse Converts the string representation of a number to its Decimal


(ClrWString) equivalent.

TClrDecimalHelper.Parse Converts the string representation of a number to its Decimal


(ClrWString, equivalent using the specified culture-specific format information.

IFormatProvider)

TClrDecimalHelper.Parse Converts the string representation of a number in a specified style to


(ClrWString, TNumberStyles) its Decimal equivalent.

TClrDecimalHelper.Parse Converts the string representation of a number to its Decimal


(ClrWString, TNumberStyles, equivalent using the specified style and culture-specific format.

IFormatProvider)

7.1.1.8.1.1.9.1.19 TClrDecimalHelper.Parse Method (ClrWString)


Converts the string representation of a number to its Decimal equivalent.

Syntax
Delphi

class function Parse(S: ClrWString): ClrDecimal; overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.19 TClrDecimalHelper.Parse Method (ClrWString, IFormatProvider)


Converts the string representation of a number to its Decimal equivalent using the specified culture-specific format
information.

Syntax
Delphi

class function Parse(S: ClrWString; AProvider: IFormatProvider):


ClrDecimal; overload;

827
.Net Runtime Library for Delphi

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.19 TClrDecimalHelper.Parse Method (ClrWString, TNumberStyles)


Converts the string representation of a number in a specified style to its Decimal equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles):


ClrDecimal; overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.19 TClrDecimalHelper.Parse Method (ClrWString, TNumberStyles,


IFormatProvider)
Converts the string representation of a number to its Decimal equivalent using the specified style and culture-specific
format.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles; AProvider:


IFormatProvider): ClrDecimal; overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.20 TClrDecimalHelper.Remainder Method

Computes the remainder after dividing two Decimal values.

Syntax
Delphi

class function Remainder(D1: ClrDecimal; D2: ClrDecimal): ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

828
.Net Runtime Library for Delphi

7.1.1.8.1.1.9.1.21 Round Method

This is the overview for the Round method overload.

Overload List

Name Description

TClrDecimalHelper.Round Rounds a decimal value to the nearest integer.


(ClrDecimal)

TClrDecimalHelper.Round Rounds a Decimal value to a specified number of decimal places.


(ClrDecimal, ClrInt32)

TClrDecimalHelper.Round Rounds a decimal value to a specified precision. A parameter specifies


(ClrDecimal, ClrInt32, how to round the value if it is midway between two other numbers.

TMidpointRounding)

TClrDecimalHelper.Round Rounds a decimal value to the nearest integer. A parameter specifies


(ClrDecimal, how to round the value if it is midway between two other numbers.

TMidpointRounding)

7.1.1.8.1.1.9.1.21 TClrDecimalHelper.Round Method (ClrDecimal)


Rounds a decimal value to the nearest integer.

Syntax
Delphi

class function Round(D: ClrDecimal): ClrDecimal; overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.21 TClrDecimalHelper.Round Method (ClrDecimal, ClrInt32)


Rounds a Decimal value to a specified number of decimal places.

Syntax
Delphi

class function Round(D: ClrDecimal; ADecimals: ClrInt32): ClrDecimal;


overload;

See Also

829
.Net Runtime Library for Delphi

TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.21 TClrDecimalHelper.Round Method (ClrDecimal, ClrInt32,


TMidpointRounding)
Rounds a decimal value to a specified precision. A parameter specifies how to round the value if it is midway between
two other numbers.

Syntax
Delphi

class function Round(D: ClrDecimal; ADecimals: ClrInt32; AMode:


TMidpointRounding): ClrDecimal; overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.21 TClrDecimalHelper.Round Method (ClrDecimal, TMidpointRounding)


Rounds a decimal value to the nearest integer. A parameter specifies how to round the value if it is midway between
two other numbers.

Syntax
Delphi

class function Round(D: ClrDecimal; AMode: TMidpointRounding):


ClrDecimal; overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.22 TClrDecimalHelper.Subtract Method

Subtracts one specified Decimal value from another.

Syntax
Delphi

class function Subtract(D1: ClrDecimal; D2: ClrDecimal): ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

830
.Net Runtime Library for Delphi

7.1.1.8.1.1.9.1.23 TClrDecimalHelper.ToByte Method

Converts the value of the specified Decimal to the equivalent 8-bit unsigned integer.

Syntax
Delphi

class function ToByte(AValue: ClrDecimal): ClrByte;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.24 TClrDecimalHelper.ToDouble Method

Converts the value of the specified Decimal to the equivalent double-precision floating-point number.

Syntax
Delphi

class function ToDouble(D: ClrDecimal): ClrDouble;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.25 TClrDecimalHelper.ToInt16 Method

Converts the value of the specified Decimal to the equivalent 16-bit signed integer.

Syntax
Delphi

class function ToInt16(AValue: ClrDecimal): ClrInt16;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.26 TClrDecimalHelper.ToInt32 Method

Converts the value of the specified Decimal to the equivalent 32-bit signed integer.

Syntax
Delphi

831
.Net Runtime Library for Delphi

class function ToInt32(D: ClrDecimal): ClrInt32;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.27 TClrDecimalHelper.ToInt64 Method

Converts the value of the specified Decimal to the equivalent 64-bit signed integer.

Syntax
Delphi

class function ToInt64(D: ClrDecimal): ClrInt64;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.28 TClrDecimalHelper.ToOACurrency Method

Converts the specified Decimal value to the equivalent OLE Automation Currency value, which is contained in a 64-bit
signed integer.

Syntax
Delphi

class function ToOACurrency(AValue: ClrDecimal): ClrInt64;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.29 TClrDecimalHelper.ToSByte Method

Converts the value of the specified Decimal to the equivalent 8-bit signed integer.

Syntax
Delphi

class function ToSByte(AValue: ClrDecimal): ClrSByte;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

832
.Net Runtime Library for Delphi

7.1.1.8.1.1.9.1.30 TClrDecimalHelper.ToSingle Method

Converts the value of the specified Decimal to the equivalent single-precision floating-point number.

Syntax
Delphi

class function ToSingle(D: ClrDecimal): ClrSingle;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.31 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrDecimalHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrDecimal) representation.

TClrDecimalHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrDecimal, ClrWString) representation, using the specified format.

TClrDecimalHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrDecimal, ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

TClrDecimalHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrDecimal, representation using the specified culture-specific format information.

IFormatProvider)

7.1.1.8.1.1.9.1.31 TClrDecimalHelper.ToString Method (ClrDecimal)


Converts the numeric value of this instance to its equivalent string representation.

Syntax
Delphi

class function ToString(D: ClrDecimal): ClrWString; overload;


reintroduce;

See Also

833
.Net Runtime Library for Delphi

TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.31 TClrDecimalHelper.ToString Method (ClrDecimal, ClrWString)


Converts the numeric value of this instance to its equivalent string representation, using the specified format.

Syntax
Delphi

class function ToString(D: ClrDecimal; AFormat: ClrWString):


ClrWString; overload; reintroduce;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.31 TClrDecimalHelper.ToString Method (ClrDecimal, ClrWString,


IFormatProvider)
Converts the numeric value of this instance to its equivalent string representation using the specified format and
culture-specific format information.

Syntax
Delphi

class function ToString(D: ClrDecimal; AFormat: ClrWString; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.31 TClrDecimalHelper.ToString Method (ClrDecimal, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific
format information.

Syntax
Delphi

class function ToString(D: ClrDecimal; AProvider: IFormatProvider):


ClrWString; overload; reintroduce;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

834
.Net Runtime Library for Delphi

7.1.1.8.1.1.9.1.32 TClrDecimalHelper.ToUInt16 Method

Converts the value of the specified Decimal to the equivalent 16-bit unsigned integer.

Syntax
Delphi

class function ToUInt16(AValue: ClrDecimal): ClrUInt16;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.33 TClrDecimalHelper.ToUInt32 Method

Converts the value of the specified Decimal to the equivalent 32-bit unsigned integer.

Syntax
Delphi

class function ToUInt32(D: ClrDecimal): ClrUInt32;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.34 TClrDecimalHelper.ToUInt64 Method

Converts the value of the specified Decimal to the equivalent 64-bit unsigned integer.

Syntax
Delphi

class function ToUInt64(D: ClrDecimal): ClrUInt64;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.35 TClrDecimalHelper.Truncate Method

Returns the integral digits of the specified Decimal; any fractional digits are discarded.

Syntax
Delphi

835
.Net Runtime Library for Delphi

class function Truncate(D: ClrDecimal): ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.36 TryParse Method

This is the overview for the TryParse method overload.

Overload List

Name Description

TClrDecimalHelper.TryParse Converts the string representation of a number to its Decimal


(ClrWString, ClrDecimal) equivalent. A return value indicates whether the conversion succeeded
or failed.

TClrDecimalHelper.TryParse Converts the string representation of a number to its Decimal


(ClrWString, TNumberStyles, equivalent using the specified style and culture-specific format. A
return value indicates whether the conversion succeeded or failed.
IFormatProvider,
ClrDecimal)

7.1.1.8.1.1.9.1.36 TClrDecimalHelper.TryParse Method (ClrWString, ClrDecimal)


Converts the string representation of a number to its Decimal equivalent. A return value indicates whether the
conversion succeeded or failed.

Syntax
Delphi

class function TryParse(S: ClrWString; var AResult: ClrDecimal):


ClrBoolean; overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.36 TClrDecimalHelper.TryParse Method (ClrWString, TNumberStyles,


IFormatProvider, ClrDecimal)
Converts the string representation of a number to its Decimal equivalent using the specified style and culture-specific
format. A return value indicates whether the conversion succeeded or failed.

Syntax
Delphi

836
.Net Runtime Library for Delphi

class function TryParse(S: ClrWString; AStyle: TNumberStyles;


AProvider: IFormatProvider; var AResult: ClrDecimal): ClrBoolean;
overload;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.9.1.37 TClrDecimalHelper.Zero Method

Represents the number zero (0).

Syntax
Delphi

class function Zero: ClrDecimal;

See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10 TClrGuidHelper Class


Collapse All Expand All

Helper class for Guid Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrGuidHelper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrGuidHelper = class;

Methods

Name Description

CompareTo(ClrGuid, Compares this instance to a specified clr Guid object and returns an
ClrGuid) indication of their relative values.

837
.Net Runtime Library for Delphi

Name Description

CompareTo(TGuid, Compares this instance to a specified variant and returns an indication


ClrVariant) of their relative values.

CompareTo(TGuid, TGuid) Compares this instance to a specified T Guid object and returns an
indication of their relative values.

Empty A read-only instance of the Guid whose value is all zeros.

Equals(ClrGuid, ClrGuid) Returns a value indicating whether this instance and a specified clr
Guid object represent the same value.

Equals(TGuid, ClrVariant) Returns a value that indicates whether this instance is equal to a
specified variant.

Equals(TGuid, TGuid) Returns a value indicating whether this instance and a specified T Guid
object represent the same value.

GetGuid(ClrInt32, ClrInt16, Returns a new instance of the Guid by using the specified integers
ClrInt16, ClrByte, ClrByte, and bytes.
ClrByte, ClrByte, ClrByte,
ClrByte, ClrByte, ClrByte)

GetGuid(ClrInt32, ClrInt16, Returns a new instance of the Guid by using the specified integers and
ClrInt16, TClrByteDynArray) the dynamic byte array.

GetGuid(ClrInt32, ClrInt16, Returns a new instance of the Guid structure by using the specified
ClrInt16, _ByteArray) integers and byte array.

GetGuid(ClrUInt32, Returns a new instance of the Guid structure by using the specified
ClrUInt16, ClrUInt16, unsigned integers and bytes.

ClrByte, ClrByte, ClrByte,


ClrByte, ClrByte, ClrByte,
ClrByte, ClrByte)

GetGuid(ClrWString) Returns a new instance of the Guid structure by using the value
represented by the specified string.

GetGuid(TClrByteDynArray) Returns a new instance of the Guid structure by using the specified
array of bytes.

GetGuid(_ByteArray) Returns a new instance of the Guid structure by using the specified
array of bytes.

GetHashCode(ClrGuid) Returns the hash code for the Clr Guid instance.

838
.Net Runtime Library for Delphi

Name Description

GetHashCode(TGuid) Returns the hash code for the TGuid instance

NewGuid Initializes a new instance of the Guid structure.

Parse Converts the string representation of a GUID to the equivalent Guid


structure.

ParseExact Converts the string representation of a GUID to the


equivalent Guid structure, provided that the string is in the specified
format.

ToByteArray(ClrGuid) Returns a 16-element byte array that contains the value of the Clr
Guid instance.

ToByteArray(TGuid) Returns a 16-element byte array that contains the value of the TGuid
instance.

ToByteDynArray(ClrGuid) Returns a 16-element dynamic byte array that contains the


value of the Clr Guid instance.

ToByteDynArray(TGuid) Returns a 16-element dynamic byte array that contains the value of
the TGuid instance.

ToClrGuid Converts TGuid instance to an equivalent value of Clr Guid


structure.

ToGuid Converts Clr Guid instance to an equivalent value of TGuid


record.

ToString(ClrGuid) Returns a string representation of the value of this instance in registry


format.

ToString(ClrGuid, Returns a string representation of the value of this Guid instance,


ClrWString) according to the provided format specifier.

ToString(ClrGuid, Returns a string representation of the value of this instance


ClrWString, of the Guid class, according to the provided format specifier and
IFormatProvider) culture-specific format information.

ToString(TGuid) Returns a string representation of the value of this instance in registry


format.

ToString(TGuid, ClrWString) Returns a string representation of the value of this Guid instance,
according to the provided format specifier.

839
.Net Runtime Library for Delphi

Name Description

ToString(TGuid, ClrWString, Returns a string representation of the value of this instance of the
IFormatProvider) Guid class, according to the provided format specifier and culture-
specific format information.

TryParse Converts the string representation of a GUID to the equivalent Guid


structure.

TryParseExact Converts the string representation of a GUID to the equivalent Guid


structure, provided that the string is in the specified format.

See Also
TClrGuidHelper Methods

7.1.1.8.1.1.10.1 TClrGuidHelper Methods

The methods of the TClrGuidHelper class are listed here.

Methods

Name Description

CompareTo(ClrGuid, Compares this instance to a specified clr Guid object and returns an
ClrGuid) indication of their relative values.

CompareTo(TGuid, Compares this instance to a specified variant and returns an indication


ClrVariant) of their relative values.

CompareTo(TGuid, TGuid) Compares this instance to a specified TGuid object and returns an
indication of their relative values.

Empty A read-only instance of the Guid whose value is all zeros.

Equals(ClrGuid, ClrGuid) Returns a value indicating whether this instance and a specified clr
Guid object represent the same value.

Equals(TGuid, ClrVariant) Returns a value that indicates whether this instance is equal to a
specified variant.

Equals(TGuid, TGuid) Returns a value indicating whether this instance and a specified TGuid
object represent the same value.

GetGuid(ClrInt32, ClrInt16, Returns a new instance of the Guid by using the specified integers and
ClrInt16, ClrByte, ClrByte, bytes.

ClrByte, ClrByte, ClrByte,

840
.Net Runtime Library for Delphi

Name Description

ClrByte, ClrByte, ClrByte)

GetGuid(ClrInt32, ClrInt16, Returns a new instance of the Guid by using the specified integers and
ClrInt16, TClrByteDynArray) the dynamic byte array.

GetGuid(ClrInt32, ClrInt16, Returns a new instance of the Guid structure by using the specified
ClrInt16, _ByteArray) integers and byte array.

GetGuid(ClrUInt32, Returns a new instance of the Guid structure by using the specified
ClrUInt16, ClrUInt16, unsigned integers and bytes.

ClrByte, ClrByte, ClrByte,


ClrByte, ClrByte, ClrByte,
ClrByte, ClrByte)

GetGuid(ClrWString) Returns a new instance of the Guid structure by using the value
represented by the specified string.

GetGuid(TClrByteDynArray) Returns a new instance of the Guid structure by using the specified
array of bytes.

GetGuid(_ByteArray) Returns a new instance of the Guid structure by using the specified
array of bytes.

GetHashCode(ClrGuid) Returns the hash code for the Clr Guid instance.

GetHashCode(TGuid) Returns the hash code for the TGuid instance

NewGuid Initializes a new instance of the Guid structure.

Parse Converts the string representation of a GUID to the equivalent Guid


structure.

ParseExact Converts the string representation of a GUID to the equivalent Guid


structure, provided that the string is in the specified format.

ToByteArray(ClrGuid) Returns a 16-element byte array that contains the value of the Clr
Guid instance.

ToByteArray(TGuid) Returns a 16-element byte array that contains the value of the TGuid
instance.

ToByteDynArray(ClrGuid) Returns a 16-element dynamic byte array that contains the value of
the Clr Guid instance.

ToByteDynArray(TGuid) Returns a 16-element dynamic byte array that contains the value of

841
.Net Runtime Library for Delphi

Name Description

the TGuid instance.

ToClrGuid Converts TGuid instance to an equivalent value of Clr Guid


structure.

ToGuid Converts Clr Guid instance to an equivalent value of TGuid


record.

ToString(ClrGuid) Returns a string representation of the value of this instance in registry


format.

ToString(ClrGuid, Returns a string representation of the value of this Guid instance,


ClrWString) according to the provided format specifier.

ToString(ClrGuid, Returns a string representation of the value of this instance of the


ClrWString, Guid class, according to the provided format specifier and culture-
specific format information.
IFormatProvider)

ToString(TGuid) Returns a string representation of the value of this instance in registry


format.

ToString(TGuid, ClrWString) Returns a string representation of the value of this Guid instance,
according to the provided format specifier.

ToString(TGuid, ClrWString, Returns a string representation of the value of this instance of the
IFormatProvider) Guid class, according to the provided format specifier and culture-
specific format information.

TryParse Converts the string representation of a GUID to the equivalent Guid


structure.

TryParseExact Converts the string representation of a GUID to the equivalent Guid


structure, provided that the string is in the specified format.

7.1.1.8.1.1.10.1.1 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

Name Description

TClrGuidHelper.CompareTo Compares this instance to a specified clr Guid object and returns an
(ClrGuid, ClrGuid) indication of their relative values.

842
.Net Runtime Library for Delphi

Name Description

TClrGuidHelper.CompareTo Compares this instance to a specified variant and returns an indication


(TGuid, ClrVariant) of their relative values.

TClrGuidHelper.CompareTo Compares this instance to a specified TGuid object and returns an


(TGuid, TGuid) indication of their relative values.

7.1.1.8.1.1.10.1.1 TClrGuidHelper.CompareTo Method (ClrGuid, ClrGuid)


Compares this instance to a specified clr Guid object and returns an indication of their relative values.

Syntax
Delphi

class function CompareTo(X: ClrGuid; Y: ClrGuid): ClrInt32; overload;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.1 TClrGuidHelper.CompareTo Method (TGuid, ClrVariant)


Compares this instance to a specified variant and returns an indication of their relative values.

Syntax
Delphi

class function CompareTo(X: TGuid; Y: ClrVariant): ClrInt32; overload;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.1 TClrGuidHelper.CompareTo Method (TGuid, TGuid)


Compares this instance to a specified TGuid object and returns an indication of their relative values.

Syntax
Delphi

class function CompareTo(X: TGuid; Y: TGuid): ClrInt32; overload;

See Also

843
.Net Runtime Library for Delphi

TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.2 TClrGuidHelper.Empty Method

A read-only instance of the Guid whose value is all zeros.

Syntax
Delphi

class function Empty: TGuid;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.3 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrGuidHelper.Equals Returns a value indicating whether this instance and a specified clr
(ClrGuid, ClrGuid) Guid object represent the same value.

TClrGuidHelper.Equals Returns a value that indicates whether this instance is equal to a


(TGuid, ClrVariant) specified variant.

TClrGuidHelper.Equals Returns a value indicating whether this instance and a specified TGuid
(TGuid, TGuid) object represent the same value.

7.1.1.8.1.1.10.1.3 TClrGuidHelper.Equals Method (ClrGuid, ClrGuid)


Returns a value indicating whether this instance and a specified clr Guid object represent the same value.

Syntax
Delphi

class function Equals(X: ClrGuid; Y: ClrGuid): ClrBoolean; overload;


reintroduce;

See Also

844
.Net Runtime Library for Delphi

TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.3 TClrGuidHelper.Equals Method (TGuid, ClrVariant)


Returns a value that indicates whether this instance is equal to a specified variant.

Syntax
Delphi

class function Equals(X: TGuid; o: ClrVariant): ClrBoolean; overload;


reintroduce;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.3 TClrGuidHelper.Equals Method (TGuid, TGuid)


Returns a value indicating whether this instance and a specified TGuid object represent the same value.

Syntax
Delphi

class function Equals(X: TGuid; Y: TGuid): ClrBoolean; overload;


reintroduce;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.4 GetGuid Method

This is the overview for the GetGuid method overload.

Overload List

Name Description

TClrGuidHelper.GetGuid Returns a new instance of the Guid by using the specified integers and
(ClrInt32, ClrInt16, ClrInt16, bytes.

ClrByte, ClrByte, ClrByte,


ClrByte, ClrByte, ClrByte,
ClrByte, ClrByte)

TClrGuidHelper.GetGuid Returns a new instance of the Guid by using the specified integers and
(ClrInt32, ClrInt16, ClrInt16, the dynamic byte array.

845
.Net Runtime Library for Delphi

Name Description

TClrByteDynArray)

TClrGuidHelper.GetGuid Returns a new instance of the Guid structure by using the specified
(ClrInt32, ClrInt16, ClrInt16, integers and byte array.

_ByteArray)

TClrGuidHelper.GetGuid Returns a new instance of the Guid structure by using the specified
(ClrUInt32, ClrUInt16, unsigned integers and bytes.

ClrUInt16, ClrByte, ClrByte,


ClrByte, ClrByte, ClrByte,
ClrByte, ClrByte, ClrByte)

TClrGuidHelper.GetGuid Returns a new instance of the Guid structure by using the value
(ClrWString) represented by the specified string.

TClrGuidHelper.GetGuid Returns a new instance of the Guid structure by using the specified
(TClrByteDynArray) array of bytes.

TClrGuidHelper.GetGuid Returns a new instance of the Guid structure by using the specified
(_ByteArray) array of bytes.

7.1.1.8.1.1.10.1.4 TClrGuidHelper.GetGuid Method (ClrInt32, ClrInt16, ClrInt16, ClrByte,


ClrByte, ClrByte, ClrByte, ClrByte, ClrByte, ClrByte, ClrByte)
Returns a new instance of the Guid by using the specified integers and bytes.

Syntax
Delphi

class function GetGuid(A: ClrInt32; B: ClrInt16; C: ClrInt16; D:


ClrByte; E: ClrByte; F: ClrByte; G: ClrByte; H: ClrByte;

I: ClrByte; J: ClrByte; K: ClrByte): TGuid; overload;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.4 TClrGuidHelper.GetGuid Method (ClrInt32, ClrInt16, ClrInt16,


TClrByteDynArray)
Returns a new instance of the Guid by using the specified integers and the dynamic byte array.

Syntax

846
.Net Runtime Library for Delphi

Delphi

class function GetGuid(A: ClrInt32; B: ClrInt16; C: ClrInt16; D:


TClrByteDynArray): TGuid; overload;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.4 TClrGuidHelper.GetGuid Method (ClrInt32, ClrInt16, ClrInt16, _ByteArray)


Returns a new instance of the Guid structure by using the specified integers and byte array.

Syntax
Delphi

class function GetGuid(A: ClrInt32; B: ClrInt16; C: ClrInt16; D:


_ByteArray): TGuid; overload;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.4 TClrGuidHelper.GetGuid Method (ClrUInt32, ClrUInt16, ClrUInt16, ClrByte,


ClrByte, ClrByte, ClrByte, ClrByte, ClrByte, ClrByte, ClrByte)
Returns a new instance of the Guid structure by using the specified unsigned integers and bytes.

Syntax
Delphi

class function GetGuid(A: ClrUInt32; B: ClrUInt16; C: ClrUInt16; D:


ClrByte; E: ClrByte; F: ClrByte; G: ClrByte; H: ClrByte;

I: ClrByte; J: ClrByte; K: ClrByte): TGuid; overload;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.4 TClrGuidHelper.GetGuid Method (ClrWString)


Returns a new instance of the Guid structure by using the value represented by the specified string.

Syntax
Delphi

class function GetGuid(G: ClrWString): TGuid; overload;

847
.Net Runtime Library for Delphi

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.4 TClrGuidHelper.GetGuid Method (TClrByteDynArray)


Returns a new instance of the Guid structure by using the specified array of bytes.

Syntax
Delphi

class function GetGuid(B: TClrByteDynArray): TGuid; overload;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.4 TClrGuidHelper.GetGuid Method (_ByteArray)


Returns a new instance of the Guid structure by using the specified array of bytes.

Syntax
Delphi

class function GetGuid(B: _ByteArray): TGuid; overload;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.5 GetHashCode Method

This is the overview for the GetHashCode method overload.

Overload List

Name Description

TClrGuidHelper.GetHashCode Returns the hash code for the Clr Guid instance.
(ClrGuid)

TClrGuidHelper.GetHashCode Returns the hash code for the TGuid instance


(TGuid)

848
.Net Runtime Library for Delphi

7.1.1.8.1.1.10.1.5 TClrGuidHelper.GetHashCode Method (ClrGuid)


Returns the hash code for the Clr Guid instance.

Syntax
Delphi

class function GetHashCode(G: ClrGuid): ClrInt32; overload;


reintroduce;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.5 TClrGuidHelper.GetHashCode Method (TGuid)


Returns the hash code for the TGuid instance

Syntax
Delphi

class function GetHashCode(G: TGuid): ClrInt32; overload; reintroduce;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.6 TClrGuidHelper.NewGuid Method

Initializes a new instance of the Guid structure.

Syntax
Delphi

class function NewGuid: TGuid;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.7 TClrGuidHelper.Parse Method

Converts the string representation of a GUID to the equivalent Guid structure.

Syntax
Delphi

849
.Net Runtime Library for Delphi

class function Parse(AInput: ClrWString): TGuid;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.8 TClrGuidHelper.ParseExact Method

Converts the string representation of a GUID to the equivalent Guid structure, provided that the string is in the specified
format.

Syntax
Delphi

class function ParseExact(AInput: ClrWString; AFormat: ClrWString):


TGuid;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.9 ToByteArray Method

This is the overview for the ToByteArray method overload.

Overload List

Name Description

TClrGuidHelper.ToByteArray Returns a 16-element byte array that contains the value of the Clr
(ClrGuid) Guid instance.

TClrGuidHelper.ToByteArray Returns a 16-element byte array that contains the value of the TGuid
(TGuid) instance.

7.1.1.8.1.1.10.1.9 TClrGuidHelper.ToByteArray Method (ClrGuid)


Returns a 16-element byte array that contains the value of the Clr Guid instance.

Syntax
Delphi

class function ToByteArray(G: ClrGuid): _ByteArray; overload;

See Also

850
.Net Runtime Library for Delphi

TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.9 TClrGuidHelper.ToByteArray Method (TGuid)


Returns a 16-element byte array that contains the value of the TGuid instance.

Syntax
Delphi

class function ToByteArray(G: TGuid): _ByteArray; overload;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.10 ToByteDynArray Method

This is the overview for the ToByteDynArray method overload.

Overload List

Name Description

TClrGuidHelper.ToByteDynArray Returns a 16-element dynamic byte array that contains the value of
(ClrGuid) the Clr Guid instance.

TClrGuidHelper.ToByteDynArray Returns a 16-element dynamic byte array that contains the value of
(TGuid) the TGuid instance.

7.1.1.8.1.1.10.1.10 TClrGuidHelper.ToByteDynArray Method (ClrGuid)


Returns a 16-element dynamic byte array that contains the value of the Clr Guid instance.

Syntax
Delphi

class function ToByteDynArray(G: ClrGuid): TClrByteDynArray; overload;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.10 TClrGuidHelper.ToByteDynArray Method (TGuid)


Returns a 16-element dynamic byte array that contains the value of the TGuid instance.

851
.Net Runtime Library for Delphi

Syntax
Delphi

class function ToByteDynArray(G: TGuid): TClrByteDynArray; overload;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.11 TClrGuidHelper.ToClrGuid Method

Converts TGuid instance to an equivalent value of Clr Guid structure.

Syntax
Delphi

class function ToClrGuid(G: TGuid): ClrGuid;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.12 TClrGuidHelper.ToGuid Method

Converts Clr Guid instance to an equivalent value of TGuid record.

Syntax
Delphi

class function ToGuid(G: ClrGuid): TGuid;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.13 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrGuidHelper.ToString Returns a string representation of the value of this instance in registry


format.

852
.Net Runtime Library for Delphi

Name Description

(ClrGuid)

TClrGuidHelper.ToString Returns a string representation of the value of this Guid instance,


(ClrGuid, ClrWString) according to the provided format specifier.

TClrGuidHelper.ToString Returns a string representation of the value of this instance of the


(ClrGuid, ClrWString, Guid class, according to the provided format specifier and culture-

IFormatProvider) specific format information.

TClrGuidHelper.ToString Returns a string representation of the value of this instance in registry


(TGuid) format.

TClrGuidHelper.ToString Returns a string representation of the value of this Guid instance,


(TGuid, ClrWString) according to the provided format specifier.

TClrGuidHelper.ToString Returns a string representation of the value of this instance of the


(TGuid, ClrWString, Guid class, according to the provided format specifier and culture-
specific format information.
IFormatProvider)

7.1.1.8.1.1.10.1.13 TClrGuidHelper.ToString Method (ClrGuid)


Returns a string representation of the value of this instance in registry format.

Syntax
Delphi

class function ToString(G: ClrGuid): ClrWString; overload;


reintroduce;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.13 TClrGuidHelper.ToString Method (ClrGuid, ClrWString)

Returns a string representation of the value of this Guid instance, according to the provided format specifier.

Syntax
Delphi

class function ToString(G: ClrGuid; AFormat: ClrWString): ClrWString;


overload; reintroduce;

853
.Net Runtime Library for Delphi

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.13 TClrGuidHelper.ToString Method (ClrGuid, ClrWString, IFormatProvider)

Returns a string representation of the value of this instance of the Guid class, according to the provided format
specifier and culture-specific format information.

Syntax
Delphi

class function ToString(G: ClrGuid; AFormat: ClrWString; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.13 TClrGuidHelper.ToString Method (TGuid)


Returns a string representation of the value of this instance in registry format.

Syntax
Delphi

class function ToString(G: TGuid): ClrWString; overload; reintroduce;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.13 TClrGuidHelper.ToString Method (TGuid, ClrWString)


Returns a string representation of the value of this Guid instance, according to the provided format specifier.

Syntax
Delphi

class function ToString(G: TGuid; AFormat: ClrWString): ClrWString;


overload; reintroduce;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

854
.Net Runtime Library for Delphi

7.1.1.8.1.1.10.1.13 TClrGuidHelper.ToString Method (TGuid, ClrWString, IFormatProvider)


Returns a string representation of the value of this instance of the Guid class, according to the provided format specifier
and culture-specific format information.

Syntax
Delphi

class function ToString(G: TGuid; AFormat: ClrWString; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.14 TClrGuidHelper.TryParse Method

Converts the string representation of a GUID to the equivalent Guid structure.

Syntax
Delphi

class function TryParse(AInput: ClrWString; var AResult: ClrGuid):


ClrBoolean;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.10.1.15 TClrGuidHelper.TryParseExact Method

Converts the string representation of a GUID to the equivalent Guid structure, provided that the string is in the specified
format.

Syntax
Delphi

class function TryParseExact(AInput: ClrWString; AFormat: ClrWString;


var AResult: TGuid): ClrBoolean;

See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11 TClrInt16Helper Class


Collapse All Expand All

855
.Net Runtime Library for Delphi

Helper class for SmallInt Data Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrInt16Helper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrInt16Helper = class;

Methods

Name Description

CompareTo(ClrInt16, Compares this instance to a specified 16-bit signed integer and


ClrInt16) returns an integer that indicates whether the value of this instance is
less than, equal to, or greater than the value of the specified 16-bit
signed integer.

CompareTo(ClrInt16, Compares this instance to a specified object and returns an integer


ClrVariant) that indicates whether the value of this instance is less than, equal to,
or greater than the value of the variant.

Equals(ClrInt16, ClrInt16) Returns a value indicating whether this instance is equal to a specified
Int16 value.

Equals(ClrInt16, ClrVariant) Returns a value indicating whether this instance is equal to a specified
variant.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of an Int16.

MinValue Represents the smallest possible value of Int16.

Parse(ClrWString) Converts the string representation of a number to its 16-bit signed


integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its 16-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its 16-bit signed integer equivalent.

856
.Net Runtime Library for Delphi

Name Description

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 16-bit signed integer equivalent.

IFormatProvider)

ToString(ClrInt16) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrInt16, Converts the numeric value of this instance to its equivalent string
ClrWString) representation, using the specified format.

ToString(ClrInt16, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific
formatting information.
IFormatProvider)

ToString(ClrInt16, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Converts the string representation of a number to its 16-bit signed


ClrInt16) integer equivalent. A return value indicates whether the conversion
succeeded or failed.

TryParse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 16-bit signed integer equivalent. A return
value indicates whether the conversion succeeded or failed.
IFormatProvider, ClrInt16)

See Also
TClrInt16Helper Methods

7.1.1.8.1.1.11.1 TClrInt16Helper Methods

The methods of the TClrInt16Helper class are listed here.

Methods

Name Description

CompareTo(ClrInt16, Compares this instance to a specified 16-bit signed integer and


ClrInt16) returns an integer that indicates whether the value of this instance is
less than, equal to, or greater than the value of the specified 16-bit
signed integer.

CompareTo(ClrInt16, Compares this instance to a specified object and returns an integer


ClrVariant) that indicates whether the value of this instance is less than, equal to,
or greater than the value of the variant.

857
.Net Runtime Library for Delphi

Name Description

Equals(ClrInt16, ClrInt16) Returns a value indicating whether this instance is equal to a specified
Int16 value.

Equals(ClrInt16, ClrVariant) Returns a value indicating whether this instance is equal to a


specified variant.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of an Int16 .

MinValue Represents the smallest possible value of Int16 .

Parse(ClrWString) Converts the string representation of a number to its 16-bit signed


integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its 16-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its 16-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 16-bit signed integer equivalent.

IFormatProvider)

ToString(ClrInt16) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrInt16, Converts the numeric value of this instance to its equivalent string
ClrWString) representation, using the specified format.

ToString(ClrInt16, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific
formatting information.
IFormatProvider)

ToString(ClrInt16, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Converts the string representation of a number to its 16-bit signed


ClrInt16) integer equivalent. A return value indicates whether the conversion
succeeded or failed.

TryParse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 16-bit signed integer equivalent. A return

858
.Net Runtime Library for Delphi

Name Description

IFormatProvider, ClrInt16) value indicates whether the conversion succeeded or failed.

7.1.1.8.1.1.11.1.1 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

Name Description

TClrInt16Helper.CompareTo Compares this instance to a specified 16-bit signed integer and


(ClrInt16, ClrInt16) returns an integer that indicates whether the value of this instance is
less than, equal to, or greater than the value of the specified 16-bit
signed integer.

TClrInt16Helper.CompareTo Compares this instance to a specified object and returns an integer


(ClrInt16, ClrVariant) that indicates whether the value of this instance is less than, equal to,
or greater than the value of the object.

7.1.1.8.1.1.11.1.1 TClrInt16Helper.CompareTo Method (ClrInt16, ClrInt16)


Compares this instance to a specified 16-bit signed integer and returns an integer that indicates whether the value of
this instance is less than, equal to, or greater than the value of the specified 16-bit signed integer.

Syntax
Delphi

class function CompareTo(X: ClrInt16; Y: ClrInt16): ClrInt32;


overload;

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.1 TClrInt16Helper.CompareTo Method (ClrInt16, ClrVariant)


Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is
less than, equal to, or greater than the value of the object.

Syntax
Delphi

class function CompareTo(I16: ClrInt16; AValue: ClrVariant): ClrInt32;


overload;

859
.Net Runtime Library for Delphi

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.2 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrInt16Helper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrInt16, ClrInt16) Int16 value.

TClrInt16Helper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrInt16, ClrVariant) variant.

7.1.1.8.1.1.11.1.2 TClrInt16Helper.Equals Method (ClrInt16, ClrInt16)


Returns a value indicating whether this instance is equal to a specified Int16 value.

Syntax
Delphi

class function Equals(X: ClrInt16; Y: ClrInt16): ClrBoolean; overload;


reintroduce;

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.2 TClrInt16Helper.Equals Method (ClrInt16, ClrVariant)


Returns a value indicating whether this instance is equal to a specified variant.

Syntax
Delphi

class function Equals(I16: ClrInt16; AObj: ClrVariant): ClrBoolean;


overload; reintroduce;

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

860
.Net Runtime Library for Delphi

7.1.1.8.1.1.11.1.3 TClrInt16Helper.GetHashCode Method

Returns the hash code for this instance.

Syntax
Delphi

class function GetHashCode(I16: ClrInt16): ClrInt32; reintroduce;

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.4 TClrInt16Helper.MaxValue Method

This is MaxValue, a member of class TClrInt16Helper.

Syntax
Delphi

class function MaxValue: ClrInt16;

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.5 TClrInt16Helper.MinValue Method

This is MinValue, a member of class TClrInt16Helper.

Syntax
Delphi

class function MinValue: ClrInt16;

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.6 Parse Method

This is the overview for the Parse method overload.

Overload List

861
.Net Runtime Library for Delphi

Name Description

TClrInt16Helper.Parse Converts the string representation of a number to its 16-bit signed


(ClrWString) integer equivalent.

TClrInt16Helper.Parse Converts the string representation of a number in a specified culture-


(ClrWString, specific format to its 16-bit signed integer equivalent.

IFormatProvider)

TClrInt16Helper.Parse Converts the string representation of a number in a specified style to


(ClrWString, TNumberStyles) its 16-bit signed integer equivalent.

TClrInt16Helper.Parse Converts the string representation of a number in a specified style and


(ClrWString, TNumberStyles, culture-specific format to its 16-bit signed integer equivalent.

IFormatProvider)

7.1.1.8.1.1.11.1.6 TClrInt16Helper.Parse Method (ClrWString)


Converts the string representation of a number to its 16-bit signed integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString): ClrInt16; overload;

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.6 TClrInt16Helper.Parse Method (ClrWString, IFormatProvider)


Converts the string representation of a number in a specified culture-specific format to its 16-bit signed integer
equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AProvider: IFormatProvider):


ClrInt16; overload;

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.6 TClrInt16Helper.Parse Method (ClrWString, TNumberStyles)

862
.Net Runtime Library for Delphi

Converts the string representation of a number in a specified style to its 16-bit signed integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles): ClrInt16;


overload;

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.6 TClrInt16Helper.Parse Method (ClrWString, TNumberStyles,


IFormatProvider)
Converts the string representation of a number in a specified style and culture-specific format to its 16-bit signed
integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles; AProvider:


IFormatProvider): ClrInt16; overload;

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.7 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrInt16Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt16) representation.

TClrInt16Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt16, ClrWString) representation, using the specified format.

TClrInt16Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt16, ClrWString, representation using the specified format and culture-specific
formatting information.
IFormatProvider)

863
.Net Runtime Library for Delphi

Name Description

TClrInt16Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt16, IFormatProvider) representation using the specified culture-specific format information.

7.1.1.8.1.1.11.1.7 TClrInt16Helper.ToString Method (ClrInt16)


Converts the numeric value of this instance to its equivalent string representation.

Syntax
Delphi

class function ToString(I16: ClrInt16): ClrWString; overload;


reintroduce;

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.7 TClrInt16Helper.ToString Method (ClrInt16, ClrWString)


Converts the numeric value of this instance to its equivalent string representation, using the specified format.

Syntax
Delphi

class function ToString(I16: ClrInt16; AFormat: ClrWString):


ClrWString; overload; reintroduce;

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.7 TClrInt16Helper.ToString Method (ClrInt16, ClrWString, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified format and
culture-specific formatting information.

Syntax
Delphi

class function ToString(I16: ClrInt16; AFormat: ClrWString; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also

864
.Net Runtime Library for Delphi

TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.7 TClrInt16Helper.ToString Method (ClrInt16, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific
format information.

Syntax
Delphi

class function ToString(I16: ClrInt16; AProvider: IFormatProvider):


ClrWString; overload; reintroduce;

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.8 TryParse Method

This is the overview for the TryParse method overload.

Overload List

Name Description

TClrInt16Helper.TryParse Converts the string representation of a number to its 16-bit signed


(ClrWString, ClrInt16) integer equivalent. A return value indicates whether the conversion
succeeded or failed.

TClrInt16Helper.TryParse This is TryParse, a member of class TClrInt16Helper.


(ClrWString, TNumberStyles,
IFormatProvider, ClrInt16)

7.1.1.8.1.1.11.1.8 TClrInt16Helper.TryParse Method (ClrWString, ClrInt16)


Converts the string representation of a number to its 16-bit signed integer equivalent. A return value indicates whether
the conversion succeeded or failed.

Syntax
Delphi

class function TryParse(S: ClrWString; var AResult: ClrInt16):


ClrBoolean; overload;

See Also

865
.Net Runtime Library for Delphi

TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.11.1.8 TClrInt16Helper.TryParse Method (ClrWString, TNumberStyles,


IFormatProvider, ClrInt16)
Converts the string representation of a number in a specified style and culture-specific format to its 16-bit signed
integer equivalent. A return value indicates whether the conversion succeeded or failed.

Syntax
Delphi

class function TryParse(S: ClrWString; AStyle: TNumberStyles;


AProvider: IFormatProvider;

var AResult:ClrInt16): ClrBoolean; overload;

See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12 TClrInt32Helper Class


Collapse All Expand All

Helper class for Integer Data Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrInt32Helper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrInt32Helper = class;

Methods

Name Description

CompareTo(ClrInt32, Compares this instance to a specified 32-bit signed integer and


ClrInt32) returns an indication of their relative values.

CompareTo(ClrInt32, Compares this instance to a specified variant and returns an indication


of their relative values.

866
.Net Runtime Library for Delphi

Name Description

ClrVariant)

Equals(ClrInt32, ClrInt32) Returns a value indicating whether this instance is equal to a specified
Int32 value.

Equals(ClrInt32, ClrVariant) Returns a value indicating whether this instance is equal to a specified
variant.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of an Int32.

MinValue Represents the smallest possible value of Int32.

Parse(ClrWString) Converts the string representation of a number to its 32-bit signed


integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its 32-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its 32-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 32-bit signed integer equivalent.

IFormatProvider)

ToString(ClrInt32) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrInt32, Converts the numeric value of this instance to its equivalent string
ClrWString) representation, using the specified format.

ToString(ClrInt32, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

ToString(ClrInt32, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Converts the string representation of a number to its 32-bit signed


ClrInt32) integer equivalent. A return value indicates whether the conversion
succeeded.

867
.Net Runtime Library for Delphi

Name Description

TryParse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 32-bit signed integer equivalent. A return
value indicates whether the conversion succeeded.
IFormatProvider, ClrInt32)

See Also
TClrInt32Helper Methods

7.1.1.8.1.1.12.1 TClrInt32Helper Methods

The methods of the TClrInt32Helper class are listed here.

Methods

Name Description

CompareTo(ClrInt32, Compares this instance to a specified 32-bit signed integer and


ClrInt32) returns an indication of their relative values.

CompareTo(ClrInt32, Compares this instance to a specified variant and returns an indication


ClrVariant) of their relative values.

Equals(ClrInt32, ClrInt32) Returns a value indicating whether this instance is equal to a specified
Int32 value.

Equals(ClrInt32, ClrVariant) Returns a value indicating whether this instance is equal to a


specified variant.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of an Int32 .

MinValue Represents the smallest possible value of Int32 .

Parse(ClrWString) Converts the string representation of a number to its 32-bit signed


integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its 32-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its 32-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles,

868
.Net Runtime Library for Delphi

Name Description

IFormatProvider) culture-specific format to its 32-bit signed integer equivalent.

ToString(ClrInt32) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrInt32, Converts the numeric value of this instance to its equivalent string
ClrWString) representation, using the specified format.

ToString(ClrInt32, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

ToString(ClrInt32, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Converts the string representation of a number to its 32-bit signed


ClrInt32) integer equivalent. A return value indicates whether the conversion
succeeded.

TryParse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 32-bit signed integer equivalent. A return
value indicates whether the conversion succeeded.
IFormatProvider, ClrInt32)

7.1.1.8.1.1.12.1.1 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

Name Description

TClrInt32Helper.CompareTo Compares this instance to a specified 32-bit signed integer and


(ClrInt32, ClrInt32) returns an indication of their relative values.

TClrInt32Helper.CompareTo Compares this instance to a specified variant and returns an indication


(ClrInt32, ClrVariant) of their relative values.

7.1.1.8.1.1.12.1.1 TClrInt32Helper.CompareTo Method (ClrInt32, ClrInt32)


Compares this instance to a specified 32-bit signed integer and returns an indication of their relative values.

Syntax

869
.Net Runtime Library for Delphi

Delphi

class function CompareTo(X: ClrInt32; Y: ClrInt32): ClrInt32;


overload;

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12.1.1 TClrInt32Helper.CompareTo Method (ClrInt32, ClrVariant)


Compares this instance to a specified variant and returns an indication of their relative values.

Syntax
Delphi

class function CompareTo(I32: ClrInt32; AValue: ClrVariant): ClrInt32;


overload;

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12.1.2 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrInt32Helper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrInt32, ClrInt32) Int32 value.

TClrInt32Helper.Equals Returns a value indicating whether this instance is equal to a


(ClrInt32, ClrVariant) specified variant.

7.1.1.8.1.1.12.1.2 TClrInt32Helper.Equals Method (ClrInt32, ClrInt32)


Returns a value indicating whether this instance is equal to a specified Int32 value.

Syntax
Delphi

class function Equals(X: ClrInt32; Y: ClrInt32): ClrBoolean; overload;


reintroduce;

870
.Net Runtime Library for Delphi

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12.1.2 TClrInt32Helper.Equals Method (ClrInt32, ClrVariant)

Returns a value indicating whether this instance is equal to a specified variant.

Syntax
Delphi

class function Equals(I32: ClrInt32; AObj: ClrVariant): ClrBoolean;


overload; reintroduce;

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12.1.3 TClrInt32Helper.GetHashCode Method

Returns the hash code for this instance.

Syntax
Delphi

class function GetHashCode(I32: ClrInt32): ClrInt32; reintroduce;

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12.1.4 TClrInt32Helper.MaxValue Method

Represents the largest possible value of an Int32.

Syntax
Delphi

class function MaxValue: ClrInt32;

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

871
.Net Runtime Library for Delphi

7.1.1.8.1.1.12.1.5 TClrInt32Helper.MinValue Method

Represents the smallest possible value of Int32.

Syntax
Delphi

class function MinValue: ClrInt32;

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12.1.6 Parse Method

This is the overview for the Parse method overload.

Overload List

Name Description

TClrInt32Helper.Parse Converts the string representation of a number to its 32-bit signed


(ClrWString) integer equivalent.

TClrInt32Helper.Parse Converts the string representation of a number in a specified culture-


(ClrWString, specific format to its 32-bit signed integer equivalent.

IFormatProvider)

TClrInt32Helper.Parse Converts the string representation of a number in a specified style to


(ClrWString, TNumberStyles) its 32-bit signed integer equivalent.

TClrInt32Helper.Parse Converts the string representation of a number in a specified style and


(ClrWString, TNumberStyles, culture-specific format to its 32-bit signed integer equivalent.

IFormatProvider)

7.1.1.8.1.1.12.1.6 TClrInt32Helper.Parse Method (ClrWString)


Converts the string representation of a number to its 32-bit signed integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString): ClrInt32; overload;

See Also

872
.Net Runtime Library for Delphi

TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12.1.6 TClrInt32Helper.Parse Method (ClrWString, IFormatProvider)


Converts the string representation of a number in a specified culture-specific format to its 32-bit signed integer
equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AProvider: IFormatProvider):


ClrInt32; overload;

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12.1.6 TClrInt32Helper.Parse Method (ClrWString, TNumberStyles)


Converts the string representation of a number in a specified style to its 32-bit signed integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles): ClrInt32;


overload;

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12.1.6 TClrInt32Helper.Parse Method (ClrWString, TNumberStyles,


IFormatProvider)
Converts the string representation of a number in a specified style and culture-specific format to its 32-bit signed
integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles; AProvider:


IFormatProvider): ClrInt32; overload;

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

873
.Net Runtime Library for Delphi

7.1.1.8.1.1.12.1.7 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrInt32Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt32) representation.

TClrInt32Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt32, ClrWString) representation, using the specified format.

TClrInt32Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt32, ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

TClrInt32Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt32, IFormatProvider) representation using the specified culture-specific format information.

7.1.1.8.1.1.12.1.7 TClrInt32Helper.ToString Method (ClrInt32)

This is ToString, a member of class TClrInt32Helper.

Syntax
Delphi

class function ToString(I32: ClrInt32): ClrWString; overload;


reintroduce;

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12.1.7 TClrInt32Helper.ToString Method (ClrInt32, ClrWString)


Converts the numeric value of this instance to its equivalent string representation, using the specified format.

Syntax
Delphi

class function ToString(I32: ClrInt32; AFormat: ClrWString):


ClrWString; overload; reintroduce;

See Also

874
.Net Runtime Library for Delphi

TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12.1.7 TClrInt32Helper.ToString Method (ClrInt32, ClrWString, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified format and
culture-specific format information.

Syntax
Delphi

class function ToString(I32: ClrInt32; AFormat: ClrWString; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12.1.7 TClrInt32Helper.ToString Method (ClrInt32, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific
format information.

Syntax
Delphi

class function ToString(I32: ClrInt32; AProvider: IFormatProvider):


ClrWString; overload; reintroduce;

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12.1.8 TryParse Method

This is the overview for the TryParse method overload.

Overload List

Name Description

TClrInt32Helper.TryParse Converts the string representation of a number to its 32-bit signed


(ClrWString, ClrInt32) integer equivalent. A return value indicates whether the conversion
succeeded.

TClrInt32Helper.TryParse Converts the string representation of a number in a specified style and


(ClrWString, TNumberStyles, culture-specific format to its 32-bit signed integer equivalent. A return
value indicates whether the conversion succeeded.

875
.Net Runtime Library for Delphi

Name Description

IFormatProvider, ClrInt32)

7.1.1.8.1.1.12.1.8 TClrInt32Helper.TryParse Method (ClrWString, ClrInt32)


Converts the string representation of a number to its 32-bit signed integer equivalent. A return value indicates whether
the conversion succeeded.

Syntax
Delphi

class function TryParse(S: ClrWString; var AResult: ClrInt32):


ClrBoolean; overload;

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.12.1.8 TClrInt32Helper.TryParse Method (ClrWString, TNumberStyles,


IFormatProvider, ClrInt32)
Converts the string representation of a number in a specified style and culture-specific format to its 32-bit signed
integer equivalent. A return value indicates whether the conversion succeeded.

Syntax
Delphi

class function TryParse(S: ClrWString; AStyle: TNumberStyles;


AProvider: IFormatProvider; var AResult: ClrInt32): ClrBoolean;
overload;

See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.13 TClrIntPtrHelper Class


Collapse All Expand All

Helper class for managed pointer interface type called _IntPtr.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrIntPtrHelper

File: CNClrLib.Host.Helper.pas

876
.Net Runtime Library for Delphi

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrIntPtrHelper = class;

Methods

Name Description

Add Adds an offset to the value of a pointer.

Equals Returns a value indicating whether this instance is equal to a specified


variant.

GetHashCode Returns the hash code for this instance.

GetIntPtr(ClrInt32) Returns a new instance of IntPtr using the specified 32-bit pointer or
handle.

GetIntPtr(ClrInt64) Returns a new instance of IntPtr using the specified 64-bit pointer.

GetIntPtr(ClrVariant) Returns a new instance of IntPtr using the specified variant pointer.

GetIntPtr(_IntPtr) Returns a new instance of IntPtr using the specified managed pointer.

Size Gets the size of this instance.

Subtract Subtracts an offset from the value of a pointer.

ToInt32 Converts the value of this instance to a 32-bit signed integer.

ToInt64 Converts the value of this instance to a 64-bit signed integer.

ToString(_IntPtr) Converts the numeric value of the current IntPtr object to its
equivalent string representation.

ToString(_IntPtr, ClrWString) Converts the numeric value of the current IntPtr object to its
equivalent string representation.

Zero Represents a pointer or handle that has been initialized to zero.

See Also
TClrIntPtrHelper Methods

877
.Net Runtime Library for Delphi

7.1.1.8.1.1.13.1 TClrIntPtrHelper Methods

The methods of the TClrIntPtrHelper class are listed here.

Methods

Name Description

Add Adds an offset to the value of a pointer.

Equals Returns a value indicating whether this instance is equal to a specified


variant.

GetHashCode Returns the hash code for this instance.

GetIntPtr(ClrInt32) Returns a new instance of IntPtr using the specified 32-bit pointer or
handle.

GetIntPtr(ClrInt64) Returns a new instance of IntPtr using the specified 64-bit pointer.

GetIntPtr(ClrVariant) Returns a new instance of IntPtr using the specified variant pointer.

GetIntPtr(_IntPtr) Returns a new instance of IntPtr using the specified managed pointer.

Size Gets the size of this instance.

Subtract Subtracts an offset from the value of a pointer.

ToInt32 Converts the value of this instance to a 32-bit signed integer.

ToInt64 Converts the value of this instance to a 64-bit signed integer.

ToString(_IntPtr) Converts the numeric value of the current IntPtr object to its
equivalent string representation.

ToString(_IntPtr, ClrWString) Converts the numeric value of the current IntPtr object to its
equivalent string representation.

Zero Represents a pointer or handle that has been initialized to zero.

7.1.1.8.1.1.13.1.1 TClrIntPtrHelper.Add Method

Adds an offset to the value of a pointer.

Syntax

878
.Net Runtime Library for Delphi

Delphi

class function Add(Pointer: _IntPtr; AOffset: ClrInt32): _IntPtr;

See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.13.1.2 TClrIntPtrHelper.Equals Method

Returns a value indicating whether this instance is equal to a specified variant.

Syntax
Delphi

class function Equals(P: _IntPtr; AObj: ClrVariant): ClrBoolean;


reintroduce;

See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.13.1.3 TClrIntPtrHelper.GetHashCode Method

Returns the hash code for this instance.

Syntax
Delphi

class function GetHashCode(P: _IntPtr): ClrInt32; reintroduce;

See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.13.1.4 GetIntPtr Method

This is the overview for the GetIntPtr method overload.

Overload List

Name Description

TClrIntPtrHelper.GetIntPtr Returns a new instance of IntPtr using the specified 32-bit pointer or
(ClrInt32) handle.

879
.Net Runtime Library for Delphi

Name Description

TClrIntPtrHelper.GetIntPtr Returns a new instance of IntPtr using the specified 64-bit pointer.
(ClrInt64)

TClrIntPtrHelper.GetIntPtr Returns a new instance of IntPtr using the specified variant pointer.
(ClrVariant)

TClrIntPtrHelper.GetIntPtr Returns a new instance of IntPtr using the specified managed pointer.
(_IntPtr)

7.1.1.8.1.1.13.1.4 TClrIntPtrHelper.GetIntPtr Method (ClrInt32)


Returns a new instance of IntPtr using the specified 32-bit pointer or handle.

Syntax
Delphi

class function GetIntPtr(AValue: ClrInt32): _IntPtr; overload;

See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.13.1.4 TClrIntPtrHelper.GetIntPtr Method (ClrInt64)


Returns a new instance of IntPtr using the specified 64-bit pointer.

Syntax
Delphi

class function GetIntPtr(AValue: ClrInt64): _IntPtr; overload;

See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.13.1.4 TClrIntPtrHelper.GetIntPtr Method (ClrVariant)


Returns a new instance of IntPtr using the specified variant pointer.

Syntax
Delphi

class function GetIntPtr(AValue: ClrVariant): _IntPtr; overload;

880
.Net Runtime Library for Delphi

See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.13.1.4 TClrIntPtrHelper.GetIntPtr Method (_IntPtr)


Returns a new instance of IntPtr using the specified managed pointer.

Syntax
Delphi

class function GetIntPtr(AIntPtr: _IntPtr): _IntPtr; overload;

See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.13.1.5 TClrIntPtrHelper.Size Method

Gets the size of this instance.

Syntax
Delphi

class function Size: ClrInt32;

See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.13.1.6 TClrIntPtrHelper.Subtract Method

Subtracts an offset from the value of a pointer.

Syntax
Delphi

class function Subtract(P: _IntPtr; AOffset: ClrInt32): _IntPtr;

See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.13.1.7 TClrIntPtrHelper.ToInt32 Method

Converts the value of this instance to a 32-bit signed integer.

881
.Net Runtime Library for Delphi

Syntax
Delphi

class function ToInt32(P: _IntPtr): ClrInt32;

See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.13.1.8 TClrIntPtrHelper.ToInt64 Method

Converts the value of this instance to a 64-bit signed integer.

Syntax
Delphi

class function ToInt64(P: _IntPtr): ClrInt64;

See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.13.1.9 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrIntPtrHelper.ToString Converts the numeric value of the current IntPtr object to its
(_IntPtr) equivalent string representation.

TClrIntPtrHelper.ToString Converts the numeric value of the current IntPtr object to its
(_IntPtr, ClrWString) equivalent string representation.

7.1.1.8.1.1.13.1.9 TClrIntPtrHelper.ToString Method (_IntPtr)


Converts the numeric value of the current IntPtr object to its equivalent string representation.

Syntax
Delphi

class function ToString(P: _IntPtr): ClrWString; overload;


reintroduce;

882
.Net Runtime Library for Delphi

See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.13.1.9 TClrIntPtrHelper.ToString Method (_IntPtr, ClrWString)


Converts the numeric value of the current IntPtr object to its equivalent string representation.

Syntax
Delphi

class function ToString(P: _IntPtr; AFormat: ClrWString): ClrWString;


overload; reintroduce;

See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.13.1.10 TClrIntPtrHelper.Zero Method

Represents a pointer or handle that has been initialized to zero.

Syntax
Delphi

class function Zero: _IntPtr;

See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14 TClrSByteHelper Class


Collapse All Expand All

Helper class for ShortInt Data Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrSByteHelper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

883
.Net Runtime Library for Delphi

TClrSByteHelper = class;

Methods

Name Description

CompareTo(ClrSByte, Compares this instance to a specified 8-bit signed integer and returns
ClrSByte) an indication of their relative values.

CompareTo(ClrSByte, Compares this instance to a specified variant and returns an indication


ClrVariant) of their relative values.

Equals(ClrSByte, ClrSByte) Returns a value indicating whether this instance is equal to a specified
SByte value.

Equals(ClrSByte, ClrVariant) Returns a value indicating whether this instance is equal to a specified
variant.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of SByte.

MinValue Represents the smallest possible value of SByte.

Parse(ClrWString) Converts the string representation of a number to its 8-bit signed


integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its 8-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its 8-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number that is in a specified


TNumberStyles, style and culture-specific format to its 8-bit signed equivalent.

IFormatProvider)

ToString(ClrSByte) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrSByte, Converts the numeric value of this instance to its equivalent string
ClrWString) representation, using the specified format.

ToString(ClrSByte, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

884
.Net Runtime Library for Delphi

Name Description

ToString(ClrSByte, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Tries to convert the string representation of a number to its SByte


ClrSByte) equivalent, and returns a value that indicates whether the conversion
succeeded.

TryParse(ClrWString, Tries to convert the string representation of a number in a specified


TNumberStyles, style and culture-specific format to its SByte equivalent, and returns a
value that indicates whether the conversion succeeded.
IFormatProvider, ClrSByte)

See Also
TClrSByteHelper Methods

7.1.1.8.1.1.14.1 TClrSByteHelper Methods

The methods of the TClrSByteHelper class are listed here.

Methods

Name Description

CompareTo(ClrSByte, Compares this instance to a specified 8-bit signed integer and returns
ClrSByte) an indication of their relative values.

CompareTo(ClrSByte, Compares this instance to a specified variant and returns an indication


ClrVariant) of their relative values.

Equals(ClrSByte, ClrSByte) Returns a value indicating whether this instance is equal to a specified
SByte value.

Equals(ClrSByte, ClrVariant) Returns a value indicating whether this instance is equal to a


specified variant.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of SByte .

MinValue Represents the smallest possible value of SByte .

Parse(ClrWString) Converts the string representation of a number to its 8-bit signed


integer equivalent.

885
.Net Runtime Library for Delphi

Name Description

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its 8-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its 8-bit signed integer equivalent.

Parse(ClrWString, Converts the string representation of a number that is in a specified


TNumberStyles, style and culture-specific format to its 8-bit signed equivalent.

IFormatProvider)

ToString(ClrSByte) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrSByte, Converts the numeric value of this instance to its equivalent string
ClrWString) representation, using the specified format.

ToString(ClrSByte, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

ToString(ClrSByte, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Tries to convert the string representation of a number to its SByte


ClrSByte) equivalent, and returns a value that indicates whether the conversion
succeeded.

TryParse(ClrWString, Tries to convert the string representation of a number in a specified


TNumberStyles, style and culture-specific format to its SByte equivalent, and returns a
value that indicates whether the conversion succeeded.
IFormatProvider, ClrSByte)

7.1.1.8.1.1.14.1.1 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

Name Description

TClrSByteHelper.CompareTo Compares this instance to a specified 8-bit signed integer and returns
(ClrSByte, ClrSByte) an indication of their relative values.

TClrSByteHelper.CompareTo Compares this instance to a specified variant and returns an indication

886
.Net Runtime Library for Delphi

Name Description

(ClrSByte, ClrVariant) of their relative values.

7.1.1.8.1.1.14.1.1 TClrSByteHelper.CompareTo Method (ClrSByte, ClrSByte)


Compares this instance to a specified 8-bit signed integer and returns an indication of their relative values.

Syntax
Delphi

class function CompareTo(B: ClrSByte; AValue: ClrSByte): ClrInt32;


overload;

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14.1.1 TClrSByteHelper.CompareTo Method (ClrSByte, ClrVariant)


Compares this instance to a specified variant and returns an indication of their relative values.

Syntax
Delphi

class function CompareTo(B: ClrSByte; AValue: ClrVariant): ClrInt32;


overload;

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14.1.2 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrSByteHelper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrSByte, ClrSByte) SByte value.

TClrSByteHelper.Equals Returns a value indicating whether this instance is equal to a

887
.Net Runtime Library for Delphi

Name Description

(ClrSByte, ClrVariant) specified variant.

7.1.1.8.1.1.14.1.2 TClrSByteHelper.Equals Method (ClrSByte, ClrSByte)


Returns a value indicating whether this instance is equal to a specified SByte value.

Syntax
Delphi

class function Equals(B: ClrSByte; AObj: ClrSByte): ClrBoolean;


overload; reintroduce;

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14.1.2 TClrSByteHelper.Equals Method (ClrSByte, ClrVariant)

Returns a value indicating whether this instance is equal to a specified variant.

Syntax
Delphi

class function Equals(B: ClrSByte; AObj: ClrVariant): ClrBoolean;


overload; reintroduce;

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14.1.3 TClrSByteHelper.GetHashCode Method

Returns the hash code for this instance.

Syntax
Delphi

class function GetHashCode(B: ClrSByte): ClrInt32; reintroduce;

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

888
.Net Runtime Library for Delphi

7.1.1.8.1.1.14.1.4 TClrSByteHelper.MaxValue Method

Represents the largest possible value of SByte.

Syntax
Delphi

class function MaxValue: ClrSByte;

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14.1.5 TClrSByteHelper.MinValue Method

Represents the smallest possible value of SByte.

Syntax
Delphi

class function MinValue: ClrSByte;

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14.1.6 Parse Method

This is the overview for the Parse method overload.

Overload List

Name Description

TClrSByteHelper.Parse Converts the string representation of a number to its 8-bit signed


(ClrWString) integer equivalent.

TClrSByteHelper.Parse Converts the string representation of a number in a specified culture-


(ClrWString, specific format to its 8-bit signed integer equivalent.

IFormatProvider)

TClrSByteHelper.Parse Converts the string representation of a number in a specified style to


(ClrWString, TNumberStyles) its 8-bit signed integer equivalent.

TClrSByteHelper.Parse Converts the string representation of a number that is in a specified


(ClrWString, TNumberStyles, style and culture-specific format to its 8-bit signed equivalent.

889
.Net Runtime Library for Delphi

Name Description

IFormatProvider)

7.1.1.8.1.1.14.1.6 TClrSByteHelper.Parse Method (ClrWString)


Converts the string representation of a number to its 8-bit signed integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString): ClrSByte; overload;

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14.1.6 TClrSByteHelper.Parse Method (ClrWString, IFormatProvider)


Converts the string representation of a number in a specified culture-specific format to its 8-bit signed integer
equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AProvider: IFormatProvider):


ClrSByte; overload;

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14.1.6 TClrSByteHelper.Parse Method (ClrWString, TNumberStyles)


Converts the string representation of a number in a specified style to its 8-bit signed integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles): ClrSByte;


overload;

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

890
.Net Runtime Library for Delphi

7.1.1.8.1.1.14.1.6 TClrSByteHelper.Parse Method (ClrWString, TNumberStyles,


IFormatProvider)
Converts the string representation of a number that is in a specified style and culture-specific format to its 8-bit signed
equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles; AProvider:


IFormatProvider): ClrSByte; overload;

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14.1.7 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrSByteHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrSByte) representation.

TClrSByteHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrSByte, ClrWString) representation, using the specified format.

TClrSByteHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrSByte, ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

TClrSByteHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrSByte, IFormatProvider) representation using the specified culture-specific format information.

7.1.1.8.1.1.14.1.7 TClrSByteHelper.ToString Method (ClrSByte)

Converts the numeric value of this instance to its equivalent string representation.

Syntax
Delphi

class function ToString(B: ClrSByte): ClrWString; overload;


reintroduce;

891
.Net Runtime Library for Delphi

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14.1.7 TClrSByteHelper.ToString Method (ClrSByte, ClrWString)


Converts the numeric value of this instance to its equivalent string representation, using the specified format.

Syntax
Delphi

class function ToString(B: ClrSByte; AFormat: ClrWString): ClrWString;


overload; reintroduce;

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14.1.7 TClrSByteHelper.ToString Method (ClrSByte, ClrWString, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified format and
culture-specific format information.

Syntax
Delphi

class function ToString(B: ClrSByte; AFormat: ClrWString; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14.1.7 TClrSByteHelper.ToString Method (ClrSByte, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific
format information.

Syntax
Delphi

class function ToString(B: ClrSByte; AProvider: IFormatProvider):


ClrWString; overload; reintroduce;

See Also

892
.Net Runtime Library for Delphi

TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14.1.8 TryParse Method

This is the overview for the TryParse method overload.

Overload List

Name Description

TClrSByteHelper.TryParse Tries to convert the string representation of a number to its SByte


(ClrWString, ClrSByte) equivalent, and returns a value that indicates whether the conversion
succeeded.

TClrSByteHelper.TryParse Tries to convert the string representation of a number in a specified


(ClrWString, TNumberStyles, style and culture-specific format to its SByte equivalent, and returns a
value that indicates whether the conversion succeeded.
IFormatProvider, ClrSByte)

7.1.1.8.1.1.14.1.8 TClrSByteHelper.TryParse Method (ClrWString, ClrSByte)


Tries to convert the string representation of a number to its SByte equivalent, and returns a value that indicates whether
the conversion succeeded.

Syntax
Delphi

class function TryParse(S: ClrWString; var AResult: ClrSByte):


ClrBoolean; overload;

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.14.1.8 TClrSByteHelper.TryParse Method (ClrWString, TNumberStyles,


IFormatProvider, ClrSByte)
Tries to convert the string representation of a number in a specified style and culture-specific format to its SByte
equivalent, and returns a value that indicates whether the conversion succeeded.

Syntax
Delphi

class function TryParse(S: ClrWString; AStyle: TNumberStyles;


AProvider: IFormatProvider; var AResult: ClrSByte): ClrBoolean;
overload;

893
.Net Runtime Library for Delphi

See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15 TClrSingleHelper Class


Collapse All Expand All

Helper class for Single Data Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrSingleHelper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrSingleHelper = class;

Methods

Name Description

CompareTo(ClrSingle, Compares this instance to a specified single-precision floating-point


ClrSingle) number and returns an integer that indicates whether the value of this
instance is less than, equal to, or greater than the value of the
specified single-precision floating-point number.

CompareTo(ClrSingle, Compares this instance to a specified object and returns an integer


ClrVariant) that indicates whether the value of this instance is less than, equal to,
or greater than the value of the specified variant.

Epsilon Represents the smallest positive Single value that is greater than zero.
This field is constant.

Equals(ClrSingle, ClrSingle) Returns a value indicating whether this instance and a specified Single
object represent the same value.

Equals(ClrSingle, ClrVariant) Returns a value indicating whether this instance is equal to a specified
variant.

GetHashCode Returns the hash code for this instance.

IsInfinity Returns a value indicating whether the specified number evaluates to

894
.Net Runtime Library for Delphi

Name Description

negative or positive infinity.

IsNaN Returns a value that indicates whether the specified value is not a
number (NaN ).

IsNegativeInfinity Returns a value indicating whether the specified number evaluates to


negative infinity.

IsPositiveInfinity Returns a value indicating whether the specified number evaluates to


positive infinity.

MaxValue Represents the largest possible value of Single .

MinValue Represents the smallest possible value of Single .

NaN Represents not a number (NaN ).

NegativeInfinity Represents negative infinity.

Parse(ClrWString) Converts the string representation of a number to its single-precision


floating-point number equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its single-precision floating-point number
equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its single-precision floating-point number equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its single-precision floating-point number
equivalent.
IFormatProvider)

PositiveInfinity Represents positive infinity.

ToString(ClrSingle) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrSingle, Converts the numeric value of this instance to its equivalent string
ClrWString) representation, using the specified format.

ToString(ClrSingle, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

895
.Net Runtime Library for Delphi

Name Description

ToString(ClrSingle, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Converts the string representation of a number to its single-precision


ClrSingle) floating-point number equivalent. A return value indicates whether
the conversion succeeded or failed.

TryParse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its single-precision floating-point number
equivalent. A return value indicates whether the conversion succeeded
IFormatProvider, ClrSingle)
or failed.

See Also
TClrSingleHelper Methods

7.1.1.8.1.1.15.1 TClrSingleHelper Methods

The methods of the TClrSingleHelper class are listed here.

Methods

Name Description

CompareTo(ClrSingle, Compares this instance to a specified single-precision


ClrSingle) floating-point number and returns an integer that indicates
whether the value of this instance is less than, equal to, or
greater than the value of the specified single-precision
floating-point number.

CompareTo(ClrSingle, Compares this instance to a specified object and returns an integer


ClrVariant) that indicates whether the value of this instance is less than, equal to,
or greater than the value of the specified variant.

Epsilon Represents the smallest positive Single value that is greater than zero.
This field is constant.

Equals(ClrSingle, ClrSingle) Returns a value indicating whether this instance and a specified
Single object represent the same value.

Equals(ClrSingle, ClrVariant) Returns a value indicating whether this instance is equal to a specified
variant.

GetHashCode Returns the hash code for this instance.

IsInfinity Returns a value indicating whether the specified number evaluates to

896
.Net Runtime Library for Delphi

Name Description

negative or positive infinity.

IsNaN Returns a value that indicates whether the specified value is not a
number ( NaN ).

IsNegativeInfinity Returns a value indicating whether the specified number


evaluates to negative infinity.

IsPositiveInfinity Returns a value indicating whether the specified number evaluates to


positive infinity.

MaxValue Represents the largest possible value of Single.

MinValue Represents the smallest possible value of Single.

NaN Represents not a number ( NaN ).

NegativeInfinity Represents negative infinity.

Parse(ClrWString) Converts the string representation of a number to its single-precision


floating-point number equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its single-precision floating-point number
equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its single-precision floating-point number equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its single-precision floating-point number
equivalent.
IFormatProvider)

PositiveInfinity Represents positive infinity.

ToString(ClrSingle) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrSingle, Converts the numeric value of this instance to its equivalent string
ClrWString) representation, using the specified format.

ToString(ClrSingle, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

897
.Net Runtime Library for Delphi

Name Description

ToString(ClrSingle, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Converts the string representation of a number to its single-precision


ClrSingle) floating-point number equivalent. A return value indicates whether
the conversion succeeded or failed.

TryParse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its single-precision floating-point number
equivalent. A return value indicates whether the conversion succeeded
IFormatProvider, ClrSingle)
or failed.

7.1.1.8.1.1.15.1.1 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

Name Description

TClrSingleHelper.CompareTo Compares this instance to a specified single-precision floating-


(ClrSingle, ClrSingle) point number and returns an integer that indicates whether the
value of this instance is less than, equal to, or greater than the
value of the specified single-precision floating-point number.

TClrSingleHelper.CompareTo Compares this instance to a specified object and returns an integer


(ClrSingle, ClrVariant) that indicates whether the value of this instance is less than, equal to,
or greater than the value of the specified variant.

7.1.1.8.1.1.15.1.1 TClrSingleHelper.CompareTo Method (ClrSingle, ClrSingle)

Compares this instance to a specified single-precision floating-point number and returns an integer that
indicates whether the value of this instance is less than, equal to, or greater than the value of the specified
single-precision floating-point number.

Syntax
Delphi

class function CompareTo(S: ClrSingle; AValue: ClrSingle): ClrInt32;


overload;

See Also

898
.Net Runtime Library for Delphi

TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.1 TClrSingleHelper.CompareTo Method (ClrSingle, ClrVariant)


Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is
less than, equal to, or greater than the value of the specified variant.

Syntax
Delphi

class function CompareTo(S: ClrSingle; AValue: ClrVariant): ClrInt32;


overload;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.2 TClrSingleHelper.Epsilon Method

Represents the smallest positive Single value that is greater than zero. This field is constant.

Syntax
Delphi

class function Epsilon: ClrSingle;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.3 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrSingleHelper.Equals Returns a value indicating whether this instance and a specified Single
(ClrSingle, ClrSingle) object represent the same value.

TClrSingleHelper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrSingle, ClrVariant) variant.

7.1.1.8.1.1.15.1.3 TClrSingleHelper.Equals Method (ClrSingle, ClrSingle)

899
.Net Runtime Library for Delphi

Returns a value indicating whether this instance and a specified Single object represent the same value.

Syntax
Delphi

class function Equals(S: ClrSingle; AObj: ClrSingle): ClrBoolean;


overload; reintroduce;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.3 TClrSingleHelper.Equals Method (ClrSingle, ClrVariant)


Returns a value indicating whether this instance is equal to a specified variant.

Syntax
Delphi

class function Equals(S: ClrSingle; AObj: ClrVariant): ClrBoolean;


overload; reintroduce;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.4 TClrSingleHelper.GetHashCode Method

Returns the hash code for this instance.

Syntax
Delphi

class function GetHashCode(S: ClrSingle): ClrInt32; reintroduce;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.5 TClrSingleHelper.IsInfinity Method

Returns a value indicating whether the specified number evaluates to negative or positive infinity.

Syntax
Delphi

900
.Net Runtime Library for Delphi

class function IsInfinity(F: ClrSingle): ClrBoolean;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.6 TClrSingleHelper.IsNaN Method

Returns a value that indicates whether the specified value is not a number ( NaN ).

Syntax
Delphi

class function IsNaN(F: ClrSingle): ClrBoolean;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.7 TClrSingleHelper.IsNegativeInfinity Method

Returns a value indicating whether the specified number evaluates to negative infinity.

Syntax
Delphi

class function IsNegativeInfinity(F: ClrSingle): ClrBoolean;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.8 TClrSingleHelper.IsPositiveInfinity Method

Returns a value indicating whether the specified number evaluates to positive infinity.

Syntax
Delphi

class function IsPositiveInfinity(F: ClrSingle): ClrBoolean;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

901
.Net Runtime Library for Delphi

7.1.1.8.1.1.15.1.9 TClrSingleHelper.MaxValue Method

Represents the largest possible value of Single.

Syntax
Delphi

class function MaxValue: ClrSingle;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.10 TClrSingleHelper.MinValue Method

Represents the smallest possible value of Single.

Syntax
Delphi

class function MinValue: ClrSingle;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.11 TClrSingleHelper.NaN Method

Represents not a number ( NaN ).

Syntax
Delphi

class function NaN: ClrSingle;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.12 TClrSingleHelper.NegativeInfinity Method

Represents negative infinity.

Syntax
Delphi

902
.Net Runtime Library for Delphi

class function NegativeInfinity: ClrSingle;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.13 Parse Method

This is the overview for the Parse method overload.

Overload List

Name Description

TClrSingleHelper.Parse Converts the string representation of a number to its single-precision


(ClrWString) floating-point number equivalent.

TClrSingleHelper.Parse Converts the string representation of a number in a specified culture-


(ClrWString, specific format to its single-precision floating-point number
equivalent.
IFormatProvider)

TClrSingleHelper.Parse Converts the string representation of a number in a specified style to


(ClrWString, TNumberStyles) its single-precision floating-point number equivalent.

TClrSingleHelper.Parse Converts the string representation of a number in a specified style and


(ClrWString, TNumberStyles, culture-specific format to its single-precision floating-point number
equivalent.
IFormatProvider)

7.1.1.8.1.1.15.1.13 TClrSingleHelper.Parse Method (ClrWString)


Converts the string representation of a number to its single-precision floating-point number equivalent.

Syntax
Delphi

class function Parse(S: ClrWString): ClrSingle; overload;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.13 TClrSingleHelper.Parse Method (ClrWString, IFormatProvider)


Converts the string representation of a number in a specified culture-specific format to its single-precision floating-
point number equivalent.

903
.Net Runtime Library for Delphi

Syntax
Delphi

class function Parse(S: ClrWString; AProvider: IFormatProvider):


ClrSingle; overload;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.13 TClrSingleHelper.Parse Method (ClrWString, TNumberStyles)


Converts the string representation of a number in a specified style to its single-precision floating-point number
equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles): ClrSingle;


overload;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.13 TClrSingleHelper.Parse Method (ClrWString, TNumberStyles,


IFormatProvider)
Converts the string representation of a number in a specified style and culture-specific format to its single-precision
floating-point number equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles; AProvider:


IFormatProvider): ClrSingle; overload;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.14 TClrSingleHelper.PositiveInfinity Method

Represents positive infinity.

Syntax

904
.Net Runtime Library for Delphi

Delphi

class function PositiveInfinity: ClrSingle;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.15 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrSingleHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrSingle) representation.

TClrSingleHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrSingle, ClrWString) representation, using the specified format.

TClrSingleHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrSingle, ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

TClrSingleHelper.ToString Converts the numeric value of this instance to its equivalent string
(ClrSingle, IFormatProvider) representation using the specified culture-specific format information.

7.1.1.8.1.1.15.1.15 TClrSingleHelper.ToString Method (ClrSingle)


Converts the numeric value of this instance to its equivalent string representation.

Syntax
Delphi

class function ToString(S: ClrSingle): ClrWString; overload;


reintroduce;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.15 TClrSingleHelper.ToString Method (ClrSingle, ClrWString)


Converts the numeric value of this instance to its equivalent string representation, using the specified format.

905
.Net Runtime Library for Delphi

Syntax
Delphi

class function ToString(S: ClrSingle; AFormat: ClrWString):


ClrWString; overload; reintroduce;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.15 TClrSingleHelper.ToString Method (ClrSingle, ClrWString, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified format and
culture-specific format information.

Syntax
Delphi

class function ToString(S: ClrSingle; AFormat: ClrWString; AProvider:


IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.15 TClrSingleHelper.ToString Method (ClrSingle, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific
format information.

Syntax
Delphi

class function ToString(S: ClrSingle; AProvider: IFormatProvider):


ClrWString; overload; reintroduce;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.16 TryParse Method

This is the overview for the TryParse method overload.

Overload List

906
.Net Runtime Library for Delphi

Name Description

TClrSingleHelper.TryParse Converts the string representation of a number to its single-precision


(ClrWString, ClrSingle) floating-point number equivalent. A return value indicates whether
the conversion succeeded or failed.

TClrSingleHelper.TryParse Converts the string representation of a number in a specified style and


(ClrWString, TNumberStyles, culture-specific format to its single-precision floating-point number
equivalent. A return value indicates whether the conversion succeeded
IFormatProvider, ClrSingle)
or failed.

7.1.1.8.1.1.15.1.16 TClrSingleHelper.TryParse Method (ClrWString, ClrSingle)


Converts the string representation of a number to its single-precision floating-point number equivalent. A return value
indicates whether the conversion succeeded or failed.

Syntax
Delphi

class function TryParse(S: ClrWString; var AResult: ClrSingle):


ClrBoolean; overload;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.15.1.16 TClrSingleHelper.TryParse Method (ClrWString, TNumberStyles,


IFormatProvider, ClrSingle)
Converts the string representation of a number in a specified style and culture-specific format to its single-precision
floating-point number equivalent. A return value indicates whether the conversion succeeded or failed.

Syntax
Delphi

class function TryParse(S: ClrWString; AStyle: TNumberStyles;


AProvider: IFormatProvider; var AResult: ClrSingle): ClrBoolean;
overload;

See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16 TClrStringHelper Class


Collapse All Expand All

907
.Net Runtime Library for Delphi

Helper class for String Data Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrStringHelper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrStringHelper = class;

Methods

Name Description

Format(ClrWString, ClrVariant) Replaces one or more format items in a specified string with the
string representation of a specified variant.

Format(ClrWString, ClrVariant, Replaces the format items in a specified string with the string
ClrVariant) representation of two specified variants.

Format(ClrWString, ClrVariant, Replaces the format items in a specified string with the string
ClrVariant, ClrVariant) representation of three specified variants.

Format(ClrWString, Replaces the format item in a specified string with the string
TClrVariantDynArray) representation of a corresponding variants in a specified dynamic
array.

Format(ClrWString, Replaces the format item in a specified string with the string
_ObjectArray) representation of a corresponding variants in a specified array.

Format(IFormatProvider, Replaces the format items in a specified string with the string
ClrWString, representations of corresponding variants in a specified dynamic
array. A parameter supplies culture-specific formatting information.
TClrVariantDynArray)

Format(IFormatProvider, Replaces the format items in a specified string with the string
ClrWString, _ObjectArray) representations of corresponding variants in a specified array. A
parameter supplies culture-specific formatting information.

Clone Returns a reference to this instance of String.

Compare(ClrWString, ClrInt32, Compares substrings of two specified Strings and returns an integer
ClrWString, ClrInt32, ClrInt32) that indicates their relative position in the sort order.

908
.Net Runtime Library for Delphi

Name Description

Compare(ClrWString, ClrInt32, Compares substrings of two specified Strings, ignoring or honoring


ClrWString, ClrInt32, ClrInt32, their case, and returns an integer that indicates their relative position
in the sort order.
ClrBoolean)

Compare(ClrWString, ClrInt32, Compares substrings of two specified Strings, ignoring or honoring


ClrWString, ClrInt32, ClrInt32, their case and using culture-specific information to influence the
comparison, and returns an integer that indicates their relative
ClrBoolean, _CultureInfo)
position in the sort order.

Compare(ClrWString, ClrInt32, Compares substrings of two specified Strings using the specified
ClrWString, ClrInt32, ClrInt32, rules, and returns an integer that indicates their relative position in
the sort order.
TStringComparison)

Compare(ClrWString, ClrInt32, Compares substrings of two specified Strings using the specified
ClrWString, ClrInt32, ClrInt32, comparison options and culture-specific information to influence the
comparison, and returns an integer that indicates the relationship of
_CultureInfo,
the two substrings to each other in the sort order.
TCompareOptions)

Compare(ClrWString, Compares two specified Strings and returns an integer that indicates
ClrWString) their relative position in the sort order.

Compare(ClrWString, Compares two specified Strings, ignoring or honoring their case, and
ClrWString, ClrBoolean) returns an integer that indicates their relative position in the sort
order.

Compare(ClrWString, Compares two specified Strings, ignoring or honoring their case, and
ClrWString, ClrBoolean, using culture-specific information to influence the comparison, and
returns an integer that indicates their relative position in the sort
_CultureInfo)
order.

Compare(ClrWString, Compares two specified Strings using the specified rules, and returns
ClrWString, an integer that indicates their relative position in the sort order.

TStringComparison)

Compare(ClrWString, Compares two specified Strings using the specified comparison


ClrWString, _CultureInfo, options and culture-specific information to influence the comparison,
and returns an integer that indicates the relationship of the two
TCompareOptions)
strings to each other in the sort order.

CompareOrdinal(ClrWString, Compares substrings of two specified Strings by evaluating the


ClrInt32, ClrWString, ClrInt32, numeric values of the corresponding Char objects in each substring.
ClrInt32)

CompareOrdinal(ClrWString, Compares two specified Strings by evaluating the numeric values of


ClrWString) the corresponding Char objects in each string.

909
.Net Runtime Library for Delphi

Name Description

CompareTo(ClrWString, Compares this instance with a specified variants and indicates


ClrVariant) whether this instance precedes, follows, or appears in the same
position in the sort order as the specified variant.

CompareTo(ClrWString, Compares this instance with a specified String and indicates whether
ClrWString) this instance precedes, follows, or appears in the same position in the
sort order as the specified string.

Concat(ClrVariant) Creates the string representation of a specified variant.

Concat(ClrVariant, ClrVariant) Concatenates the string representations of two specified variants.

Concat(ClrVariant, ClrVariant, Concatenates the string representations of three specified variants.


ClrVariant)

Concat(ClrVariant, ClrVariant, Concatenates the string representations of four specified objects and
ClrVariant, ClrVariant) any objects specified in an optional variable length parameter list.

Concat(ClrWString, Concatenates two specified instances of String.


ClrWString)

Concat(ClrWString, ClrWString, Concatenates three specified instances of String.


ClrWString)

Concat(ClrWString, ClrWString, Concatenates four specified instances of String.


ClrWString, ClrWString)

Concat(TClrVariantDynArray) Concatenates the string representations of the elements in a


specified variant array.

Concat(TClrWStringDynArray) Concatenates the elements of a specified String array.

Concat(_ObjectArray) Concatenates the string representations of the elements in a


specified Object array.

Concat(_StringArray) Concatenates the elements of a specified String array.

Contains Returns a value indicating whether a specified substring occurs


within this string.

Copy Creates a new instance of String with the same value as a specified
String.

CopyTo(ClrWString, ClrInt32, Copies a specified number of characters from a specified position in


TClrWCharDynArray, ClrInt32,

910
.Net Runtime Library for Delphi

Name Description

ClrInt32) this instance to a specified position in an dynamic array of characters.

CopyTo(ClrWString, ClrInt32, Copies a specified number of characters from a specified position in


_CharArray, ClrInt32, ClrInt32) this instance to a specified position in an array of Unicode characters.

Empty Represents the empty string.

EndsWith(ClrWString, Determines whether the end of this string instance matches the
ClrWString) specified string.

EndsWith(ClrWString, Determines whether the end of this string instance matches the
ClrWString, ClrBoolean, specified string when compared using the specified culture.

_CultureInfo)

EndsWith(ClrWString, Determines whether the end of this string instance matches the
ClrWString, specified string when compared using the specified comparison
option.
TStringComparison)

Equals(ClrWString, ClrVariant) Determines whether this instance and a specified object, which must
also be a String object, have the same value.

Equals(ClrWString, ClrWString) Determines whether two specified String objects have the same
value.

Equals(ClrWString, ClrWString, Determines whether two specified String objects have the same
TStringComparison) value. A parameter specifies the culture, case, and sort rules used in
the comparison.

GetChar Gets the Char at a specified position in the current String.

GetEnumerator Retrieves an object that can iterate through the individual characters
in this string.

GetHashCode Returns the hash code for this string.

GetLength Gets the number of characters in the current String.

GetString(ClrChar, ClrInt32) Returns a String to the value indicated by a specified Unicode


character repeated a specified number of times.

GetString(ClrVariant) Returns a String to the value indicated by a specified variant.

GetString(ClrWChar, ClrInt32) Returns a String to the value indicated by a specified wide character
repeated a specified number of times.

911
.Net Runtime Library for Delphi

Name Description

GetString(TClrWCharDynArray) Returns a String to the value indicated by a dynamic array of


characters.

GetString(TClrWCharDynArray, Returns a String to the value indicated by a dynamic array of


ClrInt32, ClrInt32) characters, a starting character position within that array, and a
length.

GetString(_CharArray) Returns a String to the value indicated by a array of Unicode


characters.

GetString(_CharArray, Returns a String to the value indicated by a array of Unicode


ClrInt32, ClrInt32) characters, a starting character position within that array, and a
length.

IndexOf(ClrWString, ClrChar) Reports the zero-based index of the first occurrence of the specified
Unicode character in this string.

IndexOf(ClrWString, ClrChar, Reports the zero-based index of the first occurrence of the specified
ClrInt32) Unicode character in this string. The search starts at a specified
character position.

IndexOf(ClrWString, ClrChar, Reports the zero-based index of the first occurrence of the specified
ClrInt32, ClrInt32) character in this instance. The search starts at a specified character
position and examines a specified number of character positions.

IndexOf(ClrWString, ClrWChar) Reports the zero-based index of the first occurrence of the specified
wide character in this string.

IndexOf(ClrWString, ClrWChar, Reports the zero-based index of the first occurrence of the specified
ClrInt32) wide character in this string. The search starts at a specified character
position.

IndexOf(ClrWString, ClrWChar, Reports the zero-based index of the first occurrence of the specified
ClrInt32, ClrInt32) character in this instance. The search starts at a specified character
position and examines a specified number of character positions.

IndexOf(ClrWString, Reports the zero-based index of the first occurrence of the specified
ClrWString) string in this instance.

IndexOf(ClrWString, Reports the zero-based index of the first occurrence of the specified
ClrWString, ClrInt32) string in this instance. The search starts at a specified character
position.

IndexOf(ClrWString, Reports the zero-based index of the first occurrence of the specified
ClrWString, ClrInt32, ClrInt32) string in this instance. The search starts at a specified character
position and examines a specified number of character positions.

912
.Net Runtime Library for Delphi

Name Description

IndexOf(ClrWString, Reports the zero-based index of the first occurrence of the specified
ClrWString, ClrInt32, ClrInt32, string in the current String. Parameters specify the starting search
position in the current string, the number of characters in the current
TStringComparison)
string to search, and the type of search to use for the specified string.

IndexOf(ClrWString, Reports the zero-based index of the first occurrence of the specified
ClrWString, ClrInt32, string in the current String. Parameters specify the starting search
position in the current string and the type of search to use for the
TStringComparison)
specified string.

IndexOf(ClrWString, Reports the zero-based index of the first occurrence of the specified
ClrWString, string in the current String. A parameter specifies the type of search
to use for the specified string.
TStringComparison)

IndexOfAny(ClrWString, Reports the zero-based index of the first occurrence in this instance
TClrWCharDynArray) of any character in a specified dynamic array of wide characters.

IndexOfAny(ClrWString, Reports the zero-based index of the first occurrence in this instance
TClrWCharDynArray, ClrInt32) of any character in a specified dynamic array of wide characters. The
search starts at a specified character position.

IndexOfAny(ClrWString, Reports the zero-based index of the first occurrence in this instance
TClrWCharDynArray, ClrInt32, of any character in a specified dynamic array of Wide characters. The
search starts at a specified character position and examines a
ClrInt32)
specified number of character positions.

IndexOfAny(ClrWString, Reports the zero-based index of the first occurrence in this instance
_CharArray) of any character in a specified array of Unicode characters.

IndexOfAny(ClrWString, Reports the zero-based index of the first occurrence in this instance
_CharArray, ClrInt32) of any character in a specified array of Unicode characters. The
search starts at a specified character position.

IndexOfAny(ClrWString, Reports the zero-based index of the first occurrence in this instance
_CharArray, ClrInt32, ClrInt32) of any character in a specified array of Unicode characters. The
search starts at a specified character position and examines a
specified number of character positions.

Insert Returns a new string in which a specified string is inserted at a


specified index position in this instance.

Intern Retrieves the system's reference to the specified String.

IsInterned Retrieves a reference to a specified String.

IsNormalized(ClrWString) Indicates whether this string is in Unicode normalization form C.

913
.Net Runtime Library for Delphi

Name Description

IsNormalized(ClrWString, Indicates whether this string is in the specified Unicode normalization


TNormalizationForm) form.

IsNullOrEmpty Indicates whether the specified string is nil or an Empty string.

IsNullOrWhiteSpace Indicates whether a specified string is nil, empty, or consists only of


white-space characters.

Join(ClrWString, Concatenates the elements of a dynamic variant array, using the


TClrVariantDynArray) specified separator between each element.

Join(ClrWString, Concatenates all the elements of a dynamic string array, using the
TClrWStringDynArray) specified separator between each element.

Join(ClrWString, Concatenates the specified elements of a dynamic string array, using


TClrWStringDynArray, the specified separator between each element.

ClrInt32, ClrInt32)

Join(ClrWString, _ObjectArray) Concatenates the elements of an object array, using the specified
separator between each element.

Join(ClrWString, _StringArray) Concatenates all the elements of a string array, using the specified
separator between each element.

Join(ClrWString, _StringArray, Concatenates the specified elements of a string array, using the
ClrInt32, ClrInt32) specified separator between each element.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrChar) specified wide character within this instance.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrChar, ClrInt32) specified Unicode character within this instance. The search starts at
a specified character position and proceeds backward toward the
beginning of the string.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of the
ClrChar, ClrInt32, ClrInt32) specified Unicode character in a substring within this instance. The
search starts at a specified character position and proceeds backward
toward the beginning of the string for a specified number of
character positions.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrWChar) specified Unicode character within this instance.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


specified wide character within this instance. The search starts at a

914
.Net Runtime Library for Delphi

Name Description

ClrWChar, ClrInt32) specified character position and proceeds backward toward the
beginning of the string.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of the
ClrWChar, ClrInt32, ClrInt32) specified Unicode character in a substring within this instance. The
search starts at a specified character position and proceeds backward
toward the beginning of the string for a specified number of
character positions.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrWString) specified string within this instance.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrWString, ClrInt32) specified string within this instance. The search starts at a specified
character position and proceeds backward toward the beginning of
the string.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrWString, ClrInt32, ClrInt32) specified string within this instance. The search starts at a specified
character position and proceeds backward toward the beginning of
the string for a specified number of character positions.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrWString, ClrInt32, ClrInt32, specified string within this instance. The search starts at a specified
character position and proceeds backward toward the beginning of
TStringComparison)
the string for the specified number of character positions. A
parameter specifies the type of comparison to perform when
searching for the specified string.

LastIndexOf(ClrWString, Reports the zero-based index of the last occurrence of a specified


ClrWString, ClrInt32, string within the current String object. The search starts at a specified
character position and proceeds backward toward the beginning of
TStringComparison)
the string. A parameter specifies the type of comparison to perform
when searching for the specified string.

LastIndexOf(ClrWString, Reports the zero-based index of the last occurrence of a specified


ClrWString, string within the current String object. A parameter specifies the type
of search to use for the specified string.
TStringComparison)

LastIndexOfAny(ClrWString, Reports the zero-based index position of the last occurrence in this
TClrWCharDynArray) instance of one or more characters specified in a dynamic Unicode
array.

LastIndexOfAny(ClrWString, Reports the zero-based index position of the last occurrence in this
TClrWCharDynArray, ClrInt32) instance of one or more characters specified in a dynamic Unicode
array. The search starts at a specified character position and proceeds
backward toward the beginning of the string.

915
.Net Runtime Library for Delphi

Name Description

LastIndexOfAny(ClrWString, Reports the zero-based index position of the last occurrence in this
TClrWCharDynArray, ClrInt32, instance of one or more characters specified in a dynamic Unicode
array. The search starts at a specified character position and proceeds
ClrInt32)
backward toward the beginning of the string for a specified number
of character positions.

LastIndexOfAny(ClrWString, Reports the zero-based index position of the last occurrence in this
_CharArray) instance of one or more characters specified in a Unicode array.

LastIndexOfAny(ClrWString, Reports the zero-based index position of the last occurrence in this
_CharArray, ClrInt32) instance of one or more characters specified in a Unicode array. The
search starts at a specified character position and proceeds backward
toward the beginning of the string.

LastIndexOfAny(ClrWString, Reports the zero-based index position of the last occurrence in this
_CharArray, ClrInt32, ClrInt32) instance of one or more characters specified in a Unicode array. The
search starts at a specified character position and proceeds backward
toward the beginning of the string for a specified number of
character positions.

Normalize(ClrWString) Returns a new string whose textual value is the same as this string,
but whose binary representation is in Unicode normalization form C.

Normalize(ClrWString, Returns a new string whose textual value is the same as this string,
TNormalizationForm) but whose binary representation is in the specified Unicode
normalization form.

PadLeft(ClrWString, ClrInt32) Returns a new string that right-aligns the characters in this instance
by padding them with spaces on the left, for a specified total length.

PadLeft(ClrWString, ClrInt32, Returns a new string that right-aligns the characters in this instance
ClrChar) by padding them on the left with a specified Unicode character, for a
specified total length.

PadLeft(ClrWString, ClrInt32, Returns a new string that right-aligns the characters in this instance
ClrWChar) by padding them on the left with a specified Unicode character, for a
specified total length.

PadRight(ClrWString, ClrInt32) Returns a new string that left-aligns the characters in this string by
padding them with spaces on the right, for a specified total length.

PadRight(ClrWString, ClrInt32, Returns a new string that left-aligns the characters in this string by
ClrChar) padding them on the right with a specified Unicode character, for a
specified total length.

PadRight(ClrWString, ClrInt32, Returns a new string that left-aligns the characters in this string by
ClrWChar) padding them on the right with a specified Unicode character, for a
specified total length.

916
.Net Runtime Library for Delphi

Name Description

Remove(ClrWString, ClrInt32) Returns a new string in which all the characters in the current
instance, beginning at a specified position and continuing through
the last position, have been deleted.

Remove(ClrWString, ClrInt32, Returns a new string in which a specified number of characters in the
ClrInt32) current instance beginning at a specified position have been deleted.

Replace(ClrWString, ClrChar, Returns a new string in which all occurrences of a specified Unicode
ClrChar) character in this instance are replaced with another specified Unicode
character.

Replace(ClrWString, ClrChar, Returns a new string in which all occurrences of a specified Unicode
ClrWChar) character in this instance are replaced with another specified Unicode
character.

Replace(ClrWString, ClrWChar, Returns a new string in which all occurrences of a specified Unicode
ClrChar) character in this instance are replaced with another specified Unicode
character.

Replace(ClrWString, ClrWChar, Returns a new string in which all occurrences of a specified Unicode
ClrWChar) character in this instance are replaced with another specified Unicode
character.

Replace(ClrWString, Returns a new string in which all occurrences of a specified string in


ClrWString, ClrWString) the current instance are replaced with another specified string.

Split(ClrWString, Splits a string into substrings that are based on the characters in an
TClrWCharDynArray) array.

Split(ClrWString, Splits a string into a maximum number of substrings based on the


TClrWCharDynArray, ClrInt32) characters in an array. You also specify the maximum number of
substrings to return.

Split(ClrWString, Splits a string into a maximum number of substrings based on the


TClrWCharDynArray, ClrInt32, characters in an array.

TStringSplitOptions)

Split(ClrWString, Splits a string into substrings based on the characters in an array.


TClrWCharDynArray, You can specify whether the substrings include empty array
elements.
TStringSplitOptions)

Split(ClrWString, Splits a string into a maximum number of substrings based on the


TClrWStringDynArray, strings in an array. You can specify whether the substrings include
empty array elements.
ClrInt32, TStringSplitOptions)

Split(ClrWString, Splits a string into substrings based on the strings in an array. You

917
.Net Runtime Library for Delphi

Name Description

TClrWStringDynArray, can specify whether the substrings include empty array elements.
TStringSplitOptions)

Split(ClrWString, _CharArray) Splits a string into substrings that are based on the characters in an
array.

Split(ClrWString, _CharArray, Splits a string into a maximum number of substrings based on the
ClrInt32) characters in an array. You also specify the maximum number of
substrings to return.

Split(ClrWString, _CharArray, Splits a string into a maximum number of substrings based on the
ClrInt32, TStringSplitOptions) characters in an array.

Split(ClrWString, _CharArray, Splits a string into substrings based on the characters in an array.
TStringSplitOptions) You can specify whether the substrings include empty array
elements.

Split(ClrWString, _StringArray, Splits a string into a maximum number of substrings based on the
ClrInt32, TStringSplitOptions) strings in an array. You can specify whether the substrings include
empty array elements.

Split(ClrWString, _StringArray, Splits a string into substrings based on the strings in an array. You
TStringSplitOptions) can specify whether the substrings include empty array elements.

StartsWith(ClrWString, Determines whether the beginning of this string instance matches


ClrWString) the specified string.

StartsWith(ClrWString, Determines whether the beginning of this string instance matches


ClrWString, ClrBoolean, the specified string when compared using the specified culture.

_CultureInfo)

StartsWith(ClrWString, Determines whether the beginning of this string instance matches


ClrWString, the specified string when compared using the specified comparison
option.
TStringComparison)

Substring(ClrWString, ClrInt32) Retrieves a substring from this instance. The substring starts at a
specified character position and continues to the end of the string.

Substring(ClrWString, ClrInt32, Retrieves a substring from this instance. The substring starts at a
ClrInt32) specified character position and has a specified length.

ToCharArray(ClrWString) Copies the characters in this instance to a Unicode character array.

ToCharArray(ClrWString, Copies the characters in a specified substring in this instance to a


ClrInt32, ClrInt32) Unicode character array.

918
.Net Runtime Library for Delphi

Name Description

ToCharDynArray(ClrWString) Copies the characters in this instance to a dynamic character array.

ToCharDynArray(ClrWString, Copies the characters in a specified substring in this instance to a


ClrInt32, ClrInt32) dynamic character array.

ToLower(ClrWString) Returns a copy of this string converted to lowercase.

ToLower(ClrWString, Returns a copy of this string to lowercase, using the casing rules of
_CultureInfo) the specified culture.

ToLowerInvariant Returns a copy of this String converted to lowercase using the casing
rules of the invariant culture.

ToString(ClrWString) Returns this instance of String; no actual conversion is performed.

ToString(ClrWString, Returns this instance of String; no actual conversion is performed.


IFormatProvider)

ToUpper(ClrWString) Returns a copy of this string converted to uppercase.

ToUpper(ClrWString, Returns a copy of this string converted to uppercase, using the


_CultureInfo) casing rules of the specified culture.

Trim(ClrWString) Removes all leading and trailing white-space characters from the
current String.

Trim(ClrWString, Removes all leading and trailing occurrences of a set of characters


TClrWCharDynArray) specified in a dynamic array from the current String.

Trim(ClrWString, _CharArray) Removes all leading and trailing occurrences of a set of characters
specified in an array from the current String.

TrimEnd(ClrWString, Removes all trailing occurrences of a set of characters specified in a


TClrWCharDynArray) dynamic array from the current String.

TrimEnd(ClrWString, Removes all trailing occurrences of a set of characters specified in an


_CharArray) array from the current String.

TrimStart(ClrWString, Removes all leading occurrences of a set of characters specified in a


TClrWCharDynArray) dynamic array from the current String.

TrimStart(ClrWString, Removes all leading occurrences of a set of characters specified in an


_CharArray) array from the current String.

919
.Net Runtime Library for Delphi

See Also
TClrStringHelper Methods

7.1.1.8.1.1.16.1 TClrStringHelper Methods

The methods of the TClrStringHelper class are listed here.

Methods

Name Description

Format(ClrWString, ClrVariant) Replaces one or more format items in a specified string with the
string representation of a specified variant.

Format(ClrWString, ClrVariant, Replaces the format items in a specified string with the string
ClrVariant) representation of two specified variants.

Format(ClrWString, ClrVariant, Replaces the format items in a specified string with the string
ClrVariant, ClrVariant) representation of three specified variants.

Format(ClrWString, Replaces the format item in a specified string with the string
TClrVariantDynArray) representation of a corresponding variants in a specified dynamic
array.

Format(ClrWString, Replaces the format item in a specified string with the string
_ObjectArray) representation of a corresponding variants in a specified array.

Format(IFormatProvider, Replaces the format items in a specified string with the string
ClrWString, representations of corresponding variants in a specified dynamic
array. A parameter supplies culture-specific formatting information.
TClrVariantDynArray)

Format(IFormatProvider, Replaces the format items in a specified string with the string
ClrWString, _ObjectArray) representations of corresponding variants in a specified array. A
parameter supplies culture-specific formatting information.

Clone Returns a reference to this instance of String.

Compare(ClrWString, ClrInt32, Compares substrings of two specified Strings and returns an integer
ClrWString, ClrInt32, ClrInt32) that indicates their relative position in the sort order.

Compare(ClrWString, ClrInt32, Compares substrings of two specified Strings, ignoring or


ClrWString, ClrInt32, ClrInt32, honoring their case, and returns an integer that indicates their
ClrBoolean) relative position in the sort order.

Compare(ClrWString, ClrInt32, Compares substrings of two specified Strings, ignoring or honoring


ClrWString, ClrInt32, ClrInt32, their case and using culture-specific information to influence the
comparison, and returns an integer that indicates their relative

920
.Net Runtime Library for Delphi

Name Description

ClrBoolean, _CultureInfo) position in the sort order.

Compare(ClrWString, ClrInt32, Compares substrings of two specified Strings using the specified
ClrWString, ClrInt32, ClrInt32, rules, and returns an integer that indicates their relative position in
the sort order.
TStringComparison)

Compare(ClrWString, ClrInt32, Compares substrings of two specified Strings using the specified
ClrWString, ClrInt32, ClrInt32, comparison options and culture-specific information to influence the
comparison, and returns an integer that indicates the relationship of
_CultureInfo,
the two substrings to each other in the sort order.
TCompareOptions)

Compare(ClrWString, Compares two specified Strings and returns an integer that indicates
ClrWString) their relative position in the sort order.

Compare(ClrWString, Compares two specified Strings, ignoring or honoring their case, and
ClrWString, ClrBoolean) returns an integer that indicates their relative position in the sort
order.

Compare(ClrWString, Compares two specified Strings, ignoring or honoring their case, and
ClrWString, ClrBoolean, using culture-specific information to influence the comparison, and
returns an integer that indicates their relative position in the sort
_CultureInfo)
order.

Compare(ClrWString, Compares two specified Strings using the specified rules, and returns
ClrWString, an integer that indicates their relative position in the sort order.

TStringComparison)

Compare(ClrWString, Compares two specified Strings using the specified comparison


ClrWString, _CultureInfo, options and culture-specific information to influence the comparison,
and returns an integer that indicates the relationship of the two
TCompareOptions)
strings to each other in the sort order.

CompareOrdinal(ClrWString, Compares substrings of two specified Strings by evaluating the


ClrInt32, ClrWString, ClrInt32, numeric values of the corresponding Char objects in each substring.
ClrInt32)

CompareOrdinal(ClrWString, Compares two specified Strings by evaluating the numeric values of


ClrWString) the corresponding Char objects in each string.

CompareTo(ClrWString, Compares this instance with a specified variants and indicates


ClrVariant) whether this instance precedes, follows, or appears in the same
position in the sort order as the specified variant.

CompareTo(ClrWString, Compares this instance with a specified String and indicates whether
ClrWString) this instance precedes, follows, or appears in the same position in the

921
.Net Runtime Library for Delphi

Name Description

sort order as the specified string.

Concat(ClrVariant) Creates the string representation of a specified variant.

Concat(ClrVariant, ClrVariant) Concatenates the string representations of two specified variants.

Concat(ClrVariant, ClrVariant, Concatenates the string representations of three specified variants.


ClrVariant)

Concat(ClrVariant, ClrVariant, Concatenates the string representations of four specified objects and
ClrVariant, ClrVariant) any objects specified in an optional variable length parameter list.

Concat(ClrWString, Concatenates two specified instances of String.


ClrWString)

Concat(ClrWString, ClrWString, Concatenates three specified instances of String.


ClrWString)

Concat(ClrWString, ClrWString, Concatenates four specified instances of String.


ClrWString, ClrWString)

Concat(TClrVariantDynArray) Concatenates the string representations of the elements in a


specified variant array.

Concat(TClrWStringDynArray) Concatenates the elements of a specified String array.

Concat(_ObjectArray) Concatenates the string representations of the elements in a


specified Object array.

Concat(_StringArray) Concatenates the elements of a specified String array.

Contains Returns a value indicating whether a specified substring occurs


within this string.

Copy Creates a new instance of String with the same value as a specified
String.

CopyTo(ClrWString, ClrInt32, Copies a specified number of characters from a specified position in


TClrWCharDynArray, ClrInt32, this instance to a specified position in an dynamic array of characters.

ClrInt32)

CopyTo(ClrWString, ClrInt32, Copies a specified number of characters from a specified position in


_CharArray, ClrInt32, ClrInt32) this instance to a specified position in an array of Unicode characters.

922
.Net Runtime Library for Delphi

Name Description

Empty Represents the empty string.

EndsWith(ClrWString, Determines whether the end of this string instance matches the
ClrWString) specified string.

EndsWith(ClrWString, Determines whether the end of this string instance matches the
ClrWString, ClrBoolean, specified string when compared using the specified culture.

_CultureInfo)

EndsWith(ClrWString, Determines whether the end of this string instance matches the
ClrWString, specified string when compared using the specified comparison
option.
TStringComparison)

Equals(ClrWString, ClrVariant) Determines whether this instance and a specified object, which must
also be a String object, have the same value.

Equals(ClrWString, ClrWString) Determines whether two specified String objects have the same
value.

Equals(ClrWString, ClrWString, Determines whether two specified String objects have the same
TStringComparison) value. A parameter specifies the culture, case, and sort rules used in
the comparison.

GetChar Gets the Char at a specified position in the current String.

GetEnumerator Retrieves an object that can iterate through the individual characters
in this string.

GetHashCode Returns the hash code for this string.

GetLength Gets the number of characters in the current String.

GetString(ClrChar, ClrInt32) Returns a String to the value indicated by a specified Unicode


character repeated a specified number of times.

GetString(ClrVariant) Returns a String to the value indicated by a specified variant.

GetString(ClrWChar, ClrInt32) Returns a String to the value indicated by a specified wide character
repeated a specified number of times.

GetString(TClrWCharDynArray) Returns a String to the value indicated by a dynamic array of


characters.

GetString(TClrWCharDynArray, Returns a String to the value indicated by a dynamic array of


ClrInt32, ClrInt32) characters, a starting character position within that array, and a

923
.Net Runtime Library for Delphi

Name Description

length.

GetString(_CharArray) Returns a String to the value indicated by a array of Unicode


characters.

GetString(_CharArray, Returns a String to the value indicated by a array of Unicode


ClrInt32, ClrInt32) characters, a starting character position within that array, and a
length.

IndexOf(ClrWString, ClrChar) Reports the zero-based index of the first occurrence of the specified
Unicode character in this string.

IndexOf(ClrWString, ClrChar, Reports the zero-based index of the first occurrence of the specified
ClrInt32) Unicode character in this string. The search starts at a specified
character position.

IndexOf(ClrWString, ClrChar, Reports the zero-based index of the first occurrence of the specified
ClrInt32, ClrInt32) character in this instance. The search starts at a specified character
position and examines a specified number of character positions.

IndexOf(ClrWString, ClrWChar) Reports the zero-based index of the first occurrence of the specified
wide character in this string.

IndexOf(ClrWString, ClrWChar, Reports the zero-based index of the first occurrence of the specified
ClrInt32) wide character in this string. The search starts at a specified character
position.

IndexOf(ClrWString, ClrWChar, Reports the zero-based index of the first occurrence of the specified
ClrInt32, ClrInt32) character in this instance. The search starts at a specified character
position and examines a specified number of character positions.

IndexOf(ClrWString, Reports the zero-based index of the first occurrence of the specified
ClrWString) string in this instance.

IndexOf(ClrWString, Reports the zero-based index of the first occurrence of the specified
ClrWString, ClrInt32) string in this instance. The search starts at a specified character
position.

IndexOf(ClrWString, Reports the zero-based index of the first occurrence of the specified
ClrWString, ClrInt32, ClrInt32) string in this instance. The search starts at a specified character
position and examines a specified number of character positions.

IndexOf(ClrWString, Reports the zero-based index of the first occurrence of the specified
ClrWString, ClrInt32, ClrInt32, string in the current String. Parameters specify the starting search
position in the current string, the number of characters in the current
TStringComparison)
string to search, and the type of search to use for the specified string.

924
.Net Runtime Library for Delphi

Name Description

IndexOf(ClrWString, Reports the zero-based index of the first occurrence of the specified
ClrWString, ClrInt32, string in the current String. Parameters specify the starting search
position in the current string and the type of search to use for the
TStringComparison)
specified string.

IndexOf(ClrWString, Reports the zero-based index of the first occurrence of the specified
ClrWString, string in the current String. A parameter specifies the type of search
to use for the specified string.
TStringComparison)

IndexOfAny(ClrWString, Reports the zero-based index of the first occurrence in this instance
TClrWCharDynArray) of any character in a specified dynamic array of wide characters.

IndexOfAny(ClrWString, Reports the zero-based index of the first occurrence in this instance
TClrWCharDynArray, ClrInt32) of any character in a specified dynamic array of wide characters. The
search starts at a specified character position.

IndexOfAny(ClrWString, Reports the zero-based index of the first occurrence in this instance
TClrWCharDynArray, ClrInt32, of any character in a specified dynamic array of Wide characters. The
search starts at a specified character position and examines a
ClrInt32)
specified number of character positions.

IndexOfAny(ClrWString, Reports the zero-based index of the first occurrence in this instance
_CharArray) of any character in a specified array of Unicode characters.

IndexOfAny(ClrWString, Reports the zero-based index of the first occurrence in this instance
_CharArray, ClrInt32) of any character in a specified array of Unicode characters. The
search starts at a specified character position.

IndexOfAny(ClrWString, Reports the zero-based index of the first occurrence in this instance
_CharArray, ClrInt32, ClrInt32) of any character in a specified array of Unicode characters. The
search starts at a specified character position and examines a
specified number of character positions.

Insert Returns a new string in which a specified string is inserted at a


specified index position in this instance.

Intern Retrieves the system's reference to the specified String.

IsInterned Retrieves a reference to a specified String.

IsNormalized(ClrWString) Indicates whether this string is in Unicode normalization form C.

IsNormalized(ClrWString, Indicates whether this string is in the specified Unicode normalization


TNormalizationForm) form.

IsNullOrEmpty Indicates whether the specified string is nil or an Empty string.

925
.Net Runtime Library for Delphi

Name Description

IsNullOrWhiteSpace Indicates whether a specified string is nil, empty, or consists only of


white-space characters.

Join(ClrWString, Concatenates the elements of a dynamic variant array, using the


TClrVariantDynArray) specified separator between each element.

Join(ClrWString, Concatenates all the elements of a dynamic string array, using the
TClrWStringDynArray) specified separator between each element.

Join(ClrWString, Concatenates the specified elements of a dynamic string array, using


TClrWStringDynArray, the specified separator between each element.

ClrInt32, ClrInt32)

Join(ClrWString, _ObjectArray) Concatenates the elements of an object array, using the specified
separator between each element.

Join(ClrWString, _StringArray) Concatenates all the elements of a string array, using the specified
separator between each element.

Join(ClrWString, _StringArray, Concatenates the specified elements of a string array, using the
ClrInt32, ClrInt32) specified separator between each element.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrChar) specified wide character within this instance.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrChar, ClrInt32) specified Unicode character within this instance. The search starts at
a specified character position and proceeds backward toward the
beginning of the string.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of the
ClrChar, ClrInt32, ClrInt32) specified Unicode character in a substring within this instance. The
search starts at a specified character position and proceeds backward
toward the beginning of the string for a specified number of
character positions.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrWChar) specified Unicode character within this instance.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrWChar, ClrInt32) specified wide character within this instance. The search starts at a
specified character position and proceeds backward toward the
beginning of the string.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of the
ClrWChar, ClrInt32, ClrInt32) specified Unicode character in a substring within this instance. The
search starts at a specified character position and proceeds backward

926
.Net Runtime Library for Delphi

Name Description

toward the beginning of the string for a specified number of


character positions.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrWString) specified string within this instance.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrWString, ClrInt32) specified string within this instance. The search starts at a specified
character position and proceeds backward toward the beginning of
the string.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrWString, ClrInt32, ClrInt32) specified string within this instance. The search starts at a specified
character position and proceeds backward toward the beginning of
the string for a specified number of character positions.

LastIndexOf(ClrWString, Reports the zero-based index position of the last occurrence of a


ClrWString, ClrInt32, ClrInt32, specified string within this instance. The search starts at a specified
character position and proceeds backward toward the beginning of
TStringComparison)
the string for the specified number of character positions. A
parameter specifies the type of comparison to perform when
searching for the specified string.

LastIndexOf(ClrWString, Reports the zero-based index of the last occurrence of a specified


ClrWString, ClrInt32, string within the current String object. The search starts at a specified
character position and proceeds backward toward the beginning of
TStringComparison)
the string. A parameter specifies the type of comparison to perform
when searching for the specified string.

LastIndexOf(ClrWString, Reports the zero-based index of the last occurrence of a specified


ClrWString, string within the current String object. A parameter specifies the type
of search to use for the specified string.
TStringComparison)

LastIndexOfAny(ClrWString, Reports the zero-based index position of the last occurrence in this
TClrWCharDynArray) instance of one or more characters specified in a dynamic Unicode
array.

LastIndexOfAny(ClrWString, Reports the zero-based index position of the last occurrence in this
TClrWCharDynArray, ClrInt32) instance of one or more characters specified in a dynamic Unicode
array. The search starts at a specified character position and proceeds
backward toward the beginning of the string.

LastIndexOfAny(ClrWString, Reports the zero-based index position of the last occurrence in this
TClrWCharDynArray, ClrInt32, instance of one or more characters specified in a dynamic Unicode
array. The search starts at a specified character position and proceeds
ClrInt32)
backward toward the beginning of the string for a specified number
of character positions.

927
.Net Runtime Library for Delphi

Name Description

LastIndexOfAny(ClrWString, Reports the zero-based index position of the last occurrence in this
_CharArray) instance of one or more characters specified in a Unicode array.

LastIndexOfAny(ClrWString, Reports the zero-based index position of the last occurrence in this
_CharArray, ClrInt32) instance of one or more characters specified in a Unicode array. The
search starts at a specified character position and proceeds backward
toward the beginning of the string.

LastIndexOfAny(ClrWString, Reports the zero-based index position of the last occurrence in this
_CharArray, ClrInt32, ClrInt32) instance of one or more characters specified in a Unicode array. The
search starts at a specified character position and proceeds backward
toward the beginning of the string for a specified number of
character positions.

Normalize(ClrWString) Returns a new string whose textual value is the same as this string,
but whose binary representation is in Unicode normalization form C.

Normalize(ClrWString, Returns a new string whose textual value is the same as this string,
TNormalizationForm) but whose binary representation is in the specified Unicode
normalization form.

PadLeft(ClrWString, ClrInt32) Returns a new string that right-aligns the characters in this instance
by padding them with spaces on the left, for a specified total length.

PadLeft(ClrWString, ClrInt32, Returns a new string that right-aligns the characters in this instance
ClrChar) by padding them on the left with a specified Unicode character, for a
specified total length.

PadLeft(ClrWString, ClrInt32, Returns a new string that right-aligns the characters in this instance
ClrWChar) by padding them on the left with a specified Unicode character, for a
specified total length.

PadRight(ClrWString, ClrInt32) Returns a new string that left-aligns the characters in this string by
padding them with spaces on the right, for a specified total length.

PadRight(ClrWString, ClrInt32, Returns a new string that left-aligns the characters in this string by
ClrChar) padding them on the right with a specified Unicode character, for a
specified total length.

PadRight(ClrWString, ClrInt32, Returns a new string that left-aligns the characters in this string by
ClrWChar) padding them on the right with a specified Unicode character, for a
specified total length.

Remove(ClrWString, ClrInt32) Returns a new string in which all the characters in the current
instance, beginning at a specified position and continuing through
the last position, have been deleted.

Remove(ClrWString, ClrInt32, Returns a new string in which a specified number of characters in the

928
.Net Runtime Library for Delphi

Name Description

ClrInt32) current instance beginning at a specified position have been deleted.

Replace(ClrWString, ClrChar, Returns a new string in which all occurrences of a specified Unicode
ClrChar) character in this instance are replaced with another specified Unicode
character.

Replace(ClrWString, ClrChar, Returns a new string in which all occurrences of a specified Unicode
ClrWChar) character in this instance are replaced with another specified Unicode
character.

Replace(ClrWString, ClrWChar, Returns a new string in which all occurrences of a specified Unicode
ClrChar) character in this instance are replaced with another specified Unicode
character.

Replace(ClrWString, ClrWChar, Returns a new string in which all occurrences of a specified Unicode
ClrWChar) character in this instance are replaced with another specified Unicode
character.

Replace(ClrWString, Returns a new string in which all occurrences of a specified string in


ClrWString, ClrWString) the current instance are replaced with another specified string.

Split(ClrWString, Splits a string into substrings that are based on the characters in an
TClrWCharDynArray) array.

Split(ClrWString, Splits a string into a maximum number of substrings based on the


TClrWCharDynArray, ClrInt32) characters in an array. You also specify the maximum number of
substrings to return.

Split(ClrWString, Splits a string into a maximum number of substrings based on the


TClrWCharDynArray, ClrInt32, characters in an array.

TStringSplitOptions)

Split(ClrWString, Splits a string into substrings based on the characters in an array.


TClrWCharDynArray, You can specify whether the substrings include empty array
elements.
TStringSplitOptions)

Split(ClrWString, Splits a string into a maximum number of substrings based on the


TClrWStringDynArray, strings in an array. You can specify whether the substrings include
empty array elements.
ClrInt32, TStringSplitOptions)

Split(ClrWString, Splits a string into substrings based on the strings in an array. You
TClrWStringDynArray, can specify whether the substrings include empty array elements.

TStringSplitOptions)

Split(ClrWString, _CharArray) Splits a string into substrings that are based on the characters in an
array.

929
.Net Runtime Library for Delphi

Name Description

Split(ClrWString, _CharArray, Splits a string into a maximum number of substrings based on the
ClrInt32) characters in an array. You also specify the maximum number of
substrings to return.

Split(ClrWString, _CharArray, Splits a string into a maximum number of substrings based on the
ClrInt32, TStringSplitOptions) characters in an array.

Split(ClrWString, _CharArray, Splits a string into substrings based on the characters in an array.
TStringSplitOptions) You can specify whether the substrings include empty array
elements.

Split(ClrWString, _StringArray, Splits a string into a maximum number of substrings based on the
ClrInt32, TStringSplitOptions) strings in an array. You can specify whether the substrings include
empty array elements.

Split(ClrWString, _StringArray, Splits a string into substrings based on the strings in an array. You
TStringSplitOptions) can specify whether the substrings include empty array elements.

StartsWith(ClrWString, Determines whether the beginning of this string instance matches


ClrWString) the specified string.

StartsWith(ClrWString, Determines whether the beginning of this string instance matches


ClrWString, ClrBoolean, the specified string when compared using the specified culture.

_CultureInfo)

StartsWith(ClrWString, Determines whether the beginning of this string instance matches


ClrWString, the specified string when compared using the specified comparison
option.
TStringComparison)

Substring(ClrWString, ClrInt32) Retrieves a substring from this instance. The substring starts at a
specified character position and continues to the end of the string.

Substring(ClrWString, ClrInt32, Retrieves a substring from this instance. The substring starts at a
ClrInt32) specified character position and has a specified length.

ToCharArray(ClrWString) Copies the characters in this instance to a Unicode character array.

ToCharArray(ClrWString, Copies the characters in a specified substring in this instance to a


ClrInt32, ClrInt32) Unicode character array.

ToCharDynArray(ClrWString) Copies the characters in this instance to a dynamic character array.

ToCharDynArray(ClrWString, Copies the characters in a specified substring in this instance to a


ClrInt32, ClrInt32) dynamic character array.

930
.Net Runtime Library for Delphi

Name Description

ToLower(ClrWString) Returns a copy of this string converted to lowercase.

ToLower(ClrWString, Returns a copy of this string to lowercase, using the casing rules of
_CultureInfo) the specified culture.

ToLowerInvariant Returns a copy of this String converted to lowercase using the casing
rules of the invariant culture.

ToString(ClrWString) Returns this instance of String; no actual conversion is performed.

ToString(ClrWString, Returns this instance of String; no actual conversion is performed.


IFormatProvider)

ToUpper(ClrWString) Returns a copy of this string converted to uppercase.

ToUpper(ClrWString, Returns a copy of this string converted to uppercase, using the


_CultureInfo) casing rules of the specified culture.

Trim(ClrWString) Removes all leading and trailing white-space characters from the
current String.

Trim(ClrWString, Removes all leading and trailing occurrences of a set of characters


TClrWCharDynArray) specified in a dynamic array from the current String.

Trim(ClrWString, _CharArray) Removes all leading and trailing occurrences of a set of characters
specified in an array from the current String.

TrimEnd(ClrWString, Removes all trailing occurrences of a set of characters specified in a


TClrWCharDynArray) dynamic array from the current String.

TrimEnd(ClrWString, Removes all trailing occurrences of a set of characters specified in an


_CharArray) array from the current String.

TrimStart(ClrWString, Removes all leading occurrences of a set of characters specified in a


TClrWCharDynArray) dynamic array from the current String.

TrimStart(ClrWString, Removes all leading occurrences of a set of characters specified in an


_CharArray) array from the current String.

7.1.1.8.1.1.16.1.1 Format Method

This is the overview for the AFormat method overload.

931
.Net Runtime Library for Delphi

Overload List

Name Description

TClrStringHelper.Format Replaces one or more format items in a specified string with the string
(ClrWString, ClrVariant) representation of a specified variant.

TClrStringHelper.Format Replaces the format items in a specified string with the string
(ClrWString, ClrVariant, representation of two specified variants.

ClrVariant)

TClrStringHelper.Format Replaces the format items in a specified string with the string
(ClrWString, ClrVariant, representation of three specified variants.

ClrVariant, ClrVariant)

TClrStringHelper.Format Replaces the format item in a specified string with the string
(ClrWString, representation of a corresponding variants in a specified dynamic
array.
TClrVariantDynArray)

TClrStringHelper.Format Replaces the format item in a specified string with the string
(ClrWString, _ObjectArray) representation of a corresponding variants in a specified array.

TClrStringHelper.Format Replaces the format items in a specified string with the string
(IFormatProvider, representations of corresponding variants in a specified dynamic
array. A parameter supplies culture-specific formatting information.
ClrWString,
TClrVariantDynArray)

TClrStringHelper.Format Replaces the format items in a specified string with the string
(IFormatProvider, representations of corresponding variants in a specified array. A
parameter supplies culture-specific formatting information.
ClrWString, _ObjectArray)

7.1.1.8.1.1.16.1.1 TClrStringHelper.Format Method (ClrWString, ClrVariant)


Replaces one or more format items in a specified string with the string representation of a specified variant.

Syntax
Delphi

class function AFormat(AFormat: ClrWString; Arg0: ClrVariant):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

932
.Net Runtime Library for Delphi

7.1.1.8.1.1.16.1.1 TClrStringHelper.Format Method (ClrWString, ClrVariant, ClrVariant)


Replaces the format items in a specified string with the string representation of two specified variants.

Syntax
Delphi

class function AFormat(AFormat: ClrWString; Arg0: ClrVariant; Arg1:


ClrVariant): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.1 TClrStringHelper.Format Method (ClrWString, ClrVariant, ClrVariant,


ClrVariant)
Replaces the format items in a specified string with the string representation of three specified variants.

Syntax
Delphi

class function AFormat(AFormat: ClrWString; Arg0: ClrVariant; Arg1:


ClrVariant; Arg2: ClrVariant): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.1 TClrStringHelper.Format Method (ClrWString, TClrVariantDynArray)


Replaces the format item in a specified string with the string representation of a corresponding variants in a specified
dynamic array.

Syntax
Delphi

class function AFormat(AFormat: ClrWString; AArguments:


TClrVariantDynArray): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.1 TClrStringHelper.Format Method (ClrWString, _ObjectArray)


Replaces the format item in a specified string with the string representation of a corresponding variants in a specified
array.

933
.Net Runtime Library for Delphi

Syntax
Delphi

class function AFormat(AFormat: ClrWString; AArguments: _ObjectArray):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.1 TClrStringHelper.Format Method (IFormatProvider, ClrWString,


TClrVariantDynArray)
Replaces the format items in a specified string with the string representations of corresponding variants in a specified
dynamic array. A parameter supplies culture-specific formatting information.

Syntax
Delphi

class function AFormat(AProvider: IFormatProvider; AFormat:


ClrWString; AArguments: TClrVariantDynArray): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.1 TClrStringHelper.Format Method (IFormatProvider, ClrWString,


_ObjectArray)
Replaces the format items in a specified string with the string representations of corresponding variants in a specified
array. A parameter supplies culture-specific formatting information.

Syntax
Delphi

class function AFormat(AProvider: IFormatProvider; AFormat:


ClrWString; AArguments: _ObjectArray): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.2 TClrStringHelper.Clone Method

Returns a reference to this instance of String.

Syntax

934
.Net Runtime Library for Delphi

Delphi

class function Clone(S: ClrWString): ClrVariant;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.3 Compare Method

This is the overview for the Compare method overload.

Overload List

Name Description

TClrStringHelper.Compare Compares substrings of two specified Strings and returns an integer


(ClrWString, ClrInt32, that indicates their relative position in the sort order.

ClrWString, ClrInt32,
ClrInt32)

TClrStringHelper.Compare Compares substrings of two specified Strings, ignoring or honoring


(ClrWString, ClrInt32, their case, and returns an integer that indicates their relative position
ClrWString, ClrInt32, in the sort order.

ClrInt32, ClrBoolean)

TClrStringHelper.Compare Compares substrings of two specified Strings, ignoring or honoring


(ClrWString, ClrInt32, their case and using culture-specific information to influence the
comparison, and returns an integer that indicates their relative
ClrWString, ClrInt32,
position in the sort order.
ClrInt32, ClrBoolean,
_CultureInfo)

TClrStringHelper.Compare Compares substrings of two specified Strings using the specified rules,
(ClrWString, ClrInt32, and returns an integer that indicates their relative position in the sort
order.
ClrWString, ClrInt32,
ClrInt32, TStringComparison)

TClrStringHelper.Compare Compares substrings of two specified Strings using the specified


(ClrWString, ClrInt32, comparison options and culture-specific information to influence the
comparison, and returns an integer that indicates the relationship of
ClrWString, ClrInt32,
the two substrings to each other in the sort order.
ClrInt32, _CultureInfo,
TCompareOptions)

TClrStringHelper.Compare Compares two specified Strings and returns an integer that indicates
(ClrWString, ClrWString) their relative position in the sort order.

TClrStringHelper.Compare Compares two specified Strings, ignoring or honoring their case, and

935
.Net Runtime Library for Delphi

Name Description

(ClrWString, ClrWString, returns an integer that indicates their relative position in the sort
ClrBoolean) order.

TClrStringHelper.Compare Compares two specified Strings, ignoring or honoring their case, and
(ClrWString, ClrWString, using culture-specific information to influence the comparison, and
returns an integer that indicates their relative position in the sort
ClrBoolean, _CultureInfo)
order.

TClrStringHelper.Compare Compares two specified Strings using the specified rules, and returns
(ClrWString, ClrWString, an integer that indicates their relative position in the sort order.

TStringComparison)

TClrStringHelper.Compare Compares two specified Strings using the specified comparison


(ClrWString, ClrWString, options and culture-specific information to influence the comparison,
and returns an integer that indicates the relationship of the two
_CultureInfo,
strings to each other in the sort order.
TCompareOptions)

7.1.1.8.1.1.16.1.3 TClrStringHelper.Compare Method (ClrWString, ClrInt32, ClrWString,


ClrInt32, ClrInt32)
Compares substrings of two specified Strings and returns an integer that indicates their relative position in the sort
order.

Syntax
Delphi

class function Compare(StrA: ClrWString; IndexA: ClrInt32; StrB:


ClrWString; IndexB: ClrInt32; ALength: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.3 TClrStringHelper.Compare Method (ClrWString, ClrInt32, ClrWString,


ClrInt32, ClrInt32, ClrBoolean)

Compares substrings of two specified Strings, ignoring or honoring their case, and returns an integer that indicates
their relative position in the sort order.

Syntax
Delphi

class function Compare(StrA: ClrWString; IndexA: ClrInt32; StrB:


ClrWString; IndexB: ClrInt32; ALength: ClrInt32; IgnoreCase:
ClrBoolean): ClrInt32; overload;

936
.Net Runtime Library for Delphi

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.3 TClrStringHelper.Compare Method (ClrWString, ClrInt32, ClrWString,


ClrInt32, ClrInt32, ClrBoolean, _CultureInfo)
Compares substrings of two specified Strings, ignoring or honoring their case and using culture-specific information to
influence the comparison, and returns an integer that indicates their relative position in the sort order.

Syntax
Delphi

class function Compare(StrA: ClrWString; IndexA: ClrInt32; StrB:


ClrWString; IndexB: ClrInt32; ALength: ClrInt32; IgnoreCase:
ClrBoolean;

ACulture: _CultureInfo): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.3 TClrStringHelper.Compare Method (ClrWString, ClrInt32, ClrWString,


ClrInt32, ClrInt32, TStringComparison)
Compares substrings of two specified Strings using the specified rules, and returns an integer that indicates their
relative position in the sort order.

Syntax
Delphi

class function Compare(StrA: ClrWString; IndexA: ClrInt32; StrB:


ClrWString; IndexB: ClrInt32; ALength: ClrInt32;

AComparisonType: TStringComparison): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.3 TClrStringHelper.Compare Method (ClrWString, ClrInt32, ClrWString,


ClrInt32, ClrInt32, _CultureInfo, TCompareOptions)
Compares substrings of two specified Strings using the specified comparison options and culture-specific information
to influence the comparison, and returns an integer that indicates the relationship of the two substrings to each other in
the sort order.

Syntax

937
.Net Runtime Library for Delphi

Delphi

class function Compare(StrA: ClrWString; IndexA: ClrInt32; StrB:


ClrWString; IndexB: ClrInt32; ALength: ClrInt32; ACulture:
_CultureInfo;

AOptions: TCompareOptions): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.3 TClrStringHelper.Compare Method (ClrWString, ClrWString)


Compares two specified Strings and returns an integer that indicates their relative position in the sort order.

Syntax
Delphi

class function Compare(StrA: ClrWString; StrB: ClrWString): ClrInt32;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.3 TClrStringHelper.Compare Method (ClrWString, ClrWString, ClrBoolean)


Compares two specified Strings, ignoring or honoring their case, and returns an integer that indicates their relative
position in the sort order.

Syntax
Delphi

class function Compare(StrA: ClrWString; StrB: ClrWString;


AIgnoreCase: ClrBoolean): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.3 TClrStringHelper.Compare Method (ClrWString, ClrWString, ClrBoolean,


_CultureInfo)
Compares two specified Strings, ignoring or honoring their case, and using culture-specific information to influence the
comparison, and returns an integer that indicates their relative position in the sort order.

Syntax

938
.Net Runtime Library for Delphi

Delphi

class function Compare(StrA: ClrWString; StrB: ClrWString;


AIgnoreCase: ClrBoolean; ACulture: _CultureInfo): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.3 TClrStringHelper.Compare Method (ClrWString, ClrWString,


TStringComparison)
Compares two specified Strings using the specified rules, and returns an integer that indicates their relative position in
the sort order.

Syntax
Delphi

class function Compare(StrA: ClrWString; StrB: ClrWString;


AComparisonType: TStringComparison): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.3 TClrStringHelper.Compare Method (ClrWString, ClrWString, _CultureInfo,


TCompareOptions)
Compares two specified Strings using the specified comparison options and culture-specific information to influence
the comparison, and returns an integer that indicates the relationship of the two strings to each other in the sort order.

Syntax
Delphi

class function Compare(StrA: ClrWString; StrB: ClrWString; ACulture:


_CultureInfo; AOptions: TCompareOptions): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.4 CompareOrdinal Method

This is the overview for the CompareOrdinal method overload.

Overload List

939
.Net Runtime Library for Delphi

Name Description

TClrStringHelper.CompareOrdinal Compares substrings of two specified Strings by evaluating the


(ClrWString, ClrInt32, ClrWString, numeric values of the corresponding Char objects in each

ClrInt32, ClrInt32) substring.

TClrStringHelper.CompareOrdinal Compares two specified Strings by evaluating the numeric values of


(ClrWString, ClrWString) the corresponding Char objects in each string.

7.1.1.8.1.1.16.1.4 TClrStringHelper.CompareOrdinal Method (ClrWString, ClrInt32, ClrWString,


ClrInt32, ClrInt32)

Compares substrings of two specified Strings by evaluating the numeric values of the corresponding Char objects in
each substring.

Syntax
Delphi

class function CompareOrdinal(StrA: ClrWString; IndexA: ClrInt32;


StrB: ClrWString; IndexB: ClrInt32; ALength: ClrInt32): ClrInt32;
overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.4 TClrStringHelper.CompareOrdinal Method (ClrWString, ClrWString)

Compares two specified Strings by evaluating the numeric values of the corresponding Char objects in each string.

Syntax
Delphi

class function CompareOrdinal(StrA: ClrWString; StrB: ClrWString):


ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.5 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

940
.Net Runtime Library for Delphi

Name Description

TClrStringHelper.CompareTo Compares this instance with a specified variants and indicates


(ClrWString, ClrVariant) whether this instance precedes, follows, or appears in the same
position in the sort order as the specified variant.

TClrStringHelper.CompareTo Compares this instance with a specified String and indicates whether
(ClrWString, ClrWString) this instance precedes, follows, or appears in the same position in the
sort order as the specified string.

7.1.1.8.1.1.16.1.5 TClrStringHelper.CompareTo Method (ClrWString, ClrVariant)

Compares this instance with a specified variants and indicates whether this instance precedes, follows, or appears in the
same position in the sort order as the specified variant.

Syntax
Delphi

class function CompareTo(S: ClrWString; AValue: ClrVariant): ClrInt32;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.5 TClrStringHelper.CompareTo Method (ClrWString, ClrWString)


Compares this instance with a specified String and indicates whether this instance precedes, follows, or appears in the
same position in the sort order as the specified string.

Syntax
Delphi

class function CompareTo(S: ClrWString; StrB: ClrWString): ClrInt32;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.6 Concat Method

This is the overview for the Concat method overload.

Overload List

941
.Net Runtime Library for Delphi

Name Description

TClrStringHelper.Concat Creates the string representation of a specified variant.


(ClrVariant)

TClrStringHelper.Concat Concatenates the string representations of two specified variants.


(ClrVariant, ClrVariant)

TClrStringHelper.Concat Concatenates the string representations of three specified variants.


(ClrVariant, ClrVariant,
ClrVariant)

TClrStringHelper.Concat Concatenates the string representations of four specified objects and


(ClrVariant, ClrVariant, any objects specified in an optional variable length parameter list.

ClrVariant, ClrVariant)

TClrStringHelper.Concat Concatenates two specified instances of String.


(ClrWString, ClrWString)

TClrStringHelper.Concat Concatenates three specified instances of String.


(ClrWString, ClrWString,
ClrWString)

TClrStringHelper.Concat Concatenates four specified instances of String.


(ClrWString, ClrWString,
ClrWString, ClrWString)

TClrStringHelper.Concat Concatenates the string representations of the elements in a specified


(TClrVariantDynArray) variant array.

TClrStringHelper.Concat Concatenates the elements of a specified String array.


(TClrWStringDynArray)

TClrStringHelper.Concat Concatenates the string representations of the elements in a specified


(_ObjectArray) Object array.

TClrStringHelper.Concat Concatenates the elements of a specified String array.


(_StringArray)

7.1.1.8.1.1.16.1.6 TClrStringHelper.Concat Method (ClrVariant)


Creates the string representation of a specified variant.

Syntax
Delphi

942
.Net Runtime Library for Delphi

class function Concat(Arg0: ClrVariant): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.6 TClrStringHelper.Concat Method (ClrVariant, ClrVariant)


Concatenates the string representations of two specified variants.

Syntax
Delphi

class function Concat(Arg0: ClrVariant; Arg1: ClrVariant): ClrWString;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.6 TClrStringHelper.Concat Method (ClrVariant, ClrVariant, ClrVariant)


Concatenates the string representations of three specified variants.

Syntax
Delphi

class function Concat(Arg0: ClrVariant; Arg1: ClrVariant; Arg2:


ClrVariant): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.6 TClrStringHelper.Concat Method (ClrVariant, ClrVariant, ClrVariant,


ClrVariant)
Concatenates the string representations of four specified objects and any objects specified in an optional variable
length parameter list.

Syntax
Delphi

class function Concat(Arg0: ClrVariant; Arg1: ClrVariant; Arg2:


ClrVariant; Arg3: ClrVariant): ClrWString; overload;

See Also

943
.Net Runtime Library for Delphi

TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.6 TClrStringHelper.Concat Method (ClrWString, ClrWString)


Concatenates two specified instances of String.

Syntax
Delphi

class function Concat(Str0: ClrWString; Str1: ClrWString): ClrWString;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.6 TClrStringHelper.Concat Method (ClrWString, ClrWString, ClrWString)


Concatenates three specified instances of String.

Syntax
Delphi

class function Concat(Str0: ClrWString; Str1: ClrWString; Str2:


ClrWString): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.6 TClrStringHelper.Concat Method (ClrWString, ClrWString, ClrWString,


ClrWString)
Concatenates four specified instances of String.

Syntax
Delphi

class function Concat(Str0: ClrWString; Str1: ClrWString; Str2:


ClrWString; Str3: ClrWString): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.6 TClrStringHelper.Concat Method (TClrVariantDynArray)

944
.Net Runtime Library for Delphi

Concatenates the string representations of the elements in a specified variant array.

Syntax
Delphi

class function Concat(AArguments: TClrVariantDynArray): ClrWString;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.6 TClrStringHelper.Concat Method (TClrWStringDynArray)


Concatenates the elements of a specified String array.

Syntax
Delphi

class function Concat(Values: TClrWStringDynArray): ClrWString;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.6 TClrStringHelper.Concat Method (_ObjectArray)


Concatenates the string representations of the elements in a specified Object array.

Syntax
Delphi

class function Concat(AArguments: _ObjectArray): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.6 TClrStringHelper.Concat Method (_StringArray)


Concatenates the elements of a specified String array.

Syntax
Delphi

class function Concat(Values: _StringArray): ClrWString; overload;

945
.Net Runtime Library for Delphi

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.7 TClrStringHelper.Contains Method

Returns a value indicating whether a specified substring occurs within this string.

Syntax
Delphi

class function Contains(S: ClrWString; AValue: ClrWString):


ClrBoolean;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.8 TClrStringHelper.Copy Method

Creates a new instance of String with the same value as a specified String.

Syntax
Delphi

class function Copy(Str: ClrWString): ClrWString;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.9 CopyTo Method

This is the overview for the CopyTo method overload.

Overload List

Name Description

TClrStringHelper.CopyTo Copies a specified number of characters from a specified position in


(ClrWString, ClrInt32, this instance to a specified position in an dynamic array of characters.

TClrWCharDynArray,
ClrInt32, ClrInt32)

TClrStringHelper.CopyTo Copies a specified number of characters from a specified position in


(ClrWString, ClrInt32,

946
.Net Runtime Library for Delphi

Name Description

_CharArray, ClrInt32, this instance to a specified position in an array of Unicode characters.


ClrInt32)

7.1.1.8.1.1.16.1.9 TClrStringHelper.CopyTo Method (ClrWString, ClrInt32, TClrWCharDynArray,


ClrInt32, ClrInt32)
Copies a specified number of characters from a specified position in this instance to a specified position in an dynamic
array of characters.

Syntax
Delphi

class procedure CopyTo(S: ClrWString; ASourceIndex: ClrInt32;


ADestination: TClrWCharDynArray; ADestinationIndex: ClrInt32; ACount:
ClrInt32); overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.9 TClrStringHelper.CopyTo Method (ClrWString, ClrInt32, _CharArray, ClrInt32,


ClrInt32)
Copies a specified number of characters from a specified position in this instance to a specified position in an array of
Unicode characters.

Syntax
Delphi

class procedure CopyTo(S: ClrWString; ASourceIndex: ClrInt32;


ADestination: _CharArray; ADestinationIndex: ClrInt32; ACount:
ClrInt32); overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.10 TClrStringHelper.Empty Method

Represents the empty string.

Syntax
Delphi

947
.Net Runtime Library for Delphi

class function Empty: ClrWString;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.11 EndsWith Method

This is the overview for the EndsWith method overload.

Overload List

Name Description

TClrStringHelper.EndsWith Determines whether the end of this string instance matches the
(ClrWString, ClrWString) specified string.

TClrStringHelper.EndsWith Determines whether the end of this string instance matches the
(ClrWString, ClrWString, specified string when compared using the specified culture.

ClrBoolean, _CultureInfo)

TClrStringHelper.EndsWith Determines whether the end of this string instance matches the
(ClrWString, ClrWString, specified string when compared using the specified comparison
option.
TStringComparison)

7.1.1.8.1.1.16.1.11 TClrStringHelper.EndsWith Method (ClrWString, ClrWString)


Determines whether the end of this string instance matches the specified string.

Syntax
Delphi

class function EndsWith(S: ClrWString; AValue: ClrWString):


ClrBoolean; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.11 TClrStringHelper.EndsWith Method (ClrWString, ClrWString, ClrBoolean,


_CultureInfo)
Determines whether the end of this string instance matches the specified string when compared using the specified
culture.

Syntax

948
.Net Runtime Library for Delphi

Delphi

class function EndsWith(S: ClrWString; AValue: ClrWString;


AIgnoreCase: ClrBoolean; ACulture: _CultureInfo): ClrBoolean;
overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.11 TClrStringHelper.EndsWith Method (ClrWString, ClrWString,


TStringComparison)
Determines whether the end of this string instance matches the specified string when compared using the specified
comparison option.

Syntax
Delphi

class function EndsWith(S: ClrWString; AValue: ClrWString;


AComparisonType: TStringComparison): ClrBoolean; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.12 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrStringHelper.Equals Determines whether this instance and a specified object, which must
(ClrWString, ClrVariant) also be a String object, have the same value.

TClrStringHelper.Equals Determines whether two specified String objects have the same value.
(ClrWString, ClrWString)

TClrStringHelper.Equals Determines whether two specified String objects have the same value.
(ClrWString, ClrWString, A parameter specifies the culture, case, and sort rules used in the
comparison.
TStringComparison)

7.1.1.8.1.1.16.1.12 TClrStringHelper.Equals Method (ClrWString, ClrVariant)


Determines whether this instance and a specified object, which must also be a String object, have the same value.

949
.Net Runtime Library for Delphi

Syntax
Delphi

class function Equals(S: ClrWString; AObj: ClrVariant): ClrBoolean;


overload; reintroduce;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.12 TClrStringHelper.Equals Method (ClrWString, ClrWString)


Determines whether two specified String objects have the same value.

Syntax
Delphi

class function Equals(A: ClrWString; B: ClrWString): ClrBoolean;


overload; reintroduce;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.12 TClrStringHelper.Equals Method (ClrWString, ClrWString,


TStringComparison)
Determines whether two specified String objects have the same value. A parameter specifies the culture, case, and sort
rules used in the comparison.

Syntax
Delphi

class function Equals(A: ClrWString; B: ClrWString; AComparisonType:


TStringComparison): ClrBoolean; overload; reintroduce;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.13 TClrStringHelper.GetChar Method

Gets the Char at a specified position in the current String.

Syntax
Delphi

950
.Net Runtime Library for Delphi

class function GetChar(S: ClrWString; AIndex: ClrInt32): ClrWChar;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.14 TClrStringHelper.GetEnumerator Method

Retrieves an object that can iterate through the individual characters in this string.

Syntax
Delphi

class function GetEnumerator(S: ClrWString): _CharEnumerator;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.15 TClrStringHelper.GetHashCode Method

Returns the hash code for this string.

Syntax
Delphi

class function GetHashCode(S: ClrWString): ClrInt32; reintroduce;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.16 TClrStringHelper.GetLength Method

Gets the number of characters in the current String.

Syntax
Delphi

class function GetLength(S: ClrWString): ClrInt32;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

951
.Net Runtime Library for Delphi

7.1.1.8.1.1.16.1.17 GetString Method

This is the overview for the GetString method overload.

Overload List

Name Description

TClrStringHelper.GetString Returns a String to the value indicated by a specified Unicode


(ClrChar, ClrInt32) character repeated a specified number of times.

TClrStringHelper.GetString Returns a String to the value indicated by a specified variant.


(ClrVariant)

TClrStringHelper.GetString Returns a String to the value indicated by a specified wide character


(ClrWChar, ClrInt32) repeated a specified number of times.

TClrStringHelper.GetString Returns a String to the value indicated by a dynamic array of


(TClrWCharDynArray) characters.

TClrStringHelper.GetString Returns a String to the value indicated by a dynamic array of


(TClrWCharDynArray, characters, a starting character position within that array, and a length.

ClrInt32, ClrInt32)

TClrStringHelper.GetString Returns a String to the value indicated by a array of Unicode


(_CharArray) characters.

TClrStringHelper.GetString Returns a String to the value indicated by a array of Unicode


(_CharArray, ClrInt32, characters, a starting character position within that array, and a length.

ClrInt32)

7.1.1.8.1.1.16.1.17 TClrStringHelper.GetString Method (ClrChar, ClrInt32)


Returns a String to the value indicated by a specified Unicode character repeated a specified number of times.

Syntax
Delphi

class function GetString(C: ClrChar; ACount: ClrInt32): ClrWString;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

952
.Net Runtime Library for Delphi

7.1.1.8.1.1.16.1.17 TClrStringHelper.GetString Method (ClrVariant)


Returns a String to the value indicated by a specified variant.

Syntax
Delphi

class function GetString(AValue: ClrVariant): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.17 TClrStringHelper.GetString Method (ClrWChar, ClrInt32)


Returns a String to the value indicated by a specified wide character repeated a specified number of times.

Syntax
Delphi

class function GetString(C: ClrWChar; ACount: ClrInt32): ClrWString;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.17 TClrStringHelper.GetString Method (TClrWCharDynArray)


Returns a String to the value indicated by a dynamic array of characters.

Syntax
Delphi

class function GetString(AValue: TClrWCharDynArray): ClrWString;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.17 TClrStringHelper.GetString Method (TClrWCharDynArray, ClrInt32,


ClrInt32)
Returns a String to the value indicated by a dynamic array of characters, a starting character position within that array,
and a length.

Syntax

953
.Net Runtime Library for Delphi

Delphi

class function GetString(AValue: TClrWCharDynArray; AStartIndex:


ClrInt32; ALength: ClrInt32): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.17 TClrStringHelper.GetString Method (_CharArray)


Returns a String to the value indicated by a array of Unicode characters.

Syntax
Delphi

class function GetString(AValue: _CharArray): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.17 TClrStringHelper.GetString Method (_CharArray, ClrInt32, ClrInt32)


Returns a String to the value indicated by a array of Unicode characters, a starting character position within that array,
and a length.

Syntax
Delphi

class function GetString(AValue: _CharArray; AStartIndex: ClrInt32;


ALength: ClrInt32): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.18 IndexOf Method

This is the overview for the IndexOf method overload.

Overload List

Name Description

TClrStringHelper.IndexOf Reports the zero-based index of the first occurrence of the specified
Unicode character in this string.

954
.Net Runtime Library for Delphi

Name Description

(ClrWString, ClrChar)

TClrStringHelper.IndexOf Reports the zero-based index of the first occurrence of the specified
(ClrWString, ClrChar, Unicode character in this string. The search starts at a specified
character position.
ClrInt32)

TClrStringHelper.IndexOf Reports the zero-based index of the first occurrence of the specified
(ClrWString, ClrChar, character in this instance. The search starts at a specified character
position and examines a specified number of character positions.
ClrInt32, ClrInt32)

TClrStringHelper.IndexOf Reports the zero-based index of the first occurrence of the specified
(ClrWString, ClrWChar) wide character in this string.

TClrStringHelper.IndexOf Reports the zero-based index of the first occurrence of the specified
(ClrWString, ClrWChar, wide character in this string. The search starts at a specified character
position.
ClrInt32)

TClrStringHelper.IndexOf Reports the zero-based index of the first occurrence of the specified
(ClrWString, ClrWChar, character in this instance. The search starts at a specified character
position and examines a specified number of character positions.
ClrInt32, ClrInt32)

TClrStringHelper.IndexOf Reports the zero-based index of the first occurrence of the specified
(ClrWString, ClrWString) string in this instance.

TClrStringHelper.IndexOf Reports the zero-based index of the first occurrence of the specified
(ClrWString, ClrWString, string in this instance. The search starts at a specified character
position.
ClrInt32)

TClrStringHelper.IndexOf Reports the zero-based index of the first occurrence of the specified
(ClrWString, ClrWString, string in this instance. The search starts at a specified character
position and examines a specified number of character positions.
ClrInt32, ClrInt32)

TClrStringHelper.IndexOf Reports the zero-based index of the first occurrence of the specified
(ClrWString, ClrWString, string in the current String. Parameters specify the starting search
position in the current string, the number of characters in the current
ClrInt32, ClrInt32,
string to search, and the type of search to use for the specified string.
TStringComparison)

TClrStringHelper.IndexOf Reports the zero-based index of the first occurrence of the specified
(ClrWString, ClrWString, string in the current String. Parameters specify the starting search
position in the current string and the type of search to use for the
ClrInt32, TStringComparison)
specified string.

TClrStringHelper.IndexOf Reports the zero-based index of the first occurrence of the specified
(ClrWString, ClrWString, string in the current String. A parameter specifies the type of search to

955
.Net Runtime Library for Delphi

Name Description

TStringComparison) use for the specified string.

7.1.1.8.1.1.16.1.18 TClrStringHelper.IndexOf Method (ClrWString, ClrChar)


Reports the zero-based index of the first occurrence of the specified Unicode character in this string.

Syntax
Delphi

class function IndexOf(S: ClrWString; AValue: ClrChar): ClrInt32;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.18 TClrStringHelper.IndexOf Method (ClrWString, ClrChar, ClrInt32)


Reports the zero-based index of the first occurrence of the specified Unicode character in this string. The search starts
at a specified character position.

Syntax
Delphi

class function IndexOf(S: ClrWString; AValue: ClrChar; AStartIndex:


ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.18 TClrStringHelper.IndexOf Method (ClrWString, ClrChar, ClrInt32, ClrInt32)


Reports the zero-based index of the first occurrence of the specified character in this instance. The search starts at a
specified character position and examines a specified number of character positions.

Syntax
Delphi

class function IndexOf(S: ClrWString; AValue: ClrChar; AStartIndex:


ClrInt32; ACount: ClrInt32): ClrInt32; overload;

See Also

956
.Net Runtime Library for Delphi

TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.18 TClrStringHelper.IndexOf Method (ClrWString, ClrWChar)


Reports the zero-based index of the first occurrence of the specified wide character in this string.

Syntax
Delphi

class function IndexOf(S: ClrWString; AValue: ClrWChar): ClrInt32;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.18 TClrStringHelper.IndexOf Method (ClrWString, ClrWChar, ClrInt32)


Reports the zero-based index of the first occurrence of the specified wide character in this string. The search starts at a
specified character position.

Syntax
Delphi

class function IndexOf(S: ClrWString; AValue: ClrWChar; AStartIndex:


ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.18 TClrStringHelper.IndexOf Method (ClrWString, ClrWChar, ClrInt32, ClrInt32)


Reports the zero-based index of the first occurrence of the specified character in this instance. The search starts at a
specified character position and examines a specified number of character positions.

Syntax
Delphi

class function IndexOf(S: ClrWString; AValue: ClrWChar; AStartIndex:


ClrInt32; ACount: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.18 TClrStringHelper.IndexOf Method (ClrWString, ClrWString)

957
.Net Runtime Library for Delphi

Reports the zero-based index of the first occurrence of the specified string in this instance.

Syntax
Delphi

class function IndexOf(S: ClrWString; AValue: ClrWString): ClrInt32;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.18 TClrStringHelper.IndexOf Method (ClrWString, ClrWString, ClrInt32)


Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a
specified character position.

Syntax
Delphi

class function IndexOf(S: ClrWString; AValue: ClrWString; AStartIndex:


ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.18 TClrStringHelper.IndexOf Method (ClrWString, ClrWString, ClrInt32,


ClrInt32)
Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a
specified character position and examines a specified number of character positions.

Syntax
Delphi

class function IndexOf(S: ClrWString; AValue: ClrWString; AStartIndex:


ClrInt32; ACount: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.18 TClrStringHelper.IndexOf Method (ClrWString, ClrWString, ClrInt32,


ClrInt32, TStringComparison)

958
.Net Runtime Library for Delphi

Reports the zero-based index of the first occurrence of the specified string in the current String. Parameters specify the
starting search position in the current string, the number of characters in the current string to search, and the type of
search to use for the specified string.

Syntax
Delphi

class function IndexOf(S: ClrWString; AValue: ClrWString; AStartIndex:


ClrInt32; ACount: ClrInt32; AComparisonType: TStringComparison):
ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.18 TClrStringHelper.IndexOf Method (ClrWString, ClrWString, ClrInt32,


TStringComparison)
Reports the zero-based index of the first occurrence of the specified string in the current String. Parameters specify the
starting search position in the current string and the type of search to use for the specified string.

Syntax
Delphi

class function IndexOf(S: ClrWString; AValue: ClrWString; AStartIndex:


ClrInt32; AComparisonType: TStringComparison): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.18 TClrStringHelper.IndexOf Method (ClrWString, ClrWString,


TStringComparison)
Reports the zero-based index of the first occurrence of the specified string in the current String. A parameter specifies
the type of search to use for the specified string.

Syntax
Delphi

class function IndexOf(S: ClrWString; AValue: ClrWString;


AComparisonType: TStringComparison): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

959
.Net Runtime Library for Delphi

7.1.1.8.1.1.16.1.19 IndexOfAny Method

This is the overview for the IndexOfAny method overload.

Overload List

Name Description

TClrStringHelper.IndexOfAny Reports the zero-based index of the first occurrence in this instance of
(ClrWString, any character in a specified dynamic array of wide characters.

TClrWCharDynArray)

TClrStringHelper.IndexOfAny Reports the zero-based index of the first occurrence in this instance of
(ClrWString, any character in a specified dynamic array of wide characters. The
search starts at a specified character position.
TClrWCharDynArray,
ClrInt32)

TClrStringHelper.IndexOfAny Reports the zero-based index of the first occurrence in this instance of
(ClrWString, any character in a specified dynamic array of Wide characters. The
search starts at a specified character position and examines a specified
TClrWCharDynArray,
number of character positions.
ClrInt32, ClrInt32)

TClrStringHelper.IndexOfAny Reports the zero-based index of the first occurrence in this instance of
(ClrWString, _CharArray) any character in a specified array of Unicode characters.

TClrStringHelper.IndexOfAny Reports the zero-based index of the first occurrence in this instance of
(ClrWString, _CharArray, any character in a specified array of Unicode characters. The search
starts at a specified character position.
ClrInt32)

TClrStringHelper.IndexOfAny Reports the zero-based index of the first occurrence in this instance of
(ClrWString, _CharArray, any character in a specified array of Unicode characters. The search
starts at a specified character position and examines a specified
ClrInt32, ClrInt32)
number of character positions.

7.1.1.8.1.1.16.1.19 TClrStringHelper.IndexOfAny Method (ClrWString, TClrWCharDynArray)


Reports the zero-based index of the first occurrence in this instance of any character in a specified dynamic array of
wide characters.

Syntax
Delphi

class function IndexOfAny(S: ClrWString; AAnyOf: TClrWCharDynArray):


ClrInt32; overload;

See Also

960
.Net Runtime Library for Delphi

TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.19 TClrStringHelper.IndexOfAny Method (ClrWString, TClrWCharDynArray,


ClrInt32)
Reports the zero-based index of the first occurrence in this instance of any character in a specified dynamic array of
wide characters. The search starts at a specified character position.

Syntax
Delphi

class function IndexOfAny(S: ClrWString; AAnyOf: TClrWCharDynArray;


AStartIndex: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.19 TClrStringHelper.IndexOfAny Method (ClrWString, TClrWCharDynArray,


ClrInt32, ClrInt32)
Reports the zero-based index of the first occurrence in this instance of any character in a specified dynamic array of
Wide characters. The search starts at a specified character position and examines a specified number of character
positions.

Syntax
Delphi

class function IndexOfAny(S: ClrWString; AAnyOf: TClrWCharDynArray;


AStartIndex: ClrInt32; ACount: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.19 TClrStringHelper.IndexOfAny Method (ClrWString, _CharArray)


Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode
characters.

Syntax
Delphi

class function IndexOfAny(S: ClrWString; AAnyOf: _CharArray):


ClrInt32; overload;

See Also

961
.Net Runtime Library for Delphi

TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.19 TClrStringHelper.IndexOfAny Method (ClrWString, _CharArray, ClrInt32)


Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode
characters. The search starts at a specified character position.

Syntax
Delphi

class function IndexOfAny(S: ClrWString; AAnyOf: _CharArray;


AStartIndex: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.19 TClrStringHelper.IndexOfAny Method (ClrWString, _CharArray, ClrInt32,


ClrInt32)
Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode
characters. The search starts at a specified character position and examines a specified number of character positions.

Syntax
Delphi

class function IndexOfAny(S: ClrWString; AAnyOf: _CharArray;


AStartIndex: ClrInt32; ACount: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.20 TClrStringHelper.Insert Method

Returns a new string in which a specified string is inserted at a specified index position in this instance.

Syntax
Delphi

class function Insert(S: ClrWString; AStartIndex: ClrInt32; AValue:


ClrWString): ClrWString;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

962
.Net Runtime Library for Delphi

7.1.1.8.1.1.16.1.21 TClrStringHelper.Intern Method

Retrieves the system's reference to the specified String.

Syntax
Delphi

class function Intern(Str: ClrWString): ClrWString;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.22 TClrStringHelper.IsInterned Method

Retrieves a reference to a specified String.

Syntax
Delphi

class function IsInterned(Str: ClrWString): ClrWString;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.23 IsNormalized Method

This is the overview for the IsNormalized method overload.

Overload List

Name Description

TClrStringHelper.IsNormalized Indicates whether this string is in Unicode normalization form C.


(ClrWString)

TClrStringHelper.IsNormalized Indicates whether this string is in the specified Unicode normalization


(ClrWString, form.

TNormalizationForm)

7.1.1.8.1.1.16.1.23 TClrStringHelper.IsNormalized Method (ClrWString)


Indicates whether this string is in Unicode normalization form C.

Syntax

963
.Net Runtime Library for Delphi

Delphi

class function IsNormalized(S: ClrWString): ClrBoolean; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.23 TClrStringHelper.IsNormalized Method (ClrWString, TNormalizationForm)


Indicates whether this string is in the specified Unicode normalization form.

Syntax
Delphi

class function IsNormalized(S: ClrWString; ANormalizationForm:


TNormalizationForm): ClrBoolean; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.24 TClrStringHelper.IsNullOrEmpty Method

Indicates whether the specified string is nil or an Empty string.

Syntax
Delphi

class function IsNullOrEmpty(AValue: ClrWString): ClrBoolean;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.25 TClrStringHelper.IsNullOrWhiteSpace Method

Indicates whether a specified string is nil, empty, or consists only of white-space characters.

Syntax
Delphi

class function IsNullOrWhiteSpace(AValue: ClrWString): ClrBoolean;


overload;

See Also

964
.Net Runtime Library for Delphi

TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.26 Join Method

This is the overview for the Join method overload.

Overload List

Name Description

TClrStringHelper.Join Concatenates the elements of a dynamic variant array, using the


(ClrWString, specified separator between each element.

TClrVariantDynArray)

TClrStringHelper.Join Concatenates all the elements of a dynamic string array, using the
(ClrWString, specified separator between each element.

TClrWStringDynArray)

TClrStringHelper.Join Concatenates the specified elements of a dynamic string array, using


(ClrWString, the specified separator between each element.

TClrWStringDynArray,
ClrInt32, ClrInt32)

TClrStringHelper.Join Concatenates the elements of an object array, using the specified


(ClrWString, _ObjectArray) separator between each element.

TClrStringHelper.Join Concatenates all the elements of a string array, using the specified
(ClrWString, _StringArray) separator between each element.

TClrStringHelper.Join Concatenates the specified elements of a string array, using the


(ClrWString, _StringArray, specified separator between each element.

ClrInt32, ClrInt32)

7.1.1.8.1.1.16.1.26 TClrStringHelper.Join Method (ClrWString, TClrVariantDynArray)


Concatenates the elements of a dynamic variant array, using the specified separator between each element.

Syntax
Delphi

class function Join(ASeparator: ClrWString; Values:


TClrVariantDynArray): ClrWString; overload;

See Also

965
.Net Runtime Library for Delphi

TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.26 TClrStringHelper.Join Method (ClrWString, TClrWStringDynArray)


Concatenates all the elements of a dynamic string array, using the specified separator between each element.

Syntax
Delphi

class function Join(ASeparator: ClrWString; AValue:


TClrWStringDynArray): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.26 TClrStringHelper.Join Method (ClrWString, TClrWStringDynArray, ClrInt32,


ClrInt32)
Concatenates the specified elements of a dynamic string array, using the specified separator between each element.

Syntax
Delphi

class function Join(ASeparator: ClrWString; AValue:


TClrWStringDynArray; AStartIndex: ClrInt32; ACount: ClrInt32):
ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.26 TClrStringHelper.Join Method (ClrWString, _ObjectArray)


Concatenates the elements of an object array, using the specified separator between each element.

Syntax
Delphi

class function Join(ASeparator: ClrWString; Values: _ObjectArray):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

966
.Net Runtime Library for Delphi

7.1.1.8.1.1.16.1.26 TClrStringHelper.Join Method (ClrWString, _StringArray)


Concatenates all the elements of a string array, using the specified separator between each element.

Syntax
Delphi

class function Join(ASeparator: ClrWString; AValue: _StringArray):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.26 TClrStringHelper.Join Method (ClrWString, _StringArray, ClrInt32, ClrInt32)


Concatenates the specified elements of a string array, using the specified separator between each element.

Syntax
Delphi

class function Join(ASeparator: ClrWString; AValue: _StringArray;


AStartIndex: ClrInt32; ACount: ClrInt32): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.27 LastIndexOf Method

This is the overview for the LastIndexOf method overload.

Overload List

Name Description

TClrStringHelper.LastIndexOf Reports the zero-based index position of the last occurrence of a


(ClrWString, ClrChar) specified wide character within this instance.

TClrStringHelper.LastIndexOf Reports the zero-based index position of the last occurrence of a


(ClrWString, ClrChar, specified Unicode character within this instance. The search starts at a
specified character position and proceeds backward toward the
ClrInt32)
beginning of the string.

TClrStringHelper.LastIndexOf Reports the zero-based index position of the last occurrence of the
(ClrWString, ClrChar, specified Unicode character in a substring within this instance. The
search starts at a specified character position and proceeds backward
ClrInt32, ClrInt32)
toward the beginning of the string for a specified number of character

967
.Net Runtime Library for Delphi

Name Description

positions.

TClrStringHelper.LastIndexOf Reports the zero-based index position of the last occurrence of a


(ClrWString, ClrWChar) specified Unicode character within this instance.

TClrStringHelper.LastIndexOf Reports the zero-based index position of the last occurrence of a


(ClrWString, ClrWChar, specified wide character within this instance. The search starts at a
specified character position and proceeds backward toward the
ClrInt32)
beginning of the string.

TClrStringHelper.LastIndexOf Reports the zero-based index position of the last occurrence of the
(ClrWString, ClrWChar, specified Unicode character in a substring within this instance. The
search starts at a specified character position and proceeds backward
ClrInt32, ClrInt32)
toward the beginning of the string for a specified number of character
positions.

TClrStringHelper.LastIndexOf Reports the zero-based index position of the last occurrence of a


(ClrWString, ClrWString) specified string within this instance.

TClrStringHelper.LastIndexOf Reports the zero-based index position of the last occurrence of a


(ClrWString, ClrWString, specified string within this instance. The search starts at a specified
character position and proceeds backward toward the beginning of
ClrInt32)
the string.

TClrStringHelper.LastIndexOf Reports the zero-based index position of the last occurrence of a


(ClrWString, ClrWString, specified string within this instance. The search starts at a specified
character position and proceeds backward toward the beginning of
ClrInt32, ClrInt32)
the string for a specified number of character positions.

TClrStringHelper.LastIndexOf Reports the zero-based index position of the last occurrence of a


(ClrWString, ClrWString, specified string within this instance. The search starts at a specified
character position and proceeds backward toward the beginning of
ClrInt32, ClrInt32,
the string for the specified number of character positions. A parameter
TStringComparison)
specifies the type of comparison to perform when searching for the
specified string.

TClrStringHelper.LastIndexOf Reports the zero-based index of the last occurrence of a specified


(ClrWString, ClrWString, string within the current String object. The search starts at a specified
character position and proceeds backward toward the beginning of
ClrInt32, TStringComparison)
the string. A parameter specifies the type of comparison to perform
when searching for the specified string.

TClrStringHelper.LastIndexOf Reports the zero-based index of the last occurrence of a specified


(ClrWString, ClrWString, string within the current String object. A parameter specifies the type
of search to use for the specified string.
TStringComparison)

7.1.1.8.1.1.16.1.27 TClrStringHelper.LastIndexOf Method (ClrWString, ClrChar)

968
.Net Runtime Library for Delphi

Reports the zero-based index position of the last occurrence of a specified wide character within this instance.

Syntax
Delphi

class function LastIndexOf(S: ClrWString; AValue: ClrChar): ClrInt32;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.27 TClrStringHelper.LastIndexOf Method (ClrWString, ClrChar, ClrInt32)


Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance. The
search starts at a specified character position and proceeds backward toward the beginning of the string.

Syntax
Delphi

class function LastIndexOf(S: ClrWString; AValue: ClrChar;


AStartIndex: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.27 TClrStringHelper.LastIndexOf Method (ClrWString, ClrChar, ClrInt32,


ClrInt32)
Reports the zero-based index position of the last occurrence of the specified Unicode character in a substring within
this instance. The search starts at a specified character position and proceeds backward toward the beginning of the
string for a specified number of character positions.

Syntax
Delphi

class function LastIndexOf(S: ClrWString; AValue: ClrChar;


AStartIndex: ClrInt32; ACount: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.27 TClrStringHelper.LastIndexOf Method (ClrWString, ClrWChar)


Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance.

969
.Net Runtime Library for Delphi

Syntax
Delphi

class function LastIndexOf(S: ClrWString; AValue: ClrWChar): ClrInt32;


overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.27 TClrStringHelper.LastIndexOf Method (ClrWString, ClrWChar, ClrInt32)


Reports the zero-based index position of the last occurrence of a specified wide character within this instance. The
search starts at a specified character position and proceeds backward toward the beginning of the string.

Syntax
Delphi

class function LastIndexOf(S: ClrWString; AValue: ClrWChar;


AStartIndex: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.27 TClrStringHelper.LastIndexOf Method (ClrWString, ClrWChar, ClrInt32,


ClrInt32)
Reports the zero-based index position of the last occurrence of the specified Unicode character in a substring within
this instance. The search starts at a specified character position and proceeds backward toward the beginning of the
string for a specified number of character positions.

Syntax
Delphi

class function LastIndexOf(S: ClrWString; AValue: ClrWChar;


AStartIndex: ClrInt32; ACount: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.27 TClrStringHelper.LastIndexOf Method (ClrWString, ClrWString)


Reports the zero-based index position of the last occurrence of a specified string within this instance.

Syntax

970
.Net Runtime Library for Delphi

Delphi

class function LastIndexOf(S: ClrWString; AValue: ClrWString):


ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.27 TClrStringHelper.LastIndexOf Method (ClrWString, ClrWString, ClrInt32)


Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts
at a specified character position and proceeds backward toward the beginning of the string.

Syntax
Delphi

class function LastIndexOf(S: ClrWString; AValue: ClrWString;


AStartIndex: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.27 TClrStringHelper.LastIndexOf Method (ClrWString, ClrWString, ClrInt32,


ClrInt32)
Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts
at a specified character position and proceeds backward toward the beginning of the string for a specified number of
character positions.

Syntax
Delphi

class function LastIndexOf(S: ClrWString; AValue: ClrWString;


AStartIndex: ClrInt32; ACount: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.27 TClrStringHelper.LastIndexOf Method (ClrWString, ClrWString, ClrInt32,


ClrInt32, TStringComparison)
Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts
at a specified character position and proceeds backward toward the beginning of the string for the specified number of
character positions. A parameter specifies the type of comparison to perform when searching for the specified string.

Syntax

971
.Net Runtime Library for Delphi

Delphi

class function LastIndexOf(S: ClrWString; AValue: ClrWString;


AStartIndex: ClrInt32; ACount: ClrInt32; AComparisonType:
TStringComparison): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.27 TClrStringHelper.LastIndexOf Method (ClrWString, ClrWString, ClrInt32,


TStringComparison)
Reports the zero-based index of the last occurrence of a specified string within the current String object. The search
starts at a specified character position and proceeds backward toward the beginning of the string. A parameter specifies
the type of comparison to perform when searching for the specified string.

Syntax
Delphi

class function LastIndexOf(S: ClrWString; AValue: ClrWString;


AStartIndex: ClrInt32; AComparisonType: TStringComparison): ClrInt32;
overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.27 TClrStringHelper.LastIndexOf Method (ClrWString, ClrWString,


TStringComparison)
Reports the zero-based index of the last occurrence of a specified string within the current String object. A parameter
specifies the type of search to use for the specified string.

Syntax
Delphi

class function LastIndexOf(S: ClrWString; AValue: ClrWString;


AComparisonType: TStringComparison): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.28 LastIndexOfAny Method

This is the overview for the LastIndexOfAny method overload.

Overload List

972
.Net Runtime Library for Delphi

Name Description

TClrStringHelper.LastIndexOfAny Reports the zero-based index position of the last occurrence in this
(ClrWString, instance of one or more characters specified in a dynamic Unicode
array.
TClrWCharDynArray)

TClrStringHelper.LastIndexOfAny Reports the zero-based index position of the last occurrence in this
(ClrWString, instance of one or more characters specified in a dynamic Unicode
array. The search starts at a specified character position and
TClrWCharDynArray, ClrInt32)
proceeds backward toward the beginning of the string.

TClrStringHelper.LastIndexOfAny Reports the zero-based index position of the last occurrence in this
(ClrWString, instance of one or more characters specified in a dynamic Unicode
array. The search starts at a specified character position and
TClrWCharDynArray, ClrInt32,
proceeds backward toward the beginning of the string for a
ClrInt32)
specified number of character positions.

TClrStringHelper.LastIndexOfAny Reports the zero-based index position of the last occurrence in this
(ClrWString, _CharArray) instance of one or more characters specified in a Unicode array.

TClrStringHelper.LastIndexOfAny Reports the zero-based index position of the last occurrence in this
(ClrWString, _CharArray, instance of one or more characters specified in a Unicode array. The
search starts at a specified character position and proceeds
ClrInt32)
backward toward the beginning of the string.

TClrStringHelper.LastIndexOfAny Reports the zero-based index position of the last occurrence in this
(ClrWString, _CharArray, instance of one or more characters specified in a Unicode array. The
search starts at a specified character position and proceeds
ClrInt32, ClrInt32)
backward toward the beginning of the string for a specified number
of character positions.

7.1.1.8.1.1.16.1.28 TClrStringHelper.LastIndexOfAny Method (ClrWString,


TClrWCharDynArray)
Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a
dynamic Unicode array.

Syntax
Delphi

class function LastIndexOfAny(S: ClrWString; AAnyOf:


TClrWCharDynArray): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

973
.Net Runtime Library for Delphi

7.1.1.8.1.1.16.1.28 TClrStringHelper.LastIndexOfAny Method (ClrWString, TClrWCharDynArray,


ClrInt32)
Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a
dynamic Unicode array. The search starts at a specified character position and proceeds backward toward the beginning
of the string.

Syntax
Delphi

class function LastIndexOfAny(S: ClrWString; AAnyOf:


TClrWCharDynArray; AStartIndex: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.28 TClrStringHelper.LastIndexOfAny Method (ClrWString, TClrWCharDynArray,


ClrInt32, ClrInt32)
Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a
dynamic Unicode array. The search starts at a specified character position and proceeds backward toward the beginning
of the string for a specified number of character positions.

Syntax
Delphi

class function LastIndexOfAny(S: ClrWString; AAnyOf:


TClrWCharDynArray; AStartIndex: ClrInt32; ACount: ClrInt32): ClrInt32;
overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.28 TClrStringHelper.LastIndexOfAny Method (ClrWString, _CharArray)


Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a
Unicode array.

Syntax
Delphi

class function LastIndexOfAny(S: ClrWString; AAnyOf: _CharArray):


ClrInt32; overload;

See Also

974
.Net Runtime Library for Delphi

TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.28 TClrStringHelper.LastIndexOfAny Method (ClrWString, _CharArray,


ClrInt32)
Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a
Unicode array. The search starts at a specified character position and proceeds backward toward the beginning of the
string.

Syntax
Delphi

class function LastIndexOfAny(S: ClrWString; AAnyOf: _CharArray;


AStartIndex: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.28 TClrStringHelper.LastIndexOfAny Method (ClrWString, _CharArray,


ClrInt32, ClrInt32)
Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a
Unicode array. The search starts at a specified character position and proceeds backward toward the beginning of the
string for a specified number of character positions.

Syntax
Delphi

class function LastIndexOfAny(S: ClrWString; AAnyOf: _CharArray;


AStartIndex: ClrInt32; ACount: ClrInt32): ClrInt32; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.29 Normalize Method

This is the overview for the Normalize method overload.

Overload List

Name Description

TClrStringHelper.Normalize Returns a new string whose textual value is the same as this string, but
(ClrWString) whose binary representation is in Unicode normalization form C.

975
.Net Runtime Library for Delphi

Name Description

TClrStringHelper.Normalize Returns a new string whose textual value is the same as this string, but
(ClrWString, whose binary representation is in the specified Unicode normalization
form.
TNormalizationForm)

7.1.1.8.1.1.16.1.29 TClrStringHelper.Normalize Method (ClrWString)


Returns a new string whose textual value is the same as this string, but whose binary representation is in Unicode
normalization form C.

Syntax
Delphi

class function Normalize(S: ClrWString): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.29 TClrStringHelper.Normalize Method (ClrWString, TNormalizationForm)


Returns a new string whose textual value is the same as this string, but whose binary representation is in the specified
Unicode normalization form.

Syntax
Delphi

class function Normalize(S: ClrWString; ANormalizationForm:


TNormalizationForm): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.30 PadLeft Method

This is the overview for the PadLeft method overload.

Overload List

Name Description

TClrStringHelper.PadLeft Returns a new string that right-aligns the characters in this instance by
(ClrWString, ClrInt32) padding them with spaces on the left, for a specified total length.

976
.Net Runtime Library for Delphi

Name Description

TClrStringHelper.PadLeft Returns a new string that right-aligns the characters in this instance by
(ClrWString, ClrInt32, padding them on the left with a specified Unicode character, for a
specified total length.
ClrChar)

TClrStringHelper.PadLeft Returns a new string that right-aligns the characters in this instance by
(ClrWString, ClrInt32, padding them on the left with a specified Unicode character, for a
specified total length.
ClrWChar)

7.1.1.8.1.1.16.1.30 TClrStringHelper.PadLeft Method (ClrWString, ClrInt32)


Returns a new string that right-aligns the characters in this instance by padding them with spaces on the left, for a
specified total length.

Syntax
Delphi

class function PadLeft(S: ClrWString; ATotalWidth: ClrInt32):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.30 TClrStringHelper.PadLeft Method (ClrWString, ClrInt32, ClrChar)


Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified
Unicode character, for a specified total length.

Syntax
Delphi

class function PadLeft(S: ClrWString; ATotalWidth: ClrInt32;


APaddingChar: ClrChar): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.30 TClrStringHelper.PadLeft Method (ClrWString, ClrInt32, ClrWChar)


Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified
Unicode character, for a specified total length.

Syntax

977
.Net Runtime Library for Delphi

Delphi

class function PadLeft(S: ClrWString; ATotalWidth: ClrInt32;


APaddingChar: ClrWChar): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.31 PadRight Method

This is the overview for the PadRight method overload.

Overload List

Name Description

TClrStringHelper.PadRight Returns a new string that left-aligns the characters in this string by
(ClrWString, ClrInt32) padding them with spaces on the right, for a specified total length.

TClrStringHelper.PadRight Returns a new string that left-aligns the characters in this string by
(ClrWString, ClrInt32, padding them on the right with a specified Unicode character, for a
specified total length.
ClrChar)

TClrStringHelper.PadRight Returns a new string that left-aligns the characters in this string by
(ClrWString, ClrInt32, padding them on the right with a specified Unicode character, for a
specified total length.
ClrWChar)

7.1.1.8.1.1.16.1.31 TClrStringHelper.PadRight Method (ClrWString, ClrInt32)


Returns a new string that left-aligns the characters in this string by padding them with spaces on the right, for a
specified total length.

Syntax
Delphi

class function PadRight(S: ClrWString; ATotalWidth: ClrInt32):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.31 TClrStringHelper.PadRight Method (ClrWString, ClrInt32, ClrChar)


Returns a new string that left-aligns the characters in this string by padding them on the right with a specified Unicode
character, for a specified total length.

978
.Net Runtime Library for Delphi

Syntax
Delphi

class function PadRight(S: ClrWString; ATotalWidth: ClrInt32;


APaddingChar: ClrChar): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.31 TClrStringHelper.PadRight Method (ClrWString, ClrInt32, ClrWChar)


Returns a new string that left-aligns the characters in this string by padding them on the right with a specified Unicode
character, for a specified total length.

Syntax
Delphi

class function PadRight(S: ClrWString; ATotalWidth: ClrInt32;


APaddingChar: ClrWChar): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.32 Remove Method

This is the overview for the Remove method overload.

Overload List

Name Description

TClrStringHelper.Remove Returns a new string in which all the characters in the current instance,
(ClrWString, ClrInt32) beginning at a specified position and continuing through the last
position, have been deleted.

TClrStringHelper.Remove Returns a new string in which a specified number of characters in the


(ClrWString, ClrInt32, current instance beginning at a specified position have been deleted.

ClrInt32)

7.1.1.8.1.1.16.1.32 TClrStringHelper.Remove Method (ClrWString, ClrInt32)


Returns a new string in which all the characters in the current instance, beginning at a specified position and continuing
through the last position, have been deleted.

979
.Net Runtime Library for Delphi

Syntax
Delphi

class function Remove(S: ClrWString; AStartIndex: ClrInt32):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.32 TClrStringHelper.Remove Method (ClrWString, ClrInt32, ClrInt32)


Returns a new string in which a specified number of characters in the current instance beginning at a specified position
have been deleted.

Syntax
Delphi

class function Remove(S: ClrWString; AStartIndex: ClrInt32; ACount:


ClrInt32): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.33 Replace Method

This is the overview for the Replace method overload.

Overload List

Name Description

TClrStringHelper.Replace Returns a new string in which all occurrences of a specified Unicode


(ClrWString, ClrChar, character in this instance are replaced with another specified Unicode
character.
ClrChar)

TClrStringHelper.Replace Returns a new string in which all occurrences of a specified Unicode


(ClrWString, ClrChar, character in this instance are replaced with another specified Unicode
character.
ClrWChar)

TClrStringHelper.Replace Returns a new string in which all occurrences of a specified Unicode


(ClrWString, ClrWChar, character in this instance are replaced with another specified Unicode
character.
ClrChar)

TClrStringHelper.Replace Returns a new string in which all occurrences of a specified Unicode

980
.Net Runtime Library for Delphi

Name Description

(ClrWString, ClrWChar, character in this instance are replaced with another specified Unicode
ClrWChar) character.

TClrStringHelper.Replace Returns a new string in which all occurrences of a specified string in


(ClrWString, ClrWString, the current instance are replaced with another specified string.

ClrWString)

7.1.1.8.1.1.16.1.33 TClrStringHelper.Replace Method (ClrWString, ClrChar, ClrChar)


Returns a new string in which all occurrences of a specified Unicode character in this instance are replaced with another
specified Unicode character.

Syntax
Delphi

class function Replace(S: ClrWString; AOldChar: ClrChar; ANewChar:


ClrChar): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.33 TClrStringHelper.Replace Method (ClrWString, ClrChar, ClrWChar)


Returns a new string in which all occurrences of a specified Unicode character in this instance are replaced with another
specified Unicode character.

Syntax
Delphi

class function Replace(S: ClrWString; AOldChar: ClrChar; ANewChar:


ClrWChar): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.33 TClrStringHelper.Replace Method (ClrWString, ClrWChar, ClrChar)


Returns a new string in which all occurrences of a specified Unicode character in this instance are replaced with another
specified Unicode character.

Syntax
Delphi

981
.Net Runtime Library for Delphi

class function Replace(S: ClrWString; AOldChar: ClrWChar; ANewChar:


ClrChar): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.33 TClrStringHelper.Replace Method (ClrWString, ClrWChar, ClrWChar)


Returns a new string in which all occurrences of a specified Unicode character in this instance are replaced with another
specified Unicode character.

Syntax
Delphi

class function Replace(S: ClrWString; AOldChar: ClrWChar; ANewChar:


ClrWChar): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.33 TClrStringHelper.Replace Method (ClrWString, ClrWString, ClrWString)


Returns a new string in which all occurrences of a specified string in the current instance are replaced with another
specified string.

Syntax
Delphi

class function Replace(S: ClrWString; AOldValue: ClrWString;


ANewValue: ClrWString): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.34 Split Method

This is the overview for the Split method overload.

Overload List

Name Description

TClrStringHelper.Split Splits a string into substrings that are based on the characters in an
(ClrWString, array.

982
.Net Runtime Library for Delphi

Name Description

TClrWCharDynArray)

TClrStringHelper.Split Splits a string into a maximum number of substrings based on the


(ClrWString, characters in an array. You also specify the maximum number of
substrings to return.
TClrWCharDynArray,
ClrInt32)

TClrStringHelper.Split Splits a string into a maximum number of substrings based on the


(ClrWString, characters in an array.

TClrWCharDynArray,
ClrInt32,
TStringSplitOptions)

TClrStringHelper.Split Splits a string into substrings based on the characters in an array. You
(ClrWString, can specify whether the substrings include empty array elements.

TClrWCharDynArray,
TStringSplitOptions)

TClrStringHelper.Split Splits a string into a maximum number of substrings based on the


(ClrWString, strings in an array. You can specify whether the substrings include
empty array elements.
TClrWStringDynArray,
ClrInt32,
TStringSplitOptions)

TClrStringHelper.Split Splits a string into substrings based on the strings in an array. You can
(ClrWString, specify whether the substrings include empty array elements.

TClrWStringDynArray,
TStringSplitOptions)

TClrStringHelper.Split Splits a string into substrings that are based on the characters in an
(ClrWString, _CharArray) array.

TClrStringHelper.Split Splits a string into a maximum number of substrings based on the


(ClrWString, _CharArray, characters in an array. You also specify the maximum number of
substrings to return.
ClrInt32)

TClrStringHelper.Split Splits a string into a maximum number of substrings based on the


(ClrWString, _CharArray, characters in an array.

ClrInt32,
TStringSplitOptions)

TClrStringHelper.Split Splits a string into substrings based on the characters in an array. You
(ClrWString, _CharArray, can specify whether the substrings include empty array elements.

TStringSplitOptions)

983
.Net Runtime Library for Delphi

Name Description

TClrStringHelper.Split Splits a string into a maximum number of substrings based on the


(ClrWString, _StringArray, strings in an array. You can specify whether the substrings include
empty array elements.
ClrInt32,
TStringSplitOptions)

TClrStringHelper.Split Splits a string into substrings based on the strings in an array. You can
(ClrWString, _StringArray, specify whether the substrings include empty array elements.

TStringSplitOptions)

7.1.1.8.1.1.16.1.34 TClrStringHelper.Split Method (ClrWString, TClrWCharDynArray)


Splits a string into substrings that are based on the characters in an array.

Syntax
Delphi

class function Split(S: ClrWString; ASeparator: TClrWCharDynArray):


_StringArray; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.34 TClrStringHelper.Split Method (ClrWString, TClrWCharDynArray, ClrInt32)


Splits a string into a maximum number of substrings based on the characters in an array. You also specify the maximum
number of substrings to return.

Syntax
Delphi

class function Split(S: ClrWString; ASeparator: TClrWCharDynArray;


ACount: ClrInt32): _StringArray; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.34 TClrStringHelper.Split Method (ClrWString, TClrWCharDynArray, ClrInt32,


TStringSplitOptions)
Splits a string into a maximum number of substrings based on the characters in an array.

Syntax

984
.Net Runtime Library for Delphi

Delphi

class function Split(S: ClrWString; ASeparator: TClrWCharDynArray;


ACount: ClrInt32; AOptions: TStringSplitOptions): _StringArray;
overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.34 TClrStringHelper.Split Method (ClrWString, TClrWCharDynArray,


TStringSplitOptions)
Splits a string into substrings based on the characters in an array. You can specify whether the substrings include empty
array elements.

Syntax
Delphi

class function Split(S: ClrWString; ASeparator: TClrWCharDynArray;


AOptions: TStringSplitOptions): _StringArray; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.34 TClrStringHelper.Split Method (ClrWString, TClrWStringDynArray, ClrInt32,


TStringSplitOptions)
Splits a string into a maximum number of substrings based on the strings in an array. You can specify whether the
substrings include empty array elements.

Syntax
Delphi

class function Split(S: ClrWString; ASeparator: TClrWStringDynArray;


ACount: ClrInt32; AOptions: TStringSplitOptions): _StringArray;
overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.34 TClrStringHelper.Split Method (ClrWString, TClrWStringDynArray,


TStringSplitOptions)
Splits a string into substrings based on the strings in an array. You can specify whether the substrings include empty
array elements.

985
.Net Runtime Library for Delphi

Syntax
Delphi

class function Split(S: ClrWString; ASeparator: TClrWStringDynArray;


AOptions: TStringSplitOptions): _StringArray; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.34 TClrStringHelper.Split Method (ClrWString, _CharArray)


Splits a string into substrings that are based on the characters in an array.

Syntax
Delphi

class function Split(S: ClrWString; ASeparator: _CharArray):


_StringArray; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.34 TClrStringHelper.Split Method (ClrWString, _CharArray, ClrInt32)


Splits a string into a maximum number of substrings based on the characters in an array. You also specify the maximum
number of substrings to return.

Syntax
Delphi

class function Split(S: ClrWString; ASeparator: _CharArray; ACount:


ClrInt32): _StringArray; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.34 TClrStringHelper.Split Method (ClrWString, _CharArray, ClrInt32,


TStringSplitOptions)
Splits a string into a maximum number of substrings based on the characters in an array.

Syntax
Delphi

986
.Net Runtime Library for Delphi

class function Split(S: ClrWString; ASeparator: _CharArray; ACount:


ClrInt32; AOptions: TStringSplitOptions): _StringArray; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.34 TClrStringHelper.Split Method (ClrWString, _CharArray,


TStringSplitOptions)
Splits a string into substrings based on the characters in an array. You can specify whether the substrings include empty
array elements.

Syntax
Delphi

class function Split(S: ClrWString; ASeparator: _CharArray; AOptions:


TStringSplitOptions): _StringArray; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.34 TClrStringHelper.Split Method (ClrWString, _StringArray, ClrInt32,


TStringSplitOptions)
Splits a string into a maximum number of substrings based on the strings in an array. You can specify whether the
substrings include empty array elements.

Syntax
Delphi

class function Split(S: ClrWString; ASeparator: _StringArray; ACount:


ClrInt32; AOptions: TStringSplitOptions): _StringArray; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.34 TClrStringHelper.Split Method (ClrWString, _StringArray,


TStringSplitOptions)
Splits a string into substrings based on the strings in an array. You can specify whether the substrings include empty
array elements.

Syntax
Delphi

987
.Net Runtime Library for Delphi

class function Split(S: ClrWString; ASeparator: _StringArray;


AOptions: TStringSplitOptions): _StringArray; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.35 StartsWith Method

This is the overview for the StartsWith method overload.

Overload List

Name Description

TClrStringHelper.StartsWith Determines whether the beginning of this string instance matches the
(ClrWString, ClrWString) specified string.

TClrStringHelper.StartsWith Determines whether the beginning of this string instance matches the
(ClrWString, ClrWString, specified string when compared using the specified culture.

ClrBoolean, _CultureInfo)

TClrStringHelper.StartsWith Determines whether the beginning of this string instance matches the
(ClrWString, ClrWString, specified string when compared using the specified comparison
option.
TStringComparison)

7.1.1.8.1.1.16.1.35 TClrStringHelper.StartsWith Method (ClrWString, ClrWString)


Determines whether the beginning of this string instance matches the specified string.

Syntax
Delphi

class function StartsWith(S: ClrWString; AValue: ClrWString):


ClrBoolean; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.35 TClrStringHelper.StartsWith Method (ClrWString, ClrWString, ClrBoolean,


_CultureInfo)
Determines whether the beginning of this string instance matches the specified string when compared using the
specified culture.

988
.Net Runtime Library for Delphi

Syntax
Delphi

class function StartsWith(S: ClrWString; AValue: ClrWString;


AIgnoreCase: ClrBoolean; ACulture: _CultureInfo): ClrBoolean;
overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.35 TClrStringHelper.StartsWith Method (ClrWString, ClrWString,


TStringComparison)
Determines whether the beginning of this string instance matches the specified string when compared using the
specified comparison option.

Syntax
Delphi

class function StartsWith(S: ClrWString; AValue: ClrWString;


AComparisonType: TStringComparison): ClrBoolean; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.36 Substring Method

This is the overview for the Substring method overload.

Overload List

Name Description

TClrStringHelper.Substring Retrieves a substring from this instance. The substring starts at a


(ClrWString, ClrInt32) specified character position and continues to the end of the string.

TClrStringHelper.Substring Retrieves a substring from this instance. The substring starts at a


(ClrWString, ClrInt32, specified character position and has a specified length.

ClrInt32)

7.1.1.8.1.1.16.1.36 TClrStringHelper.Substring Method (ClrWString, ClrInt32)


Retrieves a substring from this instance. The substring starts at a specified character position and continues to the end
of the string.

989
.Net Runtime Library for Delphi

Syntax
Delphi

class function Substring(S: ClrWString; AStartIndex: ClrInt32):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.36 TClrStringHelper.Substring Method (ClrWString, ClrInt32, ClrInt32)


Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length.

Syntax
Delphi

class function Substring(S: ClrWString; AStartIndex: ClrInt32;


ALength: ClrInt32): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.37 ToCharArray Method

This is the overview for the ToCharArray method overload.

Overload List

Name Description

TClrStringHelper.ToCharArray Copies the characters in this instance to a Unicode character array.


(ClrWString)

TClrStringHelper.ToCharArray Copies the characters in a specified substring in this instance to a


(ClrWString, ClrInt32, Unicode character array.

ClrInt32)

7.1.1.8.1.1.16.1.37 TClrStringHelper.ToCharArray Method (ClrWString)


Copies the characters in this instance to a Unicode character array.

Syntax

990
.Net Runtime Library for Delphi

Delphi

class function ToCharArray(S: ClrWString): _CharArray; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.37 TClrStringHelper.ToCharArray Method (ClrWString, ClrInt32, ClrInt32)


Copies the characters in a specified substring in this instance to a Unicode character array.

Syntax
Delphi

class function ToCharArray(S: ClrWString; AStartIndex: ClrInt32;


ALength: ClrInt32): _CharArray; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.38 ToCharDynArray Method

This is the overview for the ToCharDynArray method overload.

Overload List

Name Description

TClrStringHelper.ToCharDynArray Copies the characters in this instance to a dynamic character array.


(ClrWString)

TClrStringHelper.ToCharDynArray Copies the characters in a specified substring in this instance to a


(ClrWString, ClrInt32, ClrInt32) dynamic character array.

7.1.1.8.1.1.16.1.38 TClrStringHelper.ToCharDynArray Method (ClrWString)


Copies the characters in this instance to a dynamic character array.

Syntax
Delphi

class function ToCharDynArray(S: ClrWString): TClrWCharDynArray;


overload;

991
.Net Runtime Library for Delphi

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.38 TClrStringHelper.ToCharDynArray Method (ClrWString, ClrInt32, ClrInt32)


Copies the characters in a specified substring in this instance to a dynamic character array.

Syntax
Delphi

class function ToCharDynArray(S: ClrWString; AStartIndex: ClrInt32;


ALength: ClrInt32): TClrWCharDynArray; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.39 ToLower Method

This is the overview for the ToLower method overload.

Overload List

Name Description

TClrStringHelper.ToLower Returns a copy of this string converted to lowercase.


(ClrWString)

TClrStringHelper.ToLower Returns a copy of this string to lowercase, using the casing rules of the
(ClrWString, _CultureInfo) specified culture.

7.1.1.8.1.1.16.1.39 TClrStringHelper.ToLower Method (ClrWString)


Returns a copy of this string converted to lowercase.

Syntax
Delphi

class function ToLower(S: ClrWString): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

992
.Net Runtime Library for Delphi

7.1.1.8.1.1.16.1.39 TClrStringHelper.ToLower Method (ClrWString, _CultureInfo)


Returns a copy of this string to lowercase, using the casing rules of the specified culture.

Syntax
Delphi

class function ToLower(S: ClrWString; ACulture: _CultureInfo):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.40 TClrStringHelper.ToLowerInvariant Method

Returns a copy of this String converted to lowercase using the casing rules of the invariant culture.

Syntax
Delphi

class function ToLowerInvariant(S: ClrWString): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.41 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrStringHelper.ToString Returns this instance of String; no actual conversion is performed.


(ClrWString)

TClrStringHelper.ToString Returns this instance of String; no actual conversion is performed.


(ClrWString,
IFormatProvider)

7.1.1.8.1.1.16.1.41 TClrStringHelper.ToString Method (ClrWString)


Returns this instance of String; no actual conversion is performed.

993
.Net Runtime Library for Delphi

Syntax
Delphi

class function ToString(S: ClrWString): ClrWString; overload;


reintroduce;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.41 TClrStringHelper.ToString Method (ClrWString, IFormatProvider)


Returns this instance of String; no actual conversion is performed.

Syntax
Delphi

class function ToString(S: ClrWString; AProvider: IFormatProvider):


ClrWString; overload; reintroduce;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.42 ToUpper Method

This is the overview for the ToUpper method overload.

Overload List

Name Description

TClrStringHelper.ToUpper Returns a copy of this string converted to uppercase.


(ClrWString)

TClrStringHelper.ToUpper Returns a copy of this string converted to uppercase, using the casing
(ClrWString, _CultureInfo) rules of the specified culture.

7.1.1.8.1.1.16.1.42 TClrStringHelper.ToUpper Method (ClrWString)


Returns a copy of this string converted to uppercase.

Syntax
Delphi

994
.Net Runtime Library for Delphi

class function ToUpper(S: ClrWString): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.42 TClrStringHelper.ToUpper Method (ClrWString, _CultureInfo)


Returns a copy of this string converted to uppercase, using the casing rules of the specified culture.

Syntax
Delphi

class function ToUpper(S: ClrWString; ACulture: _CultureInfo):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.43 Trim Method

This is the overview for the Trim method overload.

Overload List

Name Description

TClrStringHelper.Trim Removes all leading and trailing white-space characters from the
(ClrWString) current String.

TClrStringHelper.Trim Removes all leading and trailing occurrences of a set of characters


(ClrWString, specified in a dynamic array from the current String.

TClrWCharDynArray)

TClrStringHelper.Trim Removes all leading and trailing occurrences of a set of characters


(ClrWString, _CharArray) specified in an array from the current String.

7.1.1.8.1.1.16.1.43 TClrStringHelper.Trim Method (ClrWString)


Removes all leading and trailing white-space characters from the current String.

Syntax
Delphi

995
.Net Runtime Library for Delphi

class function Trim(S: ClrWString): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.43 TClrStringHelper.Trim Method (ClrWString, TClrWCharDynArray)


Removes all leading and trailing occurrences of a set of characters specified in a dynamic array from the current String.

Syntax
Delphi

class function Trim(S: ClrWString; ATrimChars: TClrWCharDynArray):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.43 TClrStringHelper.Trim Method (ClrWString, _CharArray)


Removes all leading and trailing occurrences of a set of characters specified in an array from the current String.

Syntax
Delphi

class function Trim(S: ClrWString; ATrimChars: _CharArray):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.44 TrimEnd Method

This is the overview for the TrimEnd method overload.

Overload List

Name Description

TClrStringHelper.TrimEnd Removes all trailing occurrences of a set of characters specified in a


(ClrWString, dynamic array from the current String.

TClrWCharDynArray)

996
.Net Runtime Library for Delphi

Name Description

TClrStringHelper.TrimEnd Removes all trailing occurrences of a set of characters specified in an


(ClrWString, _CharArray) array from the current String.

7.1.1.8.1.1.16.1.44 TClrStringHelper.TrimEnd Method (ClrWString, TClrWCharDynArray)


Removes all trailing occurrences of a set of characters specified in a dynamic array from the current String.

Syntax
Delphi

class function TrimEnd(S: ClrWString; ATrimChars: TClrWCharDynArray):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.44 TClrStringHelper.TrimEnd Method (ClrWString, _CharArray)


Removes all trailing occurrences of a set of characters specified in an array from the current String.

Syntax
Delphi

class function TrimEnd(S: ClrWString; ATrimChars: _CharArray):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.45 TrimStart Method

This is the overview for the TrimStart method overload.

Overload List

Name Description

TClrStringHelper.TrimStart Removes all leading occurrences of a set of characters specified in a


(ClrWString, dynamic array from the current String.

TClrWCharDynArray)

997
.Net Runtime Library for Delphi

Name Description

TClrStringHelper.TrimStart Removes all leading occurrences of a set of characters specified in an


(ClrWString, _CharArray) array from the current String.

7.1.1.8.1.1.16.1.45 TClrStringHelper.TrimStart Method (ClrWString, TClrWCharDynArray)


Removes all leading occurrences of a set of characters specified in a dynamic array from the current String.

Syntax
Delphi

class function TrimStart(S: ClrWString; ATrimChars:


TClrWCharDynArray): ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.16.1.45 TClrStringHelper.TrimStart Method (ClrWString, _CharArray)


Removes all leading occurrences of a set of characters specified in an array from the current String.

Syntax
Delphi

class function TrimStart(S: ClrWString; ATrimChars: _CharArray):


ClrWString; overload;

See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17 TClrUInt16Helper Class


Collapse All Expand All

Helper class for Word Data Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrUInt16Helper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

998
.Net Runtime Library for Delphi

Syntax
Delphi

TClrUInt16Helper = class;

Methods

Name Description

CompareTo(ClrUInt16, Compares this instance to a specified 16-bit unsigned integer


ClrUInt16) and returns an indication of their relative values.

CompareTo(ClrUInt16, Compares this instance to a specified variant and returns an


ClrVariant) indication of their relative values.

Equals(ClrInt16, ClrVariant) Returns a value indicating whether this instance is equal to a specified
variant.

Equals(ClrUInt16, ClrUInt16) Returns a value indicating whether this instance is equal to a specified
UInt16 value.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of UInt16.

MinValue Represents the smallest possible value of UInt16.

Parse(ClrWString) Converts the string representation of a number to its 16-bit unsigned


integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its 16-bit unsigned integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its 16-bit unsigned integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified


TNumberStyles, style and culture-specific format to its 16-bit unsigned
IFormatProvider) integer equivalent.

ToString(ClrInt16) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrInt16, Converts the numeric value of this instance to its equivalent string
ClrWString) representation using the specified format.

999
.Net Runtime Library for Delphi

Name Description

ToString(ClrInt16, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

ToString(ClrInt16, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Tries to convert the string representation of a number to its 16-bit


ClrUInt16) unsigned integer equivalent. A return value indicates whether the
conversion succeeded or failed.

TryParse(ClrWString, Tries to convert the string representation of a number in a


TNumberStyles, specified style and culture-specific format to its 16-bit
IFormatProvider, ClrUInt16) unsigned integer equivalent. A return value indicates
whether the conversion succeeded or failed.

See Also
TClrUInt16Helper Methods

7.1.1.8.1.1.17.1 TClrUInt16Helper Methods

The methods of the TClrUInt16Helper class are listed here.

Methods

Name Description

CompareTo(ClrUInt16, Compares this instance to a specified 16-bit unsigned integer and


ClrUInt16) returns an indication of their relative values.

CompareTo(ClrUInt16, Compares this instance to a specified variant and returns an indication


ClrVariant) of their relative values.

Equals(ClrInt16, ClrVariant) Returns a value indicating whether this instance is equal to a specified
variant.

Equals(ClrUInt16, ClrUInt16) Returns a value indicating whether this instance is equal to a specified
UInt16 value.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of UInt16.

1000
.Net Runtime Library for Delphi

Name Description

MinValue Represents the smallest possible value of UInt16.

Parse(ClrWString) Converts the string representation of a number to its 16-bit unsigned


integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its 16-bit unsigned integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its 16-bit unsigned integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 16-bit unsigned integer equivalent.

IFormatProvider)

ToString(ClrInt16) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrInt16, Converts the numeric value of this instance to its equivalent string
ClrWString) representation using the specified format.

ToString(ClrInt16, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

ToString(ClrInt16, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Tries to convert the string representation of a number to its 16-bit


ClrUInt16) unsigned integer equivalent. A return value indicates whether the
conversion succeeded or failed.

TryParse(ClrWString, Tries to convert the string representation of a number in a specified


TNumberStyles, style and culture-specific format to its 16-bit unsigned integer
equivalent. A return value indicates whether the conversion succeeded
IFormatProvider, ClrUInt16)
or failed.

7.1.1.8.1.1.17.1.1 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

1001
.Net Runtime Library for Delphi

Name Description

TClrUInt16Helper.CompareTo Compares this instance to a specified 16-bit unsigned integer and


(ClrUInt16, ClrUInt16) returns an indication of their relative values.

TClrUInt16Helper.CompareTo Compares this instance to a specified variant and returns an indication


(ClrUInt16, ClrVariant) of their relative values.

7.1.1.8.1.1.17.1.1 TClrUInt16Helper.CompareTo Method (ClrUInt16, ClrUInt16)


Compares this instance to a specified 16-bit unsigned integer and returns an indication of their relative values.

Syntax
Delphi

class function CompareTo(X: ClrUInt16; Y: ClrUInt16): ClrInt32;


overload;

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.1 TClrUInt16Helper.CompareTo Method (ClrUInt16, ClrVariant)


Compares this instance to a specified variant and returns an indication of their relative values.

Syntax
Delphi

class function CompareTo(Ui16: ClrUInt16; AValue: ClrVariant):


ClrInt32; overload;

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.2 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

1002
.Net Runtime Library for Delphi

Name Description

TClrUInt16Helper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrInt16, ClrVariant) variant.

TClrUInt16Helper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrUInt16, ClrUInt16) UInt16 value.

7.1.1.8.1.1.17.1.2 TClrUInt16Helper.Equals Method (ClrInt16, ClrVariant)


Returns a value indicating whether this instance is equal to a specified variant.

Syntax
Delphi

class function Equals(Ui16: ClrInt16; AObj: ClrVariant): ClrBoolean;


overload; reintroduce;

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.2 TClrUInt16Helper.Equals Method (ClrUInt16, ClrUInt16)


Returns a value indicating whether this instance is equal to a specified UInt16 value.

Syntax
Delphi

class function Equals(X: ClrUInt16; Y: ClrUInt16): ClrBoolean;


overload; reintroduce;

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.3 TClrUInt16Helper.GetHashCode Method

Returns the hash code for this instance.

Syntax
Delphi

class function GetHashCode(Ui16: ClrInt16): ClrInt32; reintroduce;

1003
.Net Runtime Library for Delphi

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.4 TClrUInt16Helper.MaxValue Method

Represents the largest possible value of UInt16.

Syntax
Delphi

class function MaxValue: ClrUInt16;

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.5 TClrUInt16Helper.MinValue Method

Represents the smallest possible value of UInt16.

Syntax
Delphi

class function MinValue: ClrUInt16;

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.6 Parse Method

This is the overview for the Parse method overload.

Overload List

Name Description

TClrUInt16Helper.Parse Converts the string representation of a number to its 16-bit unsigned


(ClrWString) integer equivalent.

TClrUInt16Helper.Parse Converts the string representation of a number in a specified culture-


(ClrWString, specific format to its 16-bit unsigned integer equivalent.

IFormatProvider)

1004
.Net Runtime Library for Delphi

Name Description

TClrUInt16Helper.Parse Converts the string representation of a number in a specified style to


(ClrWString, TNumberStyles) its 16-bit unsigned integer equivalent.

TClrUInt16Helper.Parse Converts the string representation of a number in a specified style and


(ClrWString, TNumberStyles, culture-specific format to its 16-bit unsigned integer equivalent.

IFormatProvider)

7.1.1.8.1.1.17.1.6 TClrUInt16Helper.Parse Method (ClrWString)


Converts the string representation of a number to its 16-bit unsigned integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString): ClrUInt16; overload;

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.6 TClrUInt16Helper.Parse Method (ClrWString, IFormatProvider)


Converts the string representation of a number in a specified culture-specific format to its 16-bit unsigned integer
equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AProvider: IFormatProvider):


ClrUInt16; overload;

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.6 TClrUInt16Helper.Parse Method (ClrWString, TNumberStyles)


Converts the string representation of a number in a specified style to its 16-bit unsigned integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles): ClrUInt16;


overload;

1005
.Net Runtime Library for Delphi

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.6 TClrUInt16Helper.Parse Method (ClrWString, TNumberStyles,


IFormatProvider)
Converts the string representation of a number in a specified style and culture-specific format to its 16-bit unsigned
integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles; AProvider:


IFormatProvider): ClrUInt16; overload;

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.7 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrUInt16Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt16) representation.

TClrUInt16Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt16, ClrWString) representation using the specified format.

TClrUInt16Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt16, ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

TClrUInt16Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrInt16, IFormatProvider) representation using the specified culture-specific format information.

7.1.1.8.1.1.17.1.7 TClrUInt16Helper.ToString Method (ClrInt16)


Converts the numeric value of this instance to its equivalent string representation.

Syntax

1006
.Net Runtime Library for Delphi

Delphi

class function ToString(Ui16: ClrInt16): ClrWString; overload;


reintroduce;

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.7 TClrUInt16Helper.ToString Method (ClrInt16, ClrWString)


Converts the numeric value of this instance to its equivalent string representation using the specified format.

Syntax
Delphi

class function ToString(Ui16: ClrInt16; AFormat: ClrWString):


ClrWString; overload; reintroduce;

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.7 TClrUInt16Helper.ToString Method (ClrInt16, ClrWString, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified format and
culture-specific format information.

Syntax
Delphi

class function ToString(Ui16: ClrInt16; AFormat: ClrWString;


AProvider: IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.7 TClrUInt16Helper.ToString Method (ClrInt16, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific
format information.

Syntax
Delphi

class function ToString(Ui16: ClrInt16; AProvider: IFormatProvider):


ClrWString; overload; reintroduce;

1007
.Net Runtime Library for Delphi

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.8 TryParse Method

This is the overview for the TryParse method overload.

Overload List

Name Description

TClrUInt16Helper.TryParse Tries to convert the string representation of a number to its 16-bit


(ClrWString, ClrUInt16) unsigned integer equivalent. A return value indicates whether the
conversion succeeded or failed.

TClrUInt16Helper.TryParse Tries to convert the string representation of a number in a specified


(ClrWString, TNumberStyles, style and culture-specific format to its 16-bit unsigned integer
equivalent. A return value indicates whether the conversion succeeded
IFormatProvider, ClrUInt16)
or failed.

7.1.1.8.1.1.17.1.8 TClrUInt16Helper.TryParse Method (ClrWString, ClrUInt16)


Tries to convert the string representation of a number to its 16-bit unsigned integer equivalent. A return value indicates
whether the conversion succeeded or failed.

Syntax
Delphi

class function TryParse(S: ClrWString; var AResult: ClrUInt16):


ClrBoolean; overload;

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.17.1.8 TClrUInt16Helper.TryParse Method (ClrWString, TNumberStyles,


IFormatProvider, ClrUInt16)
Tries to convert the string representation of a number in a specified style and culture-specific format to its 16-bit
unsigned integer equivalent. A return value indicates whether the conversion succeeded or failed.

Syntax
Delphi

1008
.Net Runtime Library for Delphi

class function TryParse(S: ClrWString; AStyle: TNumberStyles;


AProvider: IFormatProvider; var AResult: ClrUInt16): ClrBoolean;
overload;

See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18 TClrUInt32Helper Class


Collapse All Expand All

Helper class for LongInt Data Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrUInt32Helper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrUInt32Helper = class;

Methods

Name Description

CompareTo(ClrUInt32, Compares this instance to a specified 32-bit unsigned integer and


ClrUInt32) returns an indication of their relative values.

CompareTo(ClrUInt32, Compares this instance to a specified variant and returns an indication


ClrVariant) of their relative values.

Equals(ClrUInt32, ClrUInt32) Returns a value indicating whether this instance is equal to a specified
UInt32.

Equals(ClrUInt32, ClrVariant) Returns a value indicating whether this instance is equal to a specified
variant.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of UInt32.

1009
.Net Runtime Library for Delphi

Name Description

MinValue Represents the smallest possible value of UInt32.

Parse(ClrWString) Converts the string representation of a number to its 32-bit unsigned


integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its 32-bit unsigned integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its 32-bit unsigned integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 32-bit unsigned integer equivalent.

IFormatProvider)

ToString(ClrUInt32) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrUInt32, Converts the numeric value of this instance to its equivalent string
ClrWString) representation using the specified format.

ToString(ClrUInt32, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

ToString(ClrUInt32, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Tries to convert the string representation of a number to its 32-bit


ClrUInt32) unsigned integer equivalent. A return value indicates whether the
conversion succeeded or failed.

TryParse(ClrWString, Tries to convert the string representation of a number in a specified


TNumberStyles, style and culture-specific format to its 32-bit unsigned integer
equivalent. A return value indicates whether the conversion succeeded
IFormatProvider, ClrUInt32)
or failed.

See Also
TClrUInt32Helper Methods

7.1.1.8.1.1.18.1 TClrUInt32Helper Methods

The methods of the TClrUInt32Helper class are listed here.

Methods

1010
.Net Runtime Library for Delphi

Name Description

CompareTo(ClrUInt32, Compares this instance to a specified 32-bit unsigned integer and


ClrUInt32) returns an indication of their relative values.

CompareTo(ClrUInt32, Compares this instance to a specified variant and returns an indication


ClrVariant) of their relative values.

Equals(ClrUInt32, ClrUInt32) Returns a value indicating whether this instance is equal to a specified
UInt32 .

Equals(ClrUInt32, ClrVariant) Returns a value indicating whether this instance is equal to a specified
variant.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of UInt32 .

MinValue Represents the smallest possible value of UInt32 .

Parse(ClrWString) Converts the string representation of a number to its 32-bit unsigned


integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its 32-bit unsigned integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its 32-bit unsigned integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 32-bit unsigned integer equivalent.

IFormatProvider)

ToString(ClrUInt32) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrUInt32, Converts the numeric value of this instance to its equivalent string
ClrWString) representation using the specified format.

ToString(ClrUInt32, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

ToString(ClrUInt32, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

1011
.Net Runtime Library for Delphi

Name Description

TryParse(ClrWString, Tries to convert the string representation of a number to its 32-bit


ClrUInt32) unsigned integer equivalent. A return value indicates whether the
conversion succeeded or failed.

TryParse(ClrWString, Tries to convert the string representation of a number in a specified


TNumberStyles, style and culture-specific format to its 32-bit unsigned integer
equivalent. A return value indicates whether the conversion succeeded
IFormatProvider, ClrUInt32)
or failed.

7.1.1.8.1.1.18.1.1 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

Name Description

TClrUInt32Helper.CompareTo Compares this instance to a specified 32-bit unsigned integer and


(ClrUInt32, ClrUInt32) returns an indication of their relative values.

TClrUInt32Helper.CompareTo Compares this instance to a specified variant and returns an indication


(ClrUInt32, ClrVariant) of their relative values.

7.1.1.8.1.1.18.1.1 TClrUInt32Helper.CompareTo Method (ClrUInt32, ClrUInt32)


Compares this instance to a specified 32-bit unsigned integer and returns an indication of their relative values.

Syntax
Delphi

class function CompareTo(X: ClrUInt32; Y: ClrUInt32): ClrInt32;


overload;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.1 TClrUInt32Helper.CompareTo Method (ClrUInt32, ClrVariant)


Compares this instance to a specified variant and returns an indication of their relative values.

Syntax

1012
.Net Runtime Library for Delphi

Delphi

class function CompareTo(Ui32: ClrUInt32; AValue: ClrVariant):


ClrInt32; overload;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.2 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrUInt32Helper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrUInt32, ClrUInt32) UInt32 .

TClrUInt32Helper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrUInt32, ClrVariant) variant.

7.1.1.8.1.1.18.1.2 TClrUInt32Helper.Equals Method (ClrUInt32, ClrUInt32)


Returns a value indicating whether this instance is equal to a specified UInt32 .

Syntax
Delphi

class function Equals(X: ClrUInt32; Y: ClrUInt32): ClrBoolean;


overload; reintroduce;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.2 TClrUInt32Helper.Equals Method (ClrUInt32, ClrVariant)


Returns a value indicating whether this instance is equal to a specified variant.

Syntax
Delphi

class function Equals(Ui32: ClrUInt32; AObj: ClrVariant): ClrBoolean;


overload; reintroduce;

1013
.Net Runtime Library for Delphi

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.3 TClrUInt32Helper.GetHashCode Method

Returns the hash code for this instance.

Syntax
Delphi

class function GetHashCode(Ui32: ClrUInt32): ClrInt32; reintroduce;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.4 TClrUInt32Helper.MaxValue Method

Represents the largest possible value of UInt32 .

Syntax
Delphi

class function MaxValue: ClrUInt32;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.5 TClrUInt32Helper.MinValue Method

Represents the smallest possible value of UInt32 .

Syntax
Delphi

class function MinValue: ClrUInt32;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

1014
.Net Runtime Library for Delphi

7.1.1.8.1.1.18.1.6 Parse Method

This is the overview for the Parse method overload.

Overload List

Name Description

TClrUInt32Helper.Parse Converts the string representation of a number to its 32-bit unsigned


(ClrWString) integer equivalent.

TClrUInt32Helper.Parse Converts the string representation of a number in a specified culture-


(ClrWString, specific format to its 32-bit unsigned integer equivalent.

IFormatProvider)

TClrUInt32Helper.Parse Converts the string representation of a number in a specified style to


(ClrWString, TNumberStyles) its 32-bit unsigned integer equivalent.

TClrUInt32Helper.Parse Converts the string representation of a number in a specified style and


(ClrWString, TNumberStyles, culture-specific format to its 32-bit unsigned integer equivalent.

IFormatProvider)

7.1.1.8.1.1.18.1.6 TClrUInt32Helper.Parse Method (ClrWString)


Converts the string representation of a number to its 32-bit unsigned integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString): ClrUInt32; overload;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.6 TClrUInt32Helper.Parse Method (ClrWString, IFormatProvider)


Converts the string representation of a number in a specified culture-specific format to its 32-bit unsigned integer
equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AProvider: IFormatProvider):


ClrUInt32; overload;

1015
.Net Runtime Library for Delphi

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.6 TClrUInt32Helper.Parse Method (ClrWString, TNumberStyles)


Converts the string representation of a number in a specified style to its 32-bit unsigned integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles): ClrUInt32;


overload;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.6 TClrUInt32Helper.Parse Method (ClrWString, TNumberStyles,


IFormatProvider)
Converts the string representation of a number in a specified style and culture-specific format to its 32-bit unsigned
integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles; AProvider:


IFormatProvider): ClrUInt32; overload;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.7 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrUInt32Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrUInt32) representation.

TClrUInt32Helper.ToString Converts the numeric value of this instance to its equivalent string

1016
.Net Runtime Library for Delphi

Name Description

(ClrUInt32, ClrWString) representation using the specified format.

TClrUInt32Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrUInt32, ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

TClrUInt32Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrUInt32, IFormatProvider) representation using the specified culture-specific format information.

7.1.1.8.1.1.18.1.7 TClrUInt32Helper.ToString Method (ClrUInt32)


Converts the numeric value of this instance to its equivalent string representation.

Syntax
Delphi

class function ToString(Ui32: ClrUInt32): ClrWString; overload;


reintroduce;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.7 TClrUInt32Helper.ToString Method (ClrUInt32, ClrWString)


Converts the numeric value of this instance to its equivalent string representation using the specified format.

Syntax
Delphi

class function ToString(Ui32: ClrUInt32; AFormat: ClrWString):


ClrWString; overload; reintroduce;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.7 TClrUInt32Helper.ToString Method (ClrUInt32, ClrWString, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified format and
culture-specific format information.

Syntax

1017
.Net Runtime Library for Delphi

Delphi

class function ToString(Ui32: ClrUInt32; AFormat: ClrWString;


AProvider: IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.7 TClrUInt32Helper.ToString Method (ClrUInt32, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific
format information.

Syntax
Delphi

class function ToString(Ui32: ClrUInt32; AProvider: IFormatProvider):


ClrWString; overload; reintroduce;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.8 TryParse Method

This is the overview for the TryParse method overload.

Overload List

Name Description

TClrUInt32Helper.TryParse Tries to convert the string representation of a number to its 32-bit


(ClrWString, ClrUInt32) unsigned integer equivalent. A return value indicates whether the
conversion succeeded or failed.

TClrUInt32Helper.TryParse Tries to convert the string representation of a number in a specified


(ClrWString, TNumberStyles, style and culture-specific format to its 32-bit unsigned integer
equivalent. A return value indicates whether the conversion succeeded
IFormatProvider, ClrUInt32)
or failed.

7.1.1.8.1.1.18.1.8 TClrUInt32Helper.TryParse Method (ClrWString, ClrUInt32)


Tries to convert the string representation of a number to its 32-bit unsigned integer equivalent. A return value indicates
whether the conversion succeeded or failed.

Syntax

1018
.Net Runtime Library for Delphi

Delphi

class function TryParse(S: ClrWString; var AResult: ClrUInt32):


ClrBoolean; overload;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.18.1.8 TClrUInt32Helper.TryParse Method (ClrWString, TNumberStyles,


IFormatProvider, ClrUInt32)
Tries to convert the string representation of a number in a specified style and culture-specific format to its 32-bit
unsigned integer equivalent. A return value indicates whether the conversion succeeded or failed.

Syntax
Delphi

class function TryParse(S: ClrWString; AStyle: TNumberStyles;


AProvider: IFormatProvider; var AResult: CIUlnrt32): ClrBoolean;
overload;

See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19 TClrUInt64Helper Class


Collapse All Expand All

Helper class for LargeUInt Data Type.

Inheritance Hierarchy
CNClrLib.Host.Helper.TClrUInt64Helper

File: CNClrLib.Host.Helper.pas

Namespace: CNClrLib.Host.Helper

Syntax
Delphi

TClrUInt64Helper = class;

Methods

Name Description

1019
.Net Runtime Library for Delphi

Name Description

CompareTo(ClrUInt64, Compares this instance to a specified 64-bit unsigned integer and


ClrUInt64) returns an indication of their relative values.

CompareTo(ClrUInt64, Compares this instance to a specified variant and returns an indication


ClrVariant) of their relative values.

Equals(ClrUInt64, ClrUInt64) Returns a value indicating whether this instance is equal to a specified
UInt64 value.

Equals(ClrUInt64, ClrVariant) Returns a value indicating whether this instance is equal to a specified
variant.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of UInt64.

MinValue Represents the smallest possible value of UInt64.

Parse(ClrWString) Converts the string representation of a number to its 64-bit unsigned


integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified culture-


IFormatProvider) specific format to its 64-bit unsigned integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its 64-bit unsigned integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 64-bit unsigned integer equivalent.

IFormatProvider)

ToString(ClrUInt64) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrUInt64, Converts the numeric value of this instance to its equivalent string
ClrWString) representation using the specified format.

ToString(ClrUInt64, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

ToString(ClrUInt64, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

1020
.Net Runtime Library for Delphi

Name Description

TryParse(ClrWString, Tries to convert the string representation of a number to its 64-bit


ClrUInt64) unsigned integer equivalent. A return value indicates whether the
conversion succeeded or failed.

TryParse(ClrWString, Tries to convert the string representation of a number in a specified


TNumberStyles, style and culture-specific format to its 64-bit unsigned integer
equivalent. A return value indicates whether the conversion succeeded
IFormatProvider, ClrUInt64)
or failed.

See Also
TClrUInt64Helper Methods

7.1.1.8.1.1.19.1 TClrUInt64Helper Methods

The methods of the TClrUInt64Helper class are listed here.

Methods

Name Description

CompareTo(ClrUInt64, Compares this instance to a specified 64-bit unsigned integer


ClrUInt64) and returns an indication of their relative values.

CompareTo(ClrUInt64, Compares this instance to a specified variant and returns an indication


ClrVariant) of their relative values.

Equals(ClrUInt64, ClrUInt64) Returns a value indicating whether this instance is equal to a specified
UInt64 value.

Equals(ClrUInt64, ClrVariant) Returns a value indicating whether this instance is equal to a specified
variant.

GetHashCode Returns the hash code for this instance.

MaxValue Represents the largest possible value of UInt64.

MinValue Represents the smallest possible value of UInt64.

Parse(ClrWString) Converts the string representation of a number to its 64-bit unsigned


integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified


IFormatProvider) culture-specific format to its 64-bit unsigned integer
equivalent.

1021
.Net Runtime Library for Delphi

Name Description

Parse(ClrWString, Converts the string representation of a number in a specified style to


TNumberStyles) its 64-bit unsigned integer equivalent.

Parse(ClrWString, Converts the string representation of a number in a specified style and


TNumberStyles, culture-specific format to its 64-bit unsigned integer equivalent.

IFormatProvider)

ToString(ClrUInt64) Converts the numeric value of this instance to its equivalent string
representation.

ToString(ClrUInt64, Converts the numeric value of this instance to its equivalent string
ClrWString) representation using the specified format.

ToString(ClrUInt64, Converts the numeric value of this instance to its equivalent string
ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

ToString(ClrUInt64, Converts the numeric value of this instance to its equivalent string
IFormatProvider) representation using the specified culture-specific format information.

TryParse(ClrWString, Tries to convert the string representation of a number to its 64-bit


ClrUInt64) unsigned integer equivalent. A return value indicates whether the
conversion succeeded or failed.

TryParse(ClrWString, Tries to convert the string representation of a number in a specified


TNumberStyles, style and culture-specific format to its 64-bit unsigned integer
equivalent. A return value indicates whether the conversion succeeded
IFormatProvider, ClrUInt64)
or failed.

7.1.1.8.1.1.19.1.1 CompareTo Method

This is the overview for the CompareTo method overload.

Overload List

Name Description

TClrUInt64Helper.CompareTo Compares this instance to a specified 64-bit unsigned integer and


(ClrUInt64, ClrUInt64) returns an indication of their relative values.

TClrUInt64Helper.CompareTo Compares this instance to a specified variant and returns an indication


(ClrUInt64, ClrVariant) of their relative values.

1022
.Net Runtime Library for Delphi

7.1.1.8.1.1.19.1.1 TClrUInt64Helper.CompareTo Method (ClrUInt64, ClrUInt64)

Compares this instance to a specified 64-bit unsigned integer and returns an indication of their relative values.

Syntax
Delphi

class function CompareTo(X: ClrUInt64; Y: ClrUInt64): ClrInt32;


overload;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.1 TClrUInt64Helper.CompareTo Method (ClrUInt64, ClrVariant)


Compares this instance to a specified variant and returns an indication of their relative values.

Syntax
Delphi

class function CompareTo(Ui64: ClrUInt64; AValue: ClrVariant):


ClrInt32; overload;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.2 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrUInt64Helper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrUInt64, ClrUInt64) UInt64 value.

TClrUInt64Helper.Equals Returns a value indicating whether this instance is equal to a specified


(ClrUInt64, ClrVariant) variant.

7.1.1.8.1.1.19.1.2 TClrUInt64Helper.Equals Method (ClrUInt64, ClrUInt64)


Returns a value indicating whether this instance is equal to a specified UInt64 value.

1023
.Net Runtime Library for Delphi

Syntax
Delphi

class function Equals(X: ClrUInt64; Y: ClrUInt64): ClrBoolean;


overload; reintroduce;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.2 TClrUInt64Helper.Equals Method (ClrUInt64, ClrVariant)


Returns a value indicating whether this instance is equal to a specified variant.

Syntax
Delphi

class function Equals(Ui64: ClrUInt64; AObj: ClrVariant): ClrBoolean;


overload; reintroduce;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.3 TClrUInt64Helper.GetHashCode Method

Returns the hash code for this instance.

Syntax
Delphi

class function GetHashCode(Ui64: ClrUInt64): ClrInt32; reintroduce;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.4 TClrUInt64Helper.MaxValue Method


Represents the largest possible value of UInt64.

Syntax
Delphi

class function MaxValue: ClrUInt64;

1024
.Net Runtime Library for Delphi

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.5 TClrUInt64Helper.MinValue Method

Represents the smallest possible value of UInt64.

Syntax
Delphi

class function MinValue: ClrUInt64;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.6 Parse Method

This is the overview for the Parse method overload.

Overload List

Name Description

TClrUInt64Helper.Parse Converts the string representation of a number to its 64-bit unsigned


(ClrWString) integer equivalent.

TClrUInt64Helper.Parse Converts the string representation of a number in a specified


(ClrWString, culture-specific format to its 64-bit unsigned integer equivalent.
IFormatProvider)

TClrUInt64Helper.Parse Converts the string representation of a number in a specified style to


(ClrWString, TNumberStyles) its 64-bit unsigned integer equivalent.

TClrUInt64Helper.Parse Converts the string representation of a number in a specified style and


(ClrWString, TNumberStyles, culture-specific format to its 64-bit unsigned integer equivalent.

IFormatProvider)

7.1.1.8.1.1.19.1.6 TClrUInt64Helper.Parse Method (ClrWString)


Converts the string representation of a number to its 64-bit unsigned integer equivalent.

Syntax

1025
.Net Runtime Library for Delphi

Delphi

class function Parse(S: ClrWString): ClrUInt64; overload;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.6 TClrUInt64Helper.Parse Method (ClrWString, IFormatProvider)

Converts the string representation of a number in a specified culture-specific format to its 64-bit unsigned
integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AProvider: IFormatProvider):


ClrUInt64; overload;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.6 TClrUInt64Helper.Parse Method (ClrWString, TNumberStyles)


Converts the string representation of a number in a specified style to its 64-bit unsigned integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles): ClrUInt64;


overload;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.6 TClrUInt64Helper.Parse Method (ClrWString, TNumberStyles,


IFormatProvider)
Converts the string representation of a number in a specified style and culture-specific format to its 64-bit unsigned
integer equivalent.

Syntax
Delphi

class function Parse(S: ClrWString; AStyle: TNumberStyles; AProvider:


IFormatProvider): ClrUInt64; overload;

1026
.Net Runtime Library for Delphi

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.7 ToString Method

This is the overview for the ToString method overload.

Overload List

Name Description

TClrUInt64Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrUInt64) representation.

TClrUInt64Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrUInt64, ClrWString) representation using the specified format.

TClrUInt64Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrUInt64, ClrWString, representation using the specified format and culture-specific format
information.
IFormatProvider)

TClrUInt64Helper.ToString Converts the numeric value of this instance to its equivalent string
(ClrUInt64, IFormatProvider) representation using the specified culture-specific format information.

7.1.1.8.1.1.19.1.7 TClrUInt64Helper.ToString Method (ClrUInt64)


Converts the numeric value of this instance to its equivalent string representation.

Syntax
Delphi

class function ToString(Ui64: ClrUInt64): ClrWString; overload;


reintroduce;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.7 TClrUInt64Helper.ToString Method (ClrUInt64, ClrWString)


Converts the numeric value of this instance to its equivalent string representation using the specified format.

Syntax
Delphi

1027
.Net Runtime Library for Delphi

class function ToString(Ui64: ClrUInt64; AFormat: ClrWString):


ClrWString; overload; reintroduce;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.7 TClrUInt64Helper.ToString Method (ClrUInt64, ClrWString, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified format and
culture-specific format information.

Syntax
Delphi

class function ToString(Ui64: ClrUInt64; AFormat: ClrWString;


AProvider: IFormatProvider): ClrWString; overload; reintroduce;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.7 TClrUInt64Helper.ToString Method (ClrUInt64, IFormatProvider)


Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific
format information.

Syntax
Delphi

class function ToString(Ui64: ClrUInt64; AProvider: IFormatProvider):


ClrWString; overload; reintroduce;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.8 TryParse Method


Overload List

Name Description

TClrUInt64Helper.TryParse Tries to convert the string representation of a number to its 64-bit


(ClrWString, ClrUInt64) unsigned integer equivalent. A return value indicates whether the
conversion succeeded or failed.

1028
.Net Runtime Library for Delphi

Name Description

TClrUInt64Helper.TryParse Tries to convert the string representation of a number in a specified


(ClrWString, TNumberStyles, style and culture-specific format to its 64-bit unsigned integer
equivalent. A return value indicates whether the conversion succeeded
IFormatProvider, ClrUInt64)
or failed.

7.1.1.8.1.1.19.1.8 TClrUInt64Helper.TryParse Method (ClrWString, ClrUInt64)


Tries to convert the string representation of a number to its 64-bit unsigned integer equivalent. A return value indicates
whether the conversion succeeded or failed.

Syntax
Delphi

class function TryParse(S: ClrWString; var AResult: ClrUInt64):


ClrBoolean; overload;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.1.1.19.1.8 TClrUInt64Helper.TryParse Method (ClrWString, TNumberStyles,


IFormatProvider, ClrUInt64)
Tries to convert the string representation of a number in a specified style and culture-specific format to its 64-bit
unsigned integer equivalent. A return value indicates whether the conversion succeeded or failed.

Syntax
Delphi

class function TryParse(S: ClrWString; AStyle: TNumberStyles;


AProvider: IFormatProvider; var AResult: CIUlnrt64): ClrBoolean;
overload;

See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace

7.1.1.8.2 Classes
Classes

Name Description

1029
.Net Runtime Library for Delphi

Name Description

EClrArgumentNullException The exception that is thrown when a nil reference is passed to a


method that does not accept it as a valid argument.

EClrError The base exception class for errors generated during application
execution.

EClrException Represents errors that occur during application execution.

TClrActivator Contains methods to create types of objects locally or remotely, or


obtain references to existing remote objects. This class cannot be
inherited.

TClrAppDomain Represents an application domain, which is an isolated environment


where applications execute. This class cannot be inherited.

TClrArray Provides methods for creating, manipulating, searching, and sorting


arrays, thereby serving as the base class for all arrays in the common
language runtime (Clr).

TClrArrayHelper Helper class for the TClrArray class. This class cannot be inherited.

TClrAssembly Represents an assembly, which is a reusable, versionable, and self-


describing building block of a common language runtime application.
This class cannot be inherited.

TClrBaseObject This is the base object that can store different kinds of data types.

TClrHost Contains methods for starting and hosting the .Net Framework
Common Language Runtime. This class cannot be inherited.

TClrObject This Class is a wrapper of a .Net object. This class inherit from the
TClrBaseObject Class.

TClrObjectArray Represents an array of the ClrObject interface.

TClrWSDL Contains methods to build and convert XML Web Services into a
.net assembly. This class cannot be inherited.

7.1.1.8.2.1 EClrArgumentNullException Class


Collapse All Expand All

The exception that is thrown when anil reference is passed to a method that does not accept it as a valid argument.

Inheritance Hierarchy

1030
.Net Runtime Library for Delphi

CNClrLib.Host.EClrArgumentNullException

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

EClrArgumentNullException = class(Exception);

Constructors

Name Description

Create Initializes a new instance of the ArgumentNullException class with the


name of the parameter that causes this exception.

7.1.1.8.2.1.1 EClrArgumentNullException.Create Constructor


Initializes a new instance of the ArgumentNullException class with the name of the parameter that causes this exception.

Syntax
Delphi

constructor Create(AParamName: string);

See Also
EClrArgumentNullException Class
CNClrLib.Host Namespace

7.1.1.8.2.2 EClrError Class


The base exception class for errors generated during application execution.

Inheritance Hierarchy
CNClrLib.Host.EClrError

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

EClrError = class(Exception);

1031
.Net Runtime Library for Delphi

7.1.1.8.2.3 EClrException Class


Collapse All Expand All

Represents errors that occur during Clr application execution.

Inheritance Hierarchy
CNClrLib.Host.EClrError

CNClrLib.Host.EClrException

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

EClrException = class(EClrError);

Constructors

Name Description

Create(ClrInt32) Initializes a new instance of the Clr Exception class with the
ErrorCode of the exception.

Create(_Exception) Initializes a new instance of the Clr Exception class with the Clr
Exception Interface.

Create(string) Initializes a new instance of the Clr Exception Class with a


message string.

CreateEx Initializes a new instance of the Clr Exception Class with a


delphi base exception object.

CreateFmt Initializes a new instance of the Clr Exception Class with a


formatted message string.

CreateFmtHelp Initializes a new instance of the clr exception class with a


formatted message string and a help-context ID.

CreateHelp Initializes a new instance of the clr exception class with a


message string and a help-context ID.

CreateRes(ClrInt32) Initializes a new instance of the clr exception class with a


message string that is loaded from the application's

1032
.Net Runtime Library for Delphi

Name Description

resources.

CreateRes(PResStringRec) Initializes a new instance of the clr exception class with a


message string that is loaded from the application's
resources.

CreateResFmt(ClrInt32, array of Initializes a new instance of the clr exception class with a
const) message string that is loaded from the application's
resources and then formatted.

CreateResFmt(PResStringRec, Initializes a new instance of the clr exception class with a


array of const) message string that is loaded from the application's
resources and then formatted.

CreateResFmtHelp(ClrInt32, array Initializes a new instance of the clr exception class with a
of const, ClrInt32) help-context ID and a formatted message string loaded
from the application resources.

CreateResFmtHelp(PResStringRec, Initializes a new instance of the clr exception class with a


array of const, ClrInt32) help-context ID and a formatted message string loaded
from the application resources.

CreateResHelp(ClrInt32, ClrInt32) Initializes a new instance of the clr exception class with a
help-context ID and a simple message string that is loaded
from the application's resources.

CreateResHelp(PResStringRec, Initializes a new instance of the clr exception class with a


ClrInt32) help-context ID and a simple message string that is loaded
from the application's resources.

Destructors

Name Description

Destroy Destroys an instance of the EClrException Class.

Methods

Name Description

Assign Call Assign to copy the properties or other attributes of the


delphi base exception to the EClrException instance.

1033
.Net Runtime Library for Delphi

Name Description

CreateExceptionIntf Create a corresponding Clr Exception Interface from the specified


HRESULT error code.

GetClrBaseException Returns the Exception that is the root cause of one or more
subsequent exceptions.

GetExceptionIntf Get the Clr Exception interface of the EClrException Class.

GetType Gets the runtime type interface of the current instance.

ToString Returns a string containing the exception message.

Properties

Name Description

DefaultInterface Get the default interface of the EClrException Class.

HRESULT Gets or sets HRESULT, a coded numerical value that is assigned to a


specific exception.

HelpLink Gets or sets a link to the help file associated with this exception.

InnerException Gets the Exception instance that caused the current exception.

Message Gets a message that describes the current exception.

Source Gets or sets the name of the application or the object that causes the
error.

See Also
Create Constructor
CreateRes Constructor
CreateResFmt Constructor
CreateResFmtHelp Constructor
CreateResHelp Constructor
EClrException Methods
EClrException Properties

7.1.1.8.2.3.1 Create Constructor


This is the overview for the Create constructor overload.

1034
.Net Runtime Library for Delphi

Overload List

Name Description

EClrException.Create Initializes a new instance of the Clr Exception class with the ErrorCode
(ClrInt32) of the exception.

EClrException.Create Initializes a new instance of the Clr Exception class with the Clr
(_Exception) Exception Interface.

EClrException.Create (string) Initializes a new instance of the Clr Exception Class with a message
string.

7.1.1.8.2.3.1.1 EClrException.Create Constructor (ClrInt32)


Initializes a new instance of the Clr Exception class with the ErrorCode of the exception.

Syntax
Delphi

constructor Create(const AErrorCode: ClrInt32); overload;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.1.2 EClrException.Create Constructor (_Exception)


Initializes a new instance of the Clr Exception class with the Clr Exception Interface.

Syntax
Delphi

constructor Create(AIntf: _Exception); overload;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.1.3 EClrException.Create Constructor (string)


Initializes a new instance of the Clr Exception Class with a message string.

Syntax
Delphi

1035
.Net Runtime Library for Delphi

constructor Create(const AMessage: string); overload;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.2 EClrException.CreateEx Constructor


Initializes a new instance of the Clr Exception Class with a delphi base exception object.

Syntax
Delphi

constructor CreateEx(const AException: Exception); overload;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.3 EClrException.CreateFmt Constructor


Initializes a new instance of the Clr Exception Class with a formatted message string.

Syntax
Delphi

constructor CreateFmt(const AMessage: string; const AArguments: array


of const);

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.4 EClrException.CreateFmtHelp Constructor


Initializes a new instance of the clr exception class with a formatted message string and a help-context ID.

Syntax
Delphi

constructor CreateFmtHelp(const AMessage: string; const AArguments:


array of const; AHelpContext: ClrInt32);

See Also
EClrException Class
CNClrLib.Host Namespace

1036
.Net Runtime Library for Delphi

7.1.1.8.2.3.5 EClrException.CreateHelp Constructor


Initializes a new instance of the clr exception class with a message string and a help-context ID.

Syntax
Delphi

constructor CreateHelp(const AMessage: string; AHelpContext:


ClrInt32);

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.6 CreateRes Constructor


This is the overview for the CreateRes constructor overload.

Overload List

Name Description

EClrException.CreateRes Initializes a new instance of the clr exception class with a message
(ClrInt32) string that is loaded from the application's resources.

EClrException.CreateRes Initializes a new instance of the clr exception class with a message
(PResStringRec) string that is loaded from the application's resources.

7.1.1.8.2.3.6.1 EClrException.CreateRes Constructor (ClrInt32)


Initializes a new instance of the clr exception class with a message string that is loaded from the application's
resources.

Syntax
Delphi

constructor CreateRes(AIdent: ClrInt32); overload;

See Also
EClrException Class
CNClrLib.Host Namespace

1037
.Net Runtime Library for Delphi

7.1.1.8.2.3.6.2 EClrException.CreateRes Constructor (PResStringRec)


Initializes a new instance of the clr exception class with a message string that is loaded from the application's
resources.

Syntax
Delphi

constructor CreateRes(AResStringRec: PResStringRec); overload;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.7 CreateResFmt Constructor


This is the overview for the CreateResFmt constructor overload.

Overload List

Name Description

EClrException.CreateResFmt Initializes a new instance of the clr exception class with a message
(ClrInt32, array of const) string that is loaded from the application's resources and then
formatted.

EClrException.CreateResFmt Initializes a new instance of the clr exception class with a message
(PResStringRec, array of string that is loaded from the application's resources and then
const) formatted.

7.1.1.8.2.3.7.1 EClrException.CreateResFmt Constructor (ClrInt32, array of


const)
Initializes a new instance of the clr exception class with a message string that is loaded from the application's
resources and then formatted.

Syntax
Delphi

constructor CreateResFmt(AIdent: ClrInt32; const AArguments: array of


const); overload;

See Also

1038
.Net Runtime Library for Delphi

EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.7.2 EClrException.CreateResFmt Constructor (PResStringRec, array


of const)
Initializes a new instance of the clr exception class with a message string that is loaded from the application's
resources and then formatted.

Syntax
Delphi

constructor CreateResFmt(AResStringRec: PResStringRec; const


AArguments: array of const); overload;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.8 CreateResFmtHelp Constructor


This is the overview for the CreateResFmtHelp constructor overload.

Overload List

Name Description

EClrException.CreateResFmtHelp Initializes a new instance of the clr exception class with a help-
(ClrInt32, array of const, context ID and a formatted message string loaded from the
ClrInt32) application resources.

EClrException.CreateResFmtHelp Initializes a new instance of the clr exception class with a help-
(PResStringRec, array of const, context ID and a formatted message string loaded from the
ClrInt32) application resources.

7.1.1.8.2.3.8.1 EClrException.CreateResFmtHelp Constructor (ClrInt32, array of


const, ClrInt32)
Initializes a new instance of the clr exception class with a help-context ID and a formatted message string loaded
from the application resources.

Syntax
Delphi

1039
.Net Runtime Library for Delphi

constructor CreateResFmtHelp(AIdent: ClrInt32; const AArguments: array


of const; AHelpContext: ClrInt32); overload;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.8.2 EClrException.CreateResFmtHelp Constructor (PResStringRec,


array of const, ClrInt32)
Initializes a new instance of the clr exception class with a help-context ID and a formatted message string loaded
from the application resources.

Syntax
Delphi

constructor CreateResFmtHelp(AResStringRec: PResStringRec; const


AArguments: array of const; AHelpContext: ClrInt32); overload;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.9 CreateResHelp Constructor


This is the overview for the CreateResHelp constructor overload.

Overload List

Name Description

EClrException.CreateResHelp Initializes a new instance of the clr exception class with a help-
(ClrInt32, ClrInt32) context ID and a simple message string that is loaded from the
application's resources.

EClrException.CreateResHelp Initializes a new instance of the clr exception class with a help-
(PResStringRec, ClrInt32) context ID and a simple message string that is loaded from the
application's resources.

7.1.1.8.2.3.9.1 EClrException.CreateResHelp Constructor (ClrInt32, ClrInt32)


Initializes a new instance of the clr exception class with a help-context ID and a simple message string that is
loaded from the application's resources.

Syntax

1040
.Net Runtime Library for Delphi

Delphi

constructor CreateResHelp(AIdent: ClrInt32; AHelpContext: ClrInt32);


overload;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.9.2 EClrException.CreateResHelp Constructor (PResStringRec,


ClrInt32)
Initializes a new instance of the clr exception class with a help-context ID and a simple message string that is
loaded from the application's resources.

Syntax
Delphi

constructor CreateResHelp(AResStringRec: PResStringRec; AHelpContext:


ClrInt32); overload;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.10 EClrException.Destroy Destructor


Destroys an instance of the EClrException.

Syntax
Delphi

destructor Destroy; override;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.11 EClrException Methods


The methods of the EClrException class are listed here.

Methods

Name Description

1041
.Net Runtime Library for Delphi

Name Description

Assign Call Assign to copy the properties or other attributes of the delphi
base exception to the EClrException instance.

CreateExceptionIntf Create a corresponding Clr Exception Interface from the specified


HRESULT error code.

GetClrBaseException Returns the Exception that is the root cause of one or more
subsequent exceptions.

GetExceptionIntf Get the Clr Exception interface of the EClrException Class.

GetType Gets the runtime type interface of the current instance.

ToString Returns a string containing the exception message.

7.1.1.8.2.3.11.1 EClrException.Assign Method


Call Assign to copy the properties or other attributes of the delphi base exception to the EClrException instance.

Syntax
Delphi

procedure Assign(AValue: SysUtils.Exception);

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.11.2 EClrException.CreateExceptionIntf Method


Create a corresponding Clr Exception Interface from the specified HRESULT error code.

Syntax
Delphi

class function CreateExceptionIntf(AMessage: string): _Exception;

See Also
EClrException Class
CNClrLib.Host Namespace

1042
.Net Runtime Library for Delphi

7.1.1.8.2.3.11.3 EClrException.GetClrBaseException Method


Returns the Exception that is the root cause of one or more subsequent exceptions.

Syntax
Delphi

function GetClrBaseException: EClrException;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.11.4 EClrException.GetExceptionIntf Method


Get the Clr Exception interface of the EClrException Class.

Syntax
Delphi

class function GetExceptionIntf(ErrorCode: HRESULT): _Exception;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.11.5 EClrException.GetType Method


Gets the runtime type interface of the current instance.

Syntax
Delphi

function GetType: _Type;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.11.6 EClrException.ToString Method


Returns a string containing the exception message.

Syntax
Delphi

1043
.Net Runtime Library for Delphi

function ToString: string; override;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.11.7 EClrException.ThrowDotNetException Method

This method creates a .net exception object that is passed to the delphi exception handler.

Syntax
Delphi

class procedure ThrowDotNetException(AException: _Exception);

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.11.8 EClrException.GetLastClrException Method


Ge

Returns the last occurring exception from the common language runtime.

Syntax
Delphi

class function GetLastClrException: EClrException;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.11.9 EClrException.GetLastClrError Method


Ge

Returns the last occurring clr exception interface from the common language runtime.

Syntax
Delphi

class function GetLastClrError: _Exception;

See Also

1044
.Net Runtime Library for Delphi

EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.12 EClrException Properties


The properties of the EClrException class are listed here.

Properties

Name Description

DefaultInterface Get the default interface of the EClrException Class.

HelpLink Gets or sets HRESULT, a coded numerical value that is assigned to a


specific exception.

HRESULT Gets or sets a link to the help file associated with this exception.

InnerException Gets the Exception instance that caused the current exception.

Message Gets a message that describes the current exception.

Source Gets or sets the name of the application or the object that causes the
error.

7.1.1.8.2.3.12.1 EClrException.DefaultInterface Property


Get the default interface of the EClrException Class.

Syntax
Delphi

property DefaultInterface: _Exception;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.12.2 EClrException.HelpLink Property


Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.

Syntax
Delphi

1045
.Net Runtime Library for Delphi

property HelpLink: string;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.12.3 EClrException.HRESULT Property


Gets or sets a link to the help file associated with this exception.

Syntax
Delphi

property HRESULT: ClrInt32;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.12.4 EClrException.InnerException Property


Gets the Exception instance that caused the current exception.

Syntax
Delphi

property InnerException: EClrException;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.3.12.5 EClrException.Message Property


Gets a message that describes the current exception.

Syntax
Delphi

property Message: string;

See Also
EClrException Class
CNClrLib.Host Namespace

1046
.Net Runtime Library for Delphi

7.1.1.8.2.3.12.6 EClrException.Source Property


Gets or sets the name of the application or the object that causes the error.

Syntax
Delphi

property Source: string;

See Also
EClrException Class
CNClrLib.Host Namespace

7.1.1.8.2.4 TClrActivator Class


Collapse All Expand All

Contains methods to create types of objects locally or remotely, or obtain references to existing remote objects. This
class cannot be inherited.

Inheritance Hierarchy
CNClrLib.Host.TClrActivator

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrActivator = class sealed;

Methods

Name Description

ClrCreateInstance(ClrWString) Creates an instance of the type of specified type name using that
type's default constructor and returns the object as ClrObject
Interface.

ClrCreateInstance(ClrWString, Creates an instance of the specified type using the constructor


TClrVariantDynArray) that best matches the specified parameters and returns the object
as ClrObject Interface.

ClrCreateInstance(ClrWString, Creates an instance of the specified type using the constructor


_ObjectArray) that best matches the specified parameters and returns the object
as ClrObject Interface.

1047
.Net Runtime Library for Delphi

Name Description

ClrCreateInstance(_Type) Creates an instance of the specified type using that type's default
constructor and returns the object as ClrObject Interface.

ClrCreateInstance(_Type, Creates an instance of the specified type using that type's default
ClrBoolean) constructor and returns the object as ClrObject Interface.

ClrCreateInstance(_Type, Creates an instance of the specified type using the constructor


TClrVariantDynArray) that best matches the specified parameters and returns the object
as ClrObject Interface.

ClrCreateInstance(_Type, Creates an instance of the specified type using the constructor


_ObjectArray) that best matches the specified parameters and returns the object
as ClrObject Interface.

ClrCreateInstance(_Type, Creates an instance of the specified type using the constructor


_ObjectArray, TBindingFlags_Set, that best matches the specified parameters and returns the object
as ClrObject Interface.
_Binder)

CreateComInstance(ClrWString, Creates an instance of the COM object whose name is specified,


ClrWString) using the named assembly file and the default constructor.

CreateComInstance(ClrWString, Creates an instance of the COM object whose name is specified,


ClrWString, TClrByteDynArray, using the named assembly file and the default constructor.

TAssemblyHashAlgorithm)

CreateComInstance(ClrWString, Creates an instance of the COM object whose name is specified,


ClrWString, _ByteArray, using the named assembly file and the default constructor.

TAssemblyHashAlgorithm)

CreateInstance(ClrWString) Creates an instance of the specified type name using that type's
default constructor.

CreateInstance(ClrWString, Creates an instance of the type whose name is specified in the


ClrWString, TClrAppDomain) specified remote domain, using the named assembly and default
constructor.

CreateInstance(ClrWString, Creates an instance of the specified type using the constructor


TClrVariantDynArray) that best matches the specified parameters.

CreateInstance(ClrWString, Creates an instance of the specified type using the constructor


_ObjectArray) that best matches the specified parameters.

CreateInstance(_ActivationContext) Creates an instance of the type designated by the specified


ActivationContext object.

1048
.Net Runtime Library for Delphi

Name Description

CreateInstance(_ActivationContext, Creates an instance of the type that is designated by the specified


TStrings) ActivationContext object and activated with the specified custom
activation data.

CreateInstance(_ActivationContext, Creates an instance of the type that is designated by the specified


_StringArray) ActivationContext object and activated with the specified custom
activation data.

CreateInstance(_Type) Creates an instance of the specified type using that type's default
constructor.

CreateInstance(_Type, ClrBoolean) Creates an instance of the specified type using that type's default
constructor.

CreateInstance(_Type, Creates an instance of the specified type using the constructor


TClrVariantDynArray, that best matches the specified parameters.

TBindingFlags_Set, _Binder)

CreateInstance(_Type, Creates an instance of the specified type using the constructor


_ObjectArray, TBindingFlags_Set, that best matches the specified parameters.

_Binder)

CreateInstanceFrom(TFileName, Creates an instance of the type whose name is specified in the


ClrWString, ClrBoolean, specified remote domain, using the named assembly file and the
constructor that best matches the specified parameters.
TBindingFlags_Set, _Binder,
_ObjectArray, _CultureInfo,
TClrAppDomain)

CreateInstanceFrom(TFileName, Creates an instance of the type whose name is specified, using the
ClrWString, TClrAppDomain) named assembly file and default constructor.

GetDefaultInterface Get the default interface of the TClrActivator Class.

GetObject(_Type, ClrWString) Creates a proxy for the well-known object indicated by the
specified type and URL.

GetObject(_Type, ClrWString, Creates a proxy for the well-known object indicated by the
ClrVariant) specified type, URL, and channel data.

See Also
TClrActivator Methods

7.1.1.8.2.4.1 TClrActivator Methods


The methods of the TClrActivator class are listed here.

1049
.Net Runtime Library for Delphi

Methods

Name Description

ClrCreateInstance(ClrWString) Creates an instance of the type of specified type name using that
type's default constructor and returns the object as ClrObject
Interface.

ClrCreateInstance(ClrWString, Creates an instance of the specified type using the constructor


TClrVariantDynArray) that best matches the specified parameters and returns the object
as ClrObject Interface.

ClrCreateInstance(ClrWString, Creates an instance of the specified type using the constructor


_ObjectArray) that best matches the specified parameters and returns the object
as ClrObject Interface.

ClrCreateInstance(_Type) Creates an instance of the specified type using that type's default
constructor and returns the object as ClrObject Interface.

ClrCreateInstance(_Type, Creates an instance of the specified type using that type's


ClrBoolean) default constructor and returns the object as ClrObject
Interface.

ClrCreateInstance(_Type, Creates an instance of the specified type using the constructor


TClrVariantDynArray) that best matches the specified parameters and returns the object
as ClrObject Interface.

ClrCreateInstance(_Type, Creates an instance of the specified type using the constructor


_ObjectArray) that best matches the specified parameters and returns the object
as ClrObject Interface.

ClrCreateInstance(_Type, Creates an instance of the specified type using the constructor


_ObjectArray, TBindingFlags_Set, that best matches the specified parameters and returns the object
as ClrObject Interface.
_Binder)

CreateComInstance(ClrWString, Creates an instance of the COM object whose name is specified,


ClrWString) using the named assembly file and the default constructor.

CreateComInstance(ClrWString, Creates an instance of the COM object whose name is specified,


ClrWString, TClrByteDynArray, using the named assembly file and the default constructor.

TAssemblyHashAlgorithm)

CreateComInstance(ClrWString, Creates an instance of the COM object whose name is specified,


ClrWString, _ByteArray, using the named assembly file and the default constructor.

TAssemblyHashAlgorithm)

CreateInstance(ClrWString) Creates an instance of the specified type name using that type's
default constructor.

1050
.Net Runtime Library for Delphi

Name Description

CreateInstance(ClrWString, Creates an instance of the type whose name is specified in the


ClrWString, TClrAppDomain) specified remote domain, using the named assembly and default
constructor.

CreateInstance(ClrWString, Creates an instance of the specified type using the constructor


TClrVariantDynArray) that best matches the specified parameters.

CreateInstance(ClrWString, Creates an instance of the specified type using the


_ObjectArray) constructor that best matches the specified parameters.

CreateInstance(_ActivationContext) Creates an instance of the type designated by the specified


ActivationContext object.

CreateInstance(_ActivationContext, Creates an instance of the type that is designated by the specified


TStrings) ActivationContext object and activated with the specified
custom activation data.

CreateInstance(_ActivationContext, Creates an instance of the type that is designated by the specified


_StringArray) ActivationContext object and activated with the specified custom
activation data.

CreateInstance(_Type) Creates an instance of the specified type using that type's default
constructor.

CreateInstance(_Type, ClrBoolean) Creates an instance of the specified type using that type's default
constructor.

CreateInstance(_Type, Creates an instance of the specified type using the


TClrVariantDynArray, constructor that best matches the specified parameters.
TBindingFlags_Set, _Binder)

CreateInstance(_Type, Creates an instance of the specified type using the constructor


_ObjectArray, TBindingFlags_Set, that best matches the specified parameters.

_Binder)

CreateInstanceFrom(TFileName, Creates an instance of the type whose name is specified in the


ClrWString, ClrBoolean, specified remote domain, using the named assembly file and the
constructor that best matches the specified parameters.
TBindingFlags_Set, _Binder,
_ObjectArray, _CultureInfo,
TClrAppDomain)

CreateInstanceFrom(TFileName, Creates an instance of the type whose name is specified, using the
ClrWString, TClrAppDomain) named assembly file and default constructor.

GetDefaultInterface Get the default interface of the TClrActivator Class.

1051
.Net Runtime Library for Delphi

Name Description

GetObject(_Type, ClrWString) Creates a proxy for the well-known object indicated by the
specified type and URL.

GetObject(_Type, ClrWString, Creates a proxy for the well-known object indicated by the
ClrVariant) specified type, URL, and channel data.

7.1.1.8.2.4.1.1 ClrCreateInstance Method

This is the overview for the ClrCreateInstance method overload.

Overload List

Name Description

TClrActivator.ClrCreateInstance Creates an instance of the type of specified type name using that
(ClrWString) type's default constructor and returns the object as ClrObject
Interface.

TClrActivator.ClrCreateInstance Creates an instance of the specified type using the constructor that
(ClrWString, best matches the specified parameters and returns the object as
ClrObject Interface.
TClrVariantDynArray)

TClrActivator.ClrCreateInstance Creates an instance of the specified type using the constructor that
(ClrWString, _ObjectArray) best matches the specified parameters and returns the object as
ClrObject Interface.

TClrActivator.ClrCreateInstance Creates an instance of the specified type using that type's default
(_Type) constructor and returns the object as ClrObject Interface.

TClrActivator.ClrCreateInstance Creates an instance of the specified type using that type's


(_Type, ClrBoolean) default constructor and returns the object as ClrObject Interface.

TClrActivator.ClrCreateInstance Creates an instance of the specified type using the constructor that
(_Type, TClrVariantDynArray) best matches the specified parameters and returns the object as
ClrObject Interface.

TClrActivator.ClrCreateInstance Creates an instance of the specified type using the constructor that
(_Type, _ObjectArray) best matches the specified parameters and returns the object as
ClrObject Interface.

TClrActivator.ClrCreateInstance Creates an instance of the specified type using the constructor that
(_Type, _ObjectArray, best matches the specified parameters and returns the object as
ClrObject Interface.
TBindingFlags_Set, _Binder)

1052
.Net Runtime Library for Delphi

7.1.1.8.2.4.1.1.1 TClrActivator.ClrCreateInstance Method (ClrWString)

Creates an instance of the type of specified type name using that type's default constructor and returns the object as
ClrObject Interface.

Syntax
Delphi

class function ClrCreateInstance(ATypeName: ClrWString): _ClrObject;


overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.1.2 TClrActivator.ClrCreateInstance Method (ClrWString, TClrVariantDynArray)

Creates an instance of the specified type using the constructor that best matches the specified parameters and returns
the object as ClrObject Interface.

Syntax
Delphi

class function ClrCreateInstance(ATypeName: ClrWString; AArguments:


TClrVariantDynArray): _ClrObject; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.1.3 TClrActivator.ClrCreateInstance Method (ClrWString, _ObjectArray)

Creates an instance of the specified type using the constructor that best matches the specified parameters and returns
the object as ClrObject Interface.

Syntax
Delphi

class function ClrCreateInstance(ATypeName: ClrWString; AArguments:


_ObjectArray): _ClrObject; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

1053
.Net Runtime Library for Delphi

7.1.1.8.2.4.1.1.4 TClrActivator.ClrCreateInstance Method (_Type)

Creates an instance of the specified type using that type's default constructor and returns the object as ClrObject
Interface.

Syntax
Delphi

class function ClrCreateInstance(AType: _Type): _ClrObject; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.1.5 TClrActivator.ClrCreateInstance Method (_Type, ClrBoolean)

Creates an instance of the specified type using that type's default constructor and returns the object as ClrObject
Interface.

Syntax
Delphi

class function ClrCreateInstance(AType: _Type; ANonPublic:


ClrBoolean): _ClrObject; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.1.6 TClrActivator.ClrCreateInstance Method (_Type, TClrVariantDynArray)

Creates an instance of the specified type using the constructor that best matches the specified parameters and returns
the object as ClrObject Interface.

Syntax
Delphi

class function ClrCreateInstance(AType: _Type; AArguments:


TClrVariantDynArray): _ClrObject; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.1.7 TClrActivator.ClrCreateInstance Method (_Type, _ObjectArray)

Creates an instance of the specified type using the constructor that best matches the specified parameters and returns
the object as ClrObject Interface.

1054
.Net Runtime Library for Delphi

Syntax
Delphi

class function ClrCreateInstance(AType: _Type; AArguments:


_ObjectArray): _ClrObject; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.1.8 TClrActivator.ClrCreateInstance Method (_Type, _ObjectArray,


TBindingFlags_Set, _Binder)

Creates an instance of the specified type using the constructor that best matches the specified parameters and returns
the object as ClrObject Interface.

Syntax
Delphi

class function ClrCreateInstance(AType: _Type; AArguments:


_ObjectArray; ABindingAttr: TBindingFlags_Set; ABinder: _Binder =
Nil): _ClrObject; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.2 CreateComInstance Method

This is the overview for the CreateComInstance method overload.

Overload List

Name Description

TClrActivator.CreateComInstance Creates an instance of the COM object whose name is specified,


(ClrWString, ClrWString) using the named assembly file and the default constructor.

TClrActivator.CreateComInstance Creates an instance of the COM object whose name is specified,


(ClrWString, ClrWString, using the named assembly file and the default constructor.

TClrByteDynArray,
TAssemblyHashAlgorithm)

TClrActivator.CreateComInstance Creates an instance of the COM object whose name is specified,


(ClrWString, ClrWString, using the named assembly file and the default constructor.

_ByteArray,

1055
.Net Runtime Library for Delphi

Name Description

TAssemblyHashAlgorithm)

7.1.1.8.2.4.1.2.1 TClrActivator.CreateComInstance Method (ClrWString, ClrWString)

Creates an instance of the COM object whose name is specified, using the named assembly file and the default
constructor.

Syntax
Delphi

class function CreateComInstance(AAssemblyName: ClrWString; ATypeName:


ClrWString): _ObjectHandle; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.2.2 TClrActivator.CreateComInstance Method (ClrWString, ClrWString,


TClrByteDynArray, TAssemblyHashAlgorithm)

Creates an instance of the COM object whose name is specified, using the named assembly file and the default
constructor.

Syntax
Delphi

class function CreateComInstance(AAssemblyName: ClrWString; ATypeName:


ClrWString; AHashValue: TClrByteDynArray;

AHashAlgorithm: TAssemblyHashAlgorithm): _ObjectHandle; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.2.3 TClrActivator.CreateComInstance Method (ClrWString, ClrWString,


_ByteArray, TAssemblyHashAlgorithm)

Creates an instance of the COM object whose name is specified, using the named assembly file and the default
constructor.

Syntax
Delphi

1056
.Net Runtime Library for Delphi

class function CreateComInstance(AAssemblyName: ClrWString; ATypeName:


ClrWString; AHashValue: _ByteArray;

AHashAlgorithm: TAssemblyHashAlgorithm): _ObjectHandle; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.3 CreateInstance Method

This is the overview for the CreateInstance method overload.

Overload List

Name Description

TClrActivator.CreateInstance Creates an instance of the specified type name using that type's
(ClrWString) default constructor.

TClrActivator.CreateInstance Creates an instance of the type whose name is specified in the


(ClrWString, ClrWString, specified remote domain, using the named assembly and default
constructor.
TClrAppDomain)

TClrActivator.CreateInstance Creates an instance of the specified type using the constructor that
(ClrWString, best matches the specified parameters.

TClrVariantDynArray)

TClrActivator.CreateInstance Creates an instance of the specified type using the constructor


(ClrWString, _ObjectArray) that best matches the specified parameters.

TClrActivator.CreateInstance Creates an instance of the type designated by the specified


(_ActivationContext) ActivationContext object.

TClrActivator.CreateInstance Creates an instance of the type that is designated by the specified


(_ActivationContext, ActivationContext object and activated with the specified custom

TStrings) activation data.

TClrActivator.CreateInstance Creates an instance of the type that is designated by the specified


(_ActivationContext, ActivationContext object and activated with the specified custom
activation data.
_StringArray)

TClrActivator.CreateInstance Creates an instance of the specified type using that type's default
(_Type) constructor.

TClrActivator.CreateInstance Creates an instance of the specified type using that type's default

1057
.Net Runtime Library for Delphi

Name Description

(_Type, ClrBoolean) constructor.

TClrActivator.CreateInstance Creates an instance of the specified type using the constructor


(_Type, that best matches the specified parameters.
TClrVariantDynArray,
TBindingFlags_Set, _Binder)

TClrActivator.CreateInstance Creates an instance of the specified type using the constructor that
(_Type, _ObjectArray, best matches the specified parameters.

TBindingFlags_Set, _Binder)

7.1.1.8.2.4.1.3.1 TClrActivator.CreateInstance Method (ClrWString)

Creates an instance of the specified type name using that type's default constructor.

Syntax
Delphi

class function CreateInstance(ATypeName: ClrWString): ClrVariant;


overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.3.2 TClrActivator.CreateInstance Method (ClrWString, ClrWString,


TClrAppDomain)

Creates an instance of the type whose name is specified in the specified remote domain, using the named assembly and
default constructor.

Syntax
Delphi

class function CreateInstance(AAssemblyName: ClrWString; ATypeName:


ClrWString; ADomain: TClrAppDomain = Nil): _ObjectHandle; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

1058
.Net Runtime Library for Delphi

7.1.1.8.2.4.1.3.3 TClrActivator.CreateInstance Method (ClrWString, TClrVariantDynArray)

Creates an instance of the specified type using the constructor that best matches the specified parameters.

Syntax
Delphi

class function CreateInstance(ATypeName: ClrWString; AArguments:


TClrVariantDynArray): ClrVariant; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.3.4 TClrActivator.CreateInstance Method (ClrWString, _ObjectArray)

Creates an instance of the specified type using the constructor that best matches the specified parameters.

Syntax
Delphi

class function CreateInstance(ATypeName: ClrWString; AArguments:


_ObjectArray): ClrVariant; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.3.5 TClrActivator.CreateInstance Method (_ActivationContext)

Creates an instance of the type designated by the specified ActivationContext object.

Syntax
Delphi

class function CreateInstance(AActivationContext: _ActivationContext):


_ObjectHandle; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.3.6 TClrActivator.CreateInstance Method (_ActivationContext, TStrings)

Creates an instance of the type that is designated by the specified ActivationContext object and activated with the
specified custom activation data.

1059
.Net Runtime Library for Delphi

Syntax
Delphi

class function CreateInstance(AActivationContext: _ActivationContext;


AActivationCustomData: TStrings): _ObjectHandle; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.3.7 TClrActivator.CreateInstance Method (_ActivationContext, _StringArray)

Creates an instance of the type that is designated by the specified ActivationContext object and activated with the
specified custom activation data.

Syntax
Delphi

class function CreateInstance(AActivationContext: _ActivationContext;


AActivationCustomData: _StringArray): _ObjectHandle; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.3.8 TClrActivator.CreateInstance Method (_Type)

Creates an instance of the specified type using that type's default constructor.

Syntax
Delphi

class function CreateInstance(AType: _Type): ClrVariant; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.3.9 TClrActivator.CreateInstance Method (_Type, ClrBoolean)

Creates an instance of the specified type using that type's default constructor.

Syntax
Delphi

1060
.Net Runtime Library for Delphi

class function CreateInstance(AType: _Type; ANonPublic: ClrBoolean):


ClrVariant; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.3.10 TClrActivator.CreateInstance Method (_Type, TClrVariantDynArray,


TBindingFlags_Set, _Binder)

Creates an instance of the specified type using the constructor that best matches the specified parameters.

Syntax
Delphi

class function CreateInstance(AType: _Type; AArguments:


TClrVariantDynArray; ABindingAttr: TBindingFlags_Set = []; ABinder:
_Binder = Nil): ClrVariant; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.3.11 TClrActivator.CreateInstance Method (_Type, _ObjectArray,


TBindingFlags_Set, _Binder)

Creates an instance of the specified type using the constructor that best matches the specified parameters.

Syntax
Delphi

class function CreateInstance(AType: _Type; AArguments: _ObjectArray;


ABindingAttr: TBindingFlags_Set = []; ABinder: _Binder = Nil):
ClrVariant; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.4 CreateInstanceFrom Method

This is the overview for the CreateInstanceFrom method overload.

Overload List

Name Description

1061
.Net Runtime Library for Delphi

Name Description

TClrActivator.CreateInstanceFrom Creates an instance of the type whose name is specified in the


(TFileName, ClrWString, specified remote domain, using the named assembly file and the
constructor that best matches the specified parameters.
ClrBoolean, TBindingFlags_Set,
_Binder, _ObjectArray,
_CultureInfo, TClrAppDomain)

TClrActivator.CreateInstanceFrom Creates an instance of the type whose name is specified, using the
(TFileName, ClrWString, named assembly file and default constructor.

TClrAppDomain)

7.1.1.8.2.4.1.4.1 TClrActivator.CreateInstanceFrom Method (TFileName, ClrWString,


ClrBoolean, TBindingFlags_Set, _Binder, _ObjectArray, _CultureInfo, TClrAppDomain)

Creates an instance of the type whose name is specified in the specified remote domain, using the named assembly file
and the constructor that best matches the specified parameters.

Syntax
Delphi

class function CreateInstanceFrom(AAssemblyFile: TFileName; ATypeName:


ClrWString; AIgnoreCase: ClrBoolean = True; ABindingAttr:
TBindingFlags_Set= [];

ABinder: _Binder = Nil; AArguments: _ObjectArray = Nil; ACulture:


_CultureInfo = Nil; ADomain: TClrAppDomain = Nil): _ObjectHandle;
overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.4.2 TClrActivator.CreateInstanceFrom Method (TFileName, ClrWString,


TClrAppDomain)

Creates an instance of the type whose name is specified, using the named assembly file and default constructor.

Syntax
Delphi

class function CreateInstanceFrom(AAssemblyFile: TFileName; ATypeName:


ClrWString; ADomain: TClrAppDomain): _ObjectHandle; overload;

See Also

1062
.Net Runtime Library for Delphi

TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.5 TClrActivator.GetDefaultInterface Method


Get the default interface of the TClrActivator Class.

Syntax
Delphi

class function GetDefaultInterface: _Activator;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.4.1.6 GetObject Method

This is the overview for the GetObject method overload.

Overload List

Name Description

TClrActivator.GetObject Creates a proxy for the well-known object indicated by the specified
(_Type, ClrWString) type and URL.

TClrActivator.GetObject Creates a proxy for the well-known object indicated by the specified
(_Type, ClrWString, type, URL, and channel data.

ClrVariant)

7.1.1.8.2.4.1.6.1 TClrActivator.GetObject Method (_Type, ClrWString)

Creates a proxy for the well-known object indicated by the specified type and URL.

Syntax
Delphi

class function GetObject(AType: _Type; AUrl: ClrWString): ClrVariant;


overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

1063
.Net Runtime Library for Delphi

7.1.1.8.2.4.1.6.2 TClrActivator.GetObject Method (_Type, ClrWString, ClrVariant)

Creates a proxy for the well-known object indicated by the specified type, URL, and channel data.

Syntax
Delphi

class function GetObject(AType: _Type; AUrl: ClrWString; AState:


ClrVariant): ClrVariant; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.5 TClrAppDomain Class


Collapse All Expand All

Represents an application domain, which is an isolated environment where applications execute. This class cannot
be inherited.

Inheritance Hierarchy
CNClrLib.Host.TClrAppDomain

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrAppDomain = class sealed(TClrBase);

Constructors

Name Description

Create(_AppDomain) Creates a new application domain with the specified appDomain


interface.

Create(ClrString) Creates a new application domain with the specified name.

Destructors

Name Description

1064
.Net Runtime Library for Delphi

Name Description

Destroy Destroys an instance of the TClrAppDomain Class.

Methods

Name Description

AddAssemblyLoad Add an AssemblyLoad event handler as function


pointer. This event will be raised when an assembly is
loaded.

AddAssemblyResolve Add an AssemblyResolve event handler as function


pointer. This event will be raised when the resolution
of an assembly fails.

AddDomainUnload Add a DomainUnload event handler as function


pointer. This event will be raised when an AppDomain
is about to be unloaded.

AddFirstChanceException Add a FirstChanceException event handler as function


pointer. This event will be raised when an exception is
thrown in managed code, before the runtime
searches the call stack for an exception handler in the
application domain.

AddProcessExit Add a ProcessExit event handler as function pointer.


This event will be raised when the default application
domain's parent process exits.

AddReflectionOnlyAssemblyResolve Add a ReflectionOnlyAssemblyResolve event handler


as function pointer. This event will be raised when the
resolution of an assembly fails in the reflection-only
context.

AddResourceResolve Add a ResourceResolve event handler as function


pointer. This event will be raised when the resolution
of a resource fails because the resource is not a valid
linked or embedded resource in the assembly.

AddTypeResolve Add a TypeResolve event handler as function pointer.


This event will be raised when the resolution of a type
fails.

ApplyPolicy Returns the assembly display name after policy has


been applied.

AsClrObject Returns the AppDomain object as ClrObject


Interface.

1065
.Net Runtime Library for Delphi

Name Description

AsPointer Returns the AppDomain object as managed


pointer.

CreateComInstanceFrom(ClrWString, Creates a new instance of a specified COM type.


ClrWString) Parameters specify the name of a file that contains an
assembly containing the type and the name of the
type.

CreateComInstanceFrom(ClrWString, Creates a new instance of a specified COM type.


ClrWString, TClrByteDynArray, Parameters specify the name of a file that contains an
assembly containing the type and the name of the
TAssemblyHashAlgorithm)
type.

CreateComInstanceFrom(ClrWString, Creates a new instance of a specified COM type.


ClrWString, _ByteArray, Parameters specify the name of a file that contains an
assembly containing the type and the name of the
TAssemblyHashAlgorithm)
type.

CreateDomain(ClrWString) Creates a new application domain with the specified


name.

CreateDomain(ClrWString, _Evidence) Creates a new application domain with the given


name using the supplied evidence.

CreateDomain(ClrWString, _Evidence, Creates a new application domain with the given


ClrWString, ClrWString, ClrBoolean) name, using evidence, application base path, relative
search path, and a parameter that specifies whether a
shadow copy of an assembly is to be loaded into the
application domain.

CreateDomain(ClrWString, _Evidence, Creates a new application domain using the specified


_AppDomainSetup) name, evidence, and application domain setup
information.

CreateDomain(ClrWString, _Evidence, Creates a new application domain using the specified


_AppDomainSetup, _PermissionSet, name, evidence, application domain setup
information, default permission set, and array of fully
_StrongNameArray)
trusted assemblies.

CreateInstance(ClrWString, ClrWString) Creates a new instance of the specified type defined


in the specified assembly.

CreateInstance(ClrWString, ClrWString, Creates a new instance of the specified type defined


_ObjectArray) in the specified assembly. A parameter specifies an
array of activation attributes.

CreateInstanceFrom(ClrWString, Creates a new instance of the specified type defined


ClrWString) in the specified assembly file.

1066
.Net Runtime Library for Delphi

Name Description

CreateInstanceFrom(ClrWString, Creates a new instance of the specified type defined


ClrWString, _ObjectArray) in the specified assembly file.

DefineDynamicAssembly(_AssemblyName, Defines a dynamic assembly with the specified name


TAssemblyBuilderAccess) and access mode.

DefineDynamicAssembly(_AssemblyName, Defines a dynamic assembly using the specified


TAssemblyBuilderAccess, ClrWString) name, access mode, and storage directory.

DoCallBack Executes the code in another application domain that


is identified by the specified delegate.

ExecuteAssembly(TFileName) Executes the assembly contained in the specified file.

ExecuteAssembly(TFileName, Executes the assembly contained in the specified file,


TClrWStringDynArray) using the specified arguments.

ExecuteAssembly(TFileName, TStrings) Executes the assembly contained in the specified file,


using the specified arguments.

ExecuteAssemblyByName(ClrWString) Executes an assembly given its display name.

ExecuteAssemblyByName(ClrWString, Executes the assembly given its display name, using


TClrWStringDynArray) the specified arguments.

ExecuteAssemblyByName(ClrWString, Executes the assembly given its display name, using


TStrings) the specified arguments.

ExecuteAssemblyByName(ClrWString, Executes the assembly given its display name, using


_StringArray) the specified arguments.

ExecuteAssemblyByName(_AssemblyName, Executes the assembly given its display name, using


TClrWStringDynArray) the specified arguments.

ExecuteAssemblyByName(_AssemblyName, Executes the assembly given an AssemblyName,


_StringArray) using the specified arguments.

GetAssemblies Gets the assemblies that have been loaded into the
execution context of this application domain.

GetCurrentDomain Gets the current application domain for the current


Thread.

GetCurrentThreadId Gets the current thread identifier.

1067
.Net Runtime Library for Delphi

Name Description

GetData Gets the value stored in the current application


domain for the specified name.

GetDataO Gets the value as ClrObject interface stored in the


current application domain for the specified name.

GetMonitoringIsEnabled Gets a value that indicates whether CPU and memory


monitoring of application domains is enabled for the
current process. Once monitoring is enabled for a
process, it cannot be disabled.

GetMonitoringSurvivedProcessMemorySize Gets the number of bytes that survived the last


collection and that are known to be referenced by the
current application domain.

GetType Gets the type of the current instance.

IsDefaultAppDomain Returns a value that indicates whether the application


domain is the default application domain for the
process.

Load(ClrWString) Loads an Assembly given its display name.

Load(TClrByteDynArray) Loads the Assembly with a common object file format


(COFF) based image containing an emitted Assembly.

Load(TClrByteDynArray, TClrByteDynArray) Loads the Assembly with a common object file


format (COFF) based image containing an emitted
Assembly. The raw bytes representing the symbols
for the Assembly are also loaded.

Load(_AssemblyName) Loads an Assembly given its AssemblyName.

Load(_ByteArray) Loads the Assembly with a common object file format


(COFF) based image containing an emitted Assembly.

Load(_ByteArray, _ByteArray) Loads the Assembly with a common object file


format (COFF) based image containing an emitted
Assembly. The raw bytes representing the symbols
for the Assembly are also loaded.

RemoveAssemblyLoad Remove the AssemblyLoad event handler.

RemoveAssemblyResolve Remove the AssemblyResolve event handler.

1068
.Net Runtime Library for Delphi

Name Description

RemoveDomainUnload Remove the DomainUnload event handler.

RemoveFirstChanceException Remove the FirstChanceException event handler.

RemoveProcessExit Remove the ProcessExit event handler.

RemoveReflectionOnlyAssemblyResolve Remove the ReflectionOnlyAssemblyResolve event


handler.

RemoveResourceResolve Remove the ResourceResolve event handler.

RemoveTypeResolve Remove the TypeResolve event handler.

SetData Assigns the specified value to the specified


application domain property.

SetMonitoringIsEnabled Sets a value that indicates whether CPU and memory


monitoring of application domains is enabled for the
current process. Once monitoring is enabled for a
process, it cannot be disabled.

ToString Obtains a string representation that includes the


friendly name of the application domain and any
context policies.

Unload() Unloads the instance application domain.

Unload(TClrAppDomain) Unloads the specified application domain.

UnloadIntf Unloads the specified application domain interface.

Unwrap Returns the .net application domain object.

Properties

Name Description

BaseDirectory Gets the base directory that the assembly resolver uses to probe for
assemblies.

DefaultInterface Returns the default interface of the TClrAppDomain.

DomainManager Gets the domain manager that was provided by the host when the
application domain was initialized.

1069
.Net Runtime Library for Delphi

Name Description

Evidence Gets the Evidence associated with this application domain.

FriendlyName Gets the friendly name of this application domain.

ID Gets an integer that uniquely identifies the application domain within


the process.

IsFullyTrusted Gets a value that indicates whether assemblies that are loaded into
the current application domain execute with full trust.

See Also
Create Constructor
TClrAppDomain Methods
TClrAppDomain Properties

7.1.1.8.2.5.1 Create Constructor


This is the overview for the Create constructor overload.

Overload List

Name Description

Create(_AppDomain) Creates a new application domain with the specified appDomain


interface.

Create(ClrString) Creates a new application domain with the specified name.

7.1.1.8.2.5.1.1 TClrAppDomain.Create Constructor (_AppDomain)


Creates a new application domain with the specified appDomain interface.

Syntax
Delphi

constructor Create(AIntf: _AppDomain); overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

1070
.Net Runtime Library for Delphi

7.1.1.8.2.5.1.2 TClrAppDomain.Create Constructor (ClrString)


Creates a new application domain with the specified name.

Syntax
Delphi

constructor Create(AFriendlyName: ClrString); overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.2 TClrAppDomain.Destroy Destructor


Destroys an instance of the TClrAppDomain.

Syntax
Delphi

destructor Destroy; override;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3 TClrAppDomain Methods


The methods of the TClrAppDomain class are listed here.

Methods

Name Description

AddAssemblyLoad Add an AssemblyLoad event handler as function


pointer. This event will be raised when an assembly is
loaded.

AddAssemblyResolve Add an AssemblyResolve event handler as function


pointer. This event will be raised when the resolution
of an assembly fails.

AddDomainUnload Add a DomainUnload event handler as function


pointer. This event will be raised when an AppDomain
is about to be unloaded .

AddFirstChanceException Add a FirstChanceException event handler as function


pointer. This event will be raised when an exception is

1071
.Net Runtime Library for Delphi

Name Description

thrown in managed code, before the runtime


searches the call stack for an exception handler in the
application domain.

AddProcessExit Add a ProcessExit event handler as function pointer.


This event will be raised when the default application
domain's parent process exits.

AddReflectionOnlyAssemblyResolve Add a ReflectionOnlyAssemblyResolve event handler


as function pointer. This event will be raised when the
resolution of an assembly fails in the reflection-only
context.

AddResourceResolve Add a ResourceResolve event handler as function


pointer. This event will be raised when the resolution
of a resource fails because the resource is not a valid
linked or embedded resource in the assembly.

AddTypeResolve Add a TypeResolve event handler as function pointer.


This event will be raised when the resolution of a type
fails.

ApplyPolicy Returns the assembly display name after policy has


been applied.

AsClrObject Returns the AppDomain object as ClrObject


Interface.

AsPointer Returns the AppDomain object as managed


pointer.

CreateComInstanceFrom(ClrWString, Creates a new instance of a specified COM type.


ClrWString) Parameters specify the name of a file that contains an
assembly containing the type and the name of the
type.

CreateComInstanceFrom(ClrWString, Creates a new instance of a specified COM type.


ClrWString, TClrByteDynArray, Parameters specify the name of a file that contains an
assembly containing the type and the name of the
TAssemblyHashAlgorithm)
type.

CreateComInstanceFrom(ClrWString, Creates a new instance of a specified COM type.


ClrWString, _ByteArray, Parameters specify the name of a file that contains an
assembly containing the type and the name of the
TAssemblyHashAlgorithm)
type.

CreateDomain(ClrWString) Creates a new application domain with the specified


name.

1072
.Net Runtime Library for Delphi

Name Description

CreateDomain(ClrWString, _Evidence) Creates a new application domain with the given


name using the supplied evidence.

CreateDomain(ClrWString, _Evidence, Creates a new application domain with the given


ClrWString, ClrWString, ClrBoolean) name, using evidence, application base path, relative
search path, and a parameter that specifies whether a
shadow copy of an assembly is to be loaded into the
application domain.

CreateDomain(ClrWString, _Evidence, Creates a new application domain using the


_AppDomainSetup) specified name, evidence, and application
domain setup information.

CreateDomain(ClrWString, _Evidence, Creates a new application domain using the specified


_AppDomainSetup, _PermissionSet, name, evidence, application domain setup
information, default permission set, and array of fully
_StrongNameArray)
trusted assemblies.

CreateInstance(ClrWString, ClrWString) Creates a new instance of the specified type defined


in the specified assembly.

CreateInstance(ClrWString, ClrWString, Creates a new instance of the specified type defined


_ObjectArray) in the specified assembly. A parameter specifies an
array of activation attributes.

CreateInstanceFrom(ClrWString, Creates a new instance of the specified type defined


ClrWString) in the specified assembly file.

CreateInstanceFrom(ClrWString, Creates a new instance of the specified type defined


ClrWString, _ObjectArray) in the specified assembly file.

DefineDynamicAssembly(_AssemblyName, Defines a dynamic assembly with the specified name


TAssemblyBuilderAccess) and access mode.

DefineDynamicAssembly(_AssemblyName, Defines a dynamic assembly using the specified


TAssemblyBuilderAccess, ClrWString) name, access mode, and storage directory.

DoCallBack Executes the code in another application domain that


is identified by the specified delegate.

ExecuteAssembly(TFileName) Executes the assembly contained in the


specified file.

ExecuteAssembly(TFileName, Executes the assembly contained in the specified file,


TClrWStringDynArray) using the specified arguments.

1073
.Net Runtime Library for Delphi

Name Description

ExecuteAssembly(TFileName, TStrings) Executes the assembly contained in the specified file,


using the specified arguments.

ExecuteAssemblyByName(ClrWString) Executes an assembly given its display name.

ExecuteAssemblyByName(ClrWString, Executes the assembly given its display name, using


TClrWStringDynArray) the specified arguments.

ExecuteAssemblyByName(ClrWString, Executes the assembly given its display name, using


TStrings) the specified arguments.

ExecuteAssemblyByName(ClrWString, Executes the assembly given its display name, using


_StringArray) the specified arguments.

ExecuteAssemblyByName(_AssemblyName, Executes the assembly given its display name, using


TClrWStringDynArray) the specified arguments.

ExecuteAssemblyByName(_AssemblyName, Executes the assembly given an AssemblyName ,


_StringArray) using the specified arguments.

GetAssemblies Gets the assemblies that have been loaded into the
execution context of this application domain.

GetCurrentDomain Gets the current application domain for the current


Thread .

GetCurrentThreadId Gets the current thread identifier.

GetData Gets the value stored in the current application


domain for the specified name.

GetDataO Gets the value as ClrObject interface stored in the


current application domain for the specified name.

GetMonitoringIsEnabled Gets a value that indicates whether CPU and memory


monitoring of application domains is enabled for the
current process. Once monitoring is enabled for a
process, it cannot be disabled.

GetMonitoringSurvivedProcessMemorySize Gets the number of bytes that survived the last


collection and that are known to be referenced by the
current application domain.

GetType Gets the type of the current instance.

1074
.Net Runtime Library for Delphi

Name Description

IsDefaultAppDomain Returns a value that indicates whether the application


domain is the default application domain for the
process.

Load(ClrWString) Loads an Assembly given its display name.

Load(TClrByteDynArray) Loads the Assembly with a common object file format


(COFF) based image containing an emitted Assembly .

Load(TClrByteDynArray, TClrByteDynArray) Loads the Assembly with a common object file


format (COFF) based image containing an emitted
Assembly . The raw bytes representing the symbols
for the Assembly are also loaded.

Load(_AssemblyName) Loads an Assembly given its AssemblyName.

Load(_ByteArray) Loads the Assembly with a common object file format


(COFF) based image containing an emitted Assembly.

Load(_ByteArray, _ByteArray) Loads the Assembly with a common object file


format (COFF) based image containing an emitted
Assembly. The raw bytes representing the symbols
for the Assembly are also loaded.

RemoveAssemblyLoad Remove the AssemblyLoad event handler.

RemoveAssemblyResolve Remove the AssemblyResolve event handler.

RemoveDomainUnload Remove the DomainUnload event handler.

RemoveFirstChanceException Remove the FirstChanceException event handler.

RemoveProcessExit Remove the ProcessExit event handler.

RemoveReflectionOnlyAssemblyResolve Remove the ReflectionOnlyAssemblyResolve event


handler.

RemoveResourceResolve Remove the ResourceResolve event handler.

RemoveTypeResolve Remove the TypeResolve event handler.

SetData Assigns the specified value to the specified


application domain property.

1075
.Net Runtime Library for Delphi

Name Description

SetMonitoringIsEnabled Sets a value that indicates whether CPU and memory


monitoring of application domains is enabled for the
current process. Once monitoring is enabled for a
process, it cannot be disabled.

ToString Obtains a string representation that includes the


friendly name of the application domain and any
context policies.

Unload() Unloads the instance application domain.

Unload(TClrAppDomain) Unloads the specified application domain.

UnloadIntf Unloads the specified application domain interface.

Unwrap Returns the .net application domain object.

7.1.1.8.2.5.3.1 TClrAppDomain.AddAssemblyLoad Method


Add an AssemblyLoad event handler as function pointer. This event will be raised when an assembly is loaded.

Syntax
Delphi

procedure AddAssemblyLoad(ADelphiObject: TObject; AFunctionPointer:


System.Pointer);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.2 TClrAppDomain.AddAssemblyResolve Method


Add an AssemblyResolve event handler as function pointer. This event will be raised when the resolution of an assembly
fails.

Syntax
Delphi

procedure AddAssemblyResolve(ADelphiObject: TObject; AFunctionPointer:


System.Pointer);

See Also

1076
.Net Runtime Library for Delphi

TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.3 TClrAppDomain.AddDomainUnload Method


Add a DomainUnload event handler as function pointer. This event will be raised when an AppDomain is about to be
unloaded.

Syntax
Delphi

procedure AddDomainUnload(ADelphiObject: TObject; AFunctionPointer:


System.Pointer);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.4 TClrAppDomain.AddFirstChanceException Method


Add a FirstChanceException event handler as function pointer. This event will be raised when an exception is thrown in
managed code, before the runtime searches the call stack for an exception handler in the application domain.

Syntax
Delphi

procedure AddFirstChanceException(ADelphiObject: TObject;


AFunctionPointer: System.Pointer);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.5 TClrAppDomain.AddProcessExit Method


Add a ProcessExit event handler as function pointer. This event will be raised when the default application domain's
parent process exits.

Syntax
Delphi

procedure AddProcessExit(ADelphiObject: TObject; AFunctionPointer:


System.Pointer);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

1077
.Net Runtime Library for Delphi

7.1.1.8.2.5.3.6 TClrAppDomain.AddReflectionOnlyAssemblyResolve Method


Add a ReflectionOnlyAssemblyResolve event handler as function pointer. This event will be raisedwhen the resolution of
an assembly fails in the reflection-only context.

Syntax
Delphi

procedure AddReflectionOnlyAssemblyResolve(ADelphiObject: TObject;


AFunctionPointer: System.Pointer);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.7 TClrAppDomain.AddResourceResolve Method


Add a ResourceResolve event handler as function pointer. This event will be raised when the resolution of a resource
fails because the resource is not a valid linked or embedded resource in the assembly.

Syntax
Delphi

procedure AddResourceResolve(ADelphiObject: TObject; AFunctionPointer:


System.Pointer);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.8 TClrAppDomain.AddTypeResolve Method


Add a TypeResolve event handler as function pointer. This event will be raised when the resolution of a type fails.

Syntax
Delphi

procedure AddTypeResolve(ADelphiObject: TObject; AFunctionPointer:


System.Pointer);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.9 TClrAppDomain.ApplyPolicy Method


Returns the assembly display name after policy has been applied.

1078
.Net Runtime Library for Delphi

Syntax
Delphi

function ApplyPolicy(AAssemblyName: ClrWString): ClrWString;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.10 TClrAppDomain.AsClrObject Method


Returns the AppDomain object as ClrObject Interface.

Syntax
Delphi

function AsClrObject: _ClrObject;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.11 TClrAppDomain.AsPointer Method


Returns the AppDomain object as managed pointer.

Syntax
Delphi

function AsPointer: _IntPtr;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.12 CreateComInstanceFrom Method

This is the overview for the CreateComInstanceFrom method overload.

Overload List

Name Description

TClrAppDomain.CreateComInstanceFrom Creates a new instance of a specified COM type. Parameters


specify the name of a file that contains an assembly

1079
.Net Runtime Library for Delphi

Name Description

(ClrWString, ClrWString) containing the type and the name of the type.

TClrAppDomain.CreateComInstanceFrom Creates a new instance of a specified COM type. Parameters


(ClrWString, ClrWString, specify the name of a file that contains an assembly
containing the type and the name of the type.
TClrByteDynArray,
TAssemblyHashAlgorithm)

TClrAppDomain.CreateComInstanceFrom Creates a new instance of a specified COM type. Parameters


(ClrWString, ClrWString, _ByteArray, specify the name of a file that contains an assembly
containing the type and the name of the type.
TAssemblyHashAlgorithm)

7.1.1.8.2.5.3.12.1 TClrAppDomain.CreateComInstanceFrom Method (ClrWString, ClrWString)


Creates a new instance of a specified COM type. Parameters specify the name of a file that contains an assembly
containing the type and the name of the type.

Syntax
Delphi

function CreateComInstanceFrom(AAssemblyName: ClrWString; ATypeName:


ClrWString): _ObjectHandle; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.12.2 TClrAppDomain.CreateComInstanceFrom Method (ClrWString, ClrWString,


TClrByteDynArray, TAssemblyHashAlgorithm)
Creates a new instance of a specified COM type. Parameters specify the name of a file that contains an assembly
containing the type and the name of the type.

Syntax
Delphi

function CreateComInstanceFrom(AAssemblyFile: ClrWString; ATypeName:


ClrWString; AHashValue: TClrByteDynArray;

AHashAlgorithm: TAssemblyHashAlgorithm): _ObjectHandle; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

1080
.Net Runtime Library for Delphi

7.1.1.8.2.5.3.12.3 TClrAppDomain.CreateComInstanceFrom Method (ClrWString, ClrWString,


_ByteArray, TAssemblyHashAlgorithm)
Creates a new instance of a specified COM type. Parameters specify the name of a file that contains an assembly
containing the type and the name of the type.

Syntax
Delphi

function CreateComInstanceFrom(AAssemblyFile: ClrWString; ATypeName:


ClrWString; AHashValue: _ByteArray;

AHashAlgorithm: TAssemblyHashAlgorithm): _ObjectHandle; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.13 CreateDomain Method

This is the overview for the CreateDomain method overload.

Overload List

Name Description

TClrAppDomain.CreateDomain Creates a new application domain with the specified name.


(ClrWString)

TClrAppDomain.CreateDomain Creates a new application domain with the given name using the
(ClrWString, _Evidence) supplied evidence.

TClrAppDomain.CreateDomain Creates a new application domain with the given name, using
(ClrWString, _Evidence, evidence, application base path, relative search path, and a
parameter that specifies whether a shadow copy of an assembly is to
ClrWString, ClrWString,
be loaded into the application domain.
ClrBoolean)

TClrAppDomain.CreateDomain Creates a new application domain using the specified name,


(ClrWString, _Evidence, evidence, and application domain setup information.

_AppDomainSetup)

TClrAppDomain.CreateDomain Creates a new application domain using the specified name,


(ClrWString, _Evidence, evidence, application domain setup information, default permission
set, and array of fully trusted assemblies.
_AppDomainSetup,
_PermissionSet,
_StrongNameArray)

1081
.Net Runtime Library for Delphi

7.1.1.8.2.5.3.13.1 TClrAppDomain.CreateDomain Method (ClrWString)

Creates a new application domain with the specified name.

Syntax
Delphi

class function CreateDomain(AFriendlyName: ClrWString): TClrAppDomain;


overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.13.2 TClrAppDomain.CreateDomain Method (ClrWString, _Evidence)

Creates a new application domain with the given name using the supplied evidence.

Syntax
Delphi

class function CreateDomain(AFriendlyName: ClrWString; ASecurityInfo:


_Evidence): TClrAppDomain; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.13.3 TClrAppDomain.CreateDomain Method (ClrWString, _Evidence, ClrWString,


ClrWString, ClrBoolean)

Creates a new application domain with the given name, using evidence, application base path, relative search path, and
a parameter that specifies whether a shadow copy of an assembly is to be loaded into the application domain.

Syntax
Delphi

class function CreateDomain(AFriendlyName: ClrWString; ASecurityInfo:


_Evidence; AAppBasePath: ClrWString; AAppRelativeSearchPath:
ClrWString;

AShadowCopyFiles: ClrBoolean): TClrAppDomain; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

1082
.Net Runtime Library for Delphi

7.1.1.8.2.5.3.13.4 TClrAppDomain.CreateDomain Method (ClrWString, _Evidence,


_AppDomainSetup)

Creates a new application domain using the specified name, evidence, and application domain setup information.

Syntax
Delphi

class function CreateDomain(AFriendlyName: ClrWString; ASecurityInfo:


_Evidence; AInfo: _AppDomainSetup): TClrAppDomain; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.13.5 TClrAppDomain.CreateDomain Method (ClrWString, _Evidence,


_AppDomainSetup, _PermissionSet, _StrongNameArray)

Creates a new application domain using the specified name, evidence, application domain setup information, default
permission set, and array of fully trusted assemblies.

Syntax
Delphi

class function CreateDomain(AFriendlyName: ClrWString; ASecurityInfo:


_Evidence; AInfo: _AppDomainSetup; AGrantSet: _PermissionSet;

AFullTrustAssemblies: _StrongNameArray): TClrAppDomain; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.14 CreateInstance Method

This is the overview for the CreateInstance method overload.

Overload List

Name Description

TClrAppDomain.CreateInstance Creates a new instance of the specified type defined in the specified
(ClrWString, ClrWString) assembly.

TClrAppDomain.CreateInstance Creates a new instance of the specified type defined in the specified
(ClrWString, ClrWString, assembly. A parameter specifies an array of activation attributes.

1083
.Net Runtime Library for Delphi

Name Description

_ObjectArray)

7.1.1.8.2.5.3.14.1 TClrAppDomain.CreateInstance Method (ClrWString, ClrWString)

Creates a new instance of the specified type defined in the specified assembly.

Syntax
Delphi

function CreateInstance(AAssemblyName: ClrWString; ATypeName:


ClrWString): _ObjectHandle; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.14.2 TClrAppDomain.CreateInstance Method (ClrWString, ClrWString,


_ObjectArray)

Creates a new instance of the specified type defined in the specified assembly. A parameter specifies an array of
activation attributes.

Syntax
Delphi

function CreateInstance(AAssemblyName: ClrWString; ATypeName:


ClrWString; AActivationAttributes: _ObjectArray): _ObjectHandle;
overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.15 CreateInstanceFrom Method

This is the overview for the CreateInstanceFrom method overload.

Overload List

Name Description

TClrAppDomain.CreateInstanceFrom Creates a new instance of the specified type defined in the

1084
.Net Runtime Library for Delphi

Name Description

(ClrWString, ClrWString) specified assembly file.

TClrAppDomain.CreateInstanceFrom Creates a new instance of the specified type defined in the


(ClrWString, ClrWString, specified assembly file.

_ObjectArray)

7.1.1.8.2.5.3.15.1 TClrAppDomain.CreateInstanceFrom Method (ClrWString, ClrWString)

Creates a new instance of the specified type defined in the specified assembly file.

Syntax
Delphi

function CreateInstanceFrom(AAssemblyFile: ClrWString; ATypeName:


ClrWString): _ObjectHandle; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.15.2 TClrAppDomain.CreateInstanceFrom Method (ClrWString, ClrWString,


_ObjectArray)

Creates a new instance of the specified type defined in the specified assembly file.

Syntax
Delphi

function CreateInstanceFrom(AAssemblyFile: ClrWString; ATypeName:


ClrWString; AActivationAttributes: _ObjectArray): _ObjectHandle;
overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.16 DefineDynamicAssembly Method

This is the overview for the DefineDynamicAssembly method overload.

Overload List

1085
.Net Runtime Library for Delphi

Name Description

TClrAppDomain.DefineDynamicAssembly Defines a dynamic assembly with the specified name and


(_AssemblyName, access mode.

TAssemblyBuilderAccess)

TClrAppDomain.DefineDynamicAssembly Defines a dynamic assembly using the specified name, access


(_AssemblyName, mode, and storage directory.

TAssemblyBuilderAccess, ClrWString)

7.1.1.8.2.5.3.16.1 TClrAppDomain.DefineDynamicAssembly Method (_AssemblyName,


TAssemblyBuilderAccess)

Defines a dynamic assembly with the specified name and access mode.

Syntax
Delphi

function DefineDynamicAssembly(AName: _AssemblyName; AAccess:


TAssemblyBuilderAccess): _AssemblyBuilder; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.16.2 TClrAppDomain.DefineDynamicAssembly Method (_AssemblyName,


TAssemblyBuilderAccess, ClrWString)

Defines a dynamic assembly using the specified name, access mode, and storage directory.

Syntax
Delphi

function DefineDynamicAssembly(AName: _AssemblyName; AAccess:


TAssemblyBuilderAccess; ADir: ClrWString): _AssemblyBuilder; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.17 TClrAppDomain.DoCallBack Method


Executes the code in another application domain that is identified by the specified delegate.

Syntax

1086
.Net Runtime Library for Delphi

Delphi

procedure DoCallBack(ACallBackDelegate: _CrossAppDomainDelegate);


overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.18 ExecuteAssembly Method

This is the overview for the ExecuteAssembly method overload.

Overload List

Name Description

TClrAppDomain.ExecuteAssembly Executes the assembly contained in the specified file.


(TFileName)

TClrAppDomain.ExecuteAssembly Executes the assembly contained in the specified file, using the
(TFileName, specified arguments.

TClrWStringDynArray)

TClrAppDomain.ExecuteAssembly Executes the assembly contained in the specified file, using the
(TFileName, TStrings) specified arguments.

7.1.1.8.2.5.3.18.1 TClrAppDomain.ExecuteAssembly Method (TFileName)

Executes the assembly contained in the specified file.

Syntax
Delphi

function ExecuteAssembly(AAssemblyFile: TFileName): ClrInt32;


overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.18.2 TClrAppDomain.ExecuteAssembly Method (TFileName,


TClrWStringDynArray)

Executes the assembly contained in the specified file, using the specified arguments.

1087
.Net Runtime Library for Delphi

Syntax
Delphi

function ExecuteAssembly(AAssemblyFile: TFileName; AArguments:


TClrWStringDynArray): ClrInt32; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.18.3 TClrAppDomain.ExecuteAssembly Method (TFileName, TStrings)

Executes the assembly contained in the specified file, using the specified arguments.

Syntax
Delphi

function ExecuteAssembly(AAssemblyFile: TFileName; AArguments:


TStrings): ClrInt32; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.19 ExecuteAssemblyByName Method

This is the overview for the ExecuteAssemblyByName method overload.

Overload List

Name Description

TClrAppDomain.ExecuteAssemblyByName Executes an assembly given its display name.


(ClrWString)

TClrAppDomain.ExecuteAssemblyByName Executes the assembly given its display name, using the
(ClrWString, TClrWStringDynArray) specified arguments.

TClrAppDomain.ExecuteAssemblyByName Executes the assembly given its display name, using the
(ClrWString, TStrings) specified arguments.

TClrAppDomain.ExecuteAssemblyByName Executes the assembly given its display name, using the
(ClrWString, _StringArray) specified arguments.

TClrAppDomain.ExecuteAssemblyByName Executes the assembly given its display name, using the

1088
.Net Runtime Library for Delphi

Name Description

(_AssemblyName, TClrWStringDynArray) specified arguments.

TClrAppDomain.ExecuteAssemblyByName Executes the assembly given an AssemblyName, using the


(_AssemblyName, _StringArray) specified arguments.

7.1.1.8.2.5.3.19.1 TClrAppDomain.ExecuteAssemblyByName Method (ClrWString)

Executes an assembly given its display name.

Syntax
Delphi

function ExecuteAssemblyByName(AAssemblyName: ClrWString): ClrInt32;


overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.19.2 TClrAppDomain.ExecuteAssemblyByName Method (ClrWString,


TClrWStringDynArray)

Executes the assembly given its display name, using the specified arguments.

Syntax
Delphi

function ExecuteAssemblyByName(AAssemblyName: ClrWString; AArguments:


TClrWStringDynArray): ClrInt32; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.19.3 TClrAppDomain.ExecuteAssemblyByName Method (ClrWString, TStrings)

Executes the assembly given its display name, using the specified arguments.

Syntax
Delphi

function ExecuteAssemblyByName(AAssemblyName: ClrWString; AArguments:


TStrings): ClrInt32; overload;

1089
.Net Runtime Library for Delphi

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.19.4 TClrAppDomain.ExecuteAssemblyByName Method (ClrWString,


_StringArray)

Executes the assembly given its display name, using the specified arguments.

Syntax
Delphi

function ExecuteAssemblyByName(AAssemblyName: ClrWString; AArguments:


_StringArray): ClrInt32; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.19.5 TClrAppDomain.ExecuteAssemblyByName Method (_AssemblyName,


TClrWStringDynArray)
Executes the assembly given its display name, using the specified arguments.

Syntax
Delphi

function ExecuteAssemblyByName(AAssemblyName: _AssemblyName;


AArguments: TClrWStringDynArray): ClrInt32; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.19.6 TClrAppDomain.ExecuteAssemblyByName Method (_AssemblyName,


_StringArray)

Executes the assembly given an AssemblyName, using the specified arguments.

Syntax
Delphi

function ExecuteAssemblyByName(AAssemblyName: _AssemblyName;


AArguments: _StringArray): ClrInt32; overload;

See Also

1090
.Net Runtime Library for Delphi

TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.20 TClrAppDomain.GetAssemblies Method


Gets the assemblies that have been loaded into the execution context of this application domain.

Syntax
Delphi

function GetAssemblies: _AssemblyArray;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.21 TClrAppDomain.GetCurrentDomain Method


Gets the current application domain for the current Thread.

Syntax
Delphi

class function GetCurrentDomain: TClrAppDomain;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.22 TClrAppDomain.GetCurrentThreadId Method


Gets the current thread identifier.

Syntax
Delphi

class function GetCurrentThreadId: ClrInt32;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.23 TClrAppDomain.GetData Method


Gets the value stored in the current application domain for the specified name.

1091
.Net Runtime Library for Delphi

Syntax
Delphi

function GetData(const AName: ClrWString): ClrVariant; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.24 TClrAppDomain.GetDataO Method

Gets the value as ClrObject interface stored in the current application domain for the specified name.

Syntax
Delphi

function GetDataO(const AName: ClrWString): _ClrObject; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.25 TClrAppDomain.GetMonitoringIsEnabled Method


Gets a value that indicates whether CPU and memory monitoring of application domains is enabled for the current
process. Once monitoring is enabled for a process, it cannot be disabled.

Syntax
Delphi

class function GetMonitoringIsEnabled: ClrBoolean;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.26 TClrAppDomain.GetMonitoringSurvivedProcessMemorySize
Method
Gets the number of bytes that survived the last collection and that are known to be referenced by the current
application domain.

Syntax
Delphi

1092
.Net Runtime Library for Delphi

class function GetMonitoringSurvivedProcessMemorySize: ClrInt64;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.27 TClrAppDomain.GetType Method


Gets the type of the current instance.

Syntax
Delphi

function GetType: _Type;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.28 TClrAppDomain.IsDefaultAppDomain Method


Returns a value that indicates whether the application domain is the default application domain for the process.

Syntax
Delphi

function IsDefaultAppDomain: ClrBoolean;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.29 Load Method

This is the overview for the Load method overload.

Overload List

Name Description

TClrAppDomain.Load Loads an Assembly given its display name.


(ClrWString)

TClrAppDomain.Load Loads the Assembly with a common object file format (COFF) based
(TClrByteDynArray) image containing an emitted Assembly.

1093
.Net Runtime Library for Delphi

Name Description

TClrAppDomain.Load Loads the Assembly with a common object file format (COFF) based
(TClrByteDynArray, image containing an emitted Assembly. The raw bytes representing
TClrByteDynArray) the symbols for the Assembly are also loaded.

TClrAppDomain.Load Loads an Assembly given its AssemblyName.


(_AssemblyName)

TClrAppDomain.Load Loads the Assembly with a common object file format (COFF) based
(_ByteArray) image containing an emitted Assembly.

TClrAppDomain.Load Loads the Assembly with a common object file format (COFF) based
(_ByteArray, _ByteArray) image containing an emitted Assembly. The raw bytes representing
the symbols for the Assembly are also loaded.

7.1.1.8.2.5.3.29.1 TClrAppDomain.Load Method (ClrWString)

Loads an Assembly given its display name.

Syntax
Delphi

function Load(AAssemblyString: ClrWString): TClrAssembly; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.29.2 TClrAppDomain.Load Method (TClrByteDynArray)

Loads the Assembly with a common object file format (COFF) based image containing an emitted Assembly.

Syntax
Delphi

function Load(ARawAssembly: TClrByteDynArray): TClrAssembly; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

1094
.Net Runtime Library for Delphi

7.1.1.8.2.5.3.29.3 TClrAppDomain.Load Method (TClrByteDynArray, TClrByteDynArray)

Loads the Assembly with a common object file format (COFF) based image containing an emitted Assembly. The raw
bytes representing the symbols for the Assembly are also loaded.

Syntax
Delphi

function Load(ARawAssembly: TClrByteDynArray; ARawSymbolStore:


TClrByteDynArray): TClrAssembly; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.29.4 TClrAppDomain.Load Method (_AssemblyName)

Loads an Assembly given its AssemblyName.

Syntax
Delphi

function Load(AAssemblyName: _AssemblyName): TClrAssembly; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.29.5 TClrAppDomain.Load Method (_ByteArray)

Loads the Assembly with a common object file format (COFF) based image containing an emitted Assembly.

Syntax
Delphi

function Load(ARawAssembly: _ByteArray): TClrAssembly; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.29.6 TClrAppDomain.Load Method (_ByteArray, _ByteArray)

Loads the Assembly with a common object file format (COFF) based image containing an emitted Assembly. The raw
bytes representing the symbols for the Assembly are also loaded.

Syntax

1095
.Net Runtime Library for Delphi

Delphi

function Load(ARawAssembly: _ByteArray; ARawSymbolStore: _ByteArray):


TClrAssembly; overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.30 TClrAppDomain.RemoveAssemblyLoad Method


Remove the AssemblyLoad event handler.

Syntax
Delphi

procedure RemoveAssemblyLoad(AFunctionPointer: System.Pointer);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.31 TClrAppDomain.RemoveAssemblyResolve Method


Remove the AssemblyResolve event handler.

Syntax
Delphi

procedure RemoveAssemblyResolve(AFunctionPointer: System.Pointer);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.32 TClrAppDomain.RemoveDomainUnload Method


Remove the DomainUnload event handler.

Syntax
Delphi

procedure RemoveDomainUnload(AFunctionPointer: System.Pointer);

See Also

1096
.Net Runtime Library for Delphi

TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.33 TClrAppDomain.RemoveFirstChanceException Method


Remove the FirstChanceException event handler.

Syntax
Delphi

procedure RemoveFirstChanceException(AFunctionPointer:
System.Pointer);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.34 TClrAppDomain.RemoveProcessExit Method


Remove the ProcessExit event handler.

Syntax
Delphi

procedure RemoveProcessExit(AFunctionPointer: System.Pointer);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.35 TClrAppDomain.RemoveReflectionOnlyAssemblyResolve
Method
Remove the ReflectionOnlyAssemblyResolve event handler.

Syntax
Delphi

procedure RemoveReflectionOnlyAssemblyResolve(AFunctionPointer:
System.Pointer);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

1097
.Net Runtime Library for Delphi

7.1.1.8.2.5.3.36 TClrAppDomain.RemoveResourceResolve Method


Remove the ResourceResolve event handler.

Syntax
Delphi

procedure RemoveResourceResolve(AFunctionPointer: System.Pointer);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.37 TClrAppDomain.RemoveTypeResolve Method


Remove the TypeResolve event handler.

Syntax
Delphi

procedure RemoveTypeResolve(AFunctionPointer: System.Pointer);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.38 TClrAppDomain.SetData Method


Assigns the specified value to the specified application domain property.

Syntax
Delphi

procedure SetData(const AName: ClrWString; AData: ClrVariant);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.39 TClrAppDomain.SetMonitoringIsEnabled Method


Sets a value that indicates whether CPU and memory monitoring of application domains is enabled for the current
process. Once monitoring is enabled for a process, it cannot be disabled.

Syntax

1098
.Net Runtime Library for Delphi

Delphi

class procedure SetMonitoringIsEnabled(AValue: ClrBoolean);

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.40 TClrAppDomain.ToString Method


Obtains a string representation that includes the friendly name of the application domain and any context policies.

Syntax
Delphi

function ToString: string; override;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.41 Unload Method

This is the overview for the Unload method overload.

Overload List

Name Description

TClrAppDomain.Unload Unloads the instance application domain.

TClrAppDomain.Unload Unloads the specified application domain.


(TClrAppDomain)

7.1.1.8.2.5.3.41.1 TClrAppDomain.Unload Method


Unloads the instance application domain.

Syntax
Delphi

procedure Unload; overload;

See Also

1099
.Net Runtime Library for Delphi

TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.41.2 TClrAppDomain.Unload Method (TClrAppDomain)

Unloads the specified application domain.

Syntax
Delphi

class procedure Unload(AAppDomain: TClrAppDomain); overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.42 TClrAppDomain.UnloadIntf Method


Unloads the specified application domain interface.

Syntax
Delphi

class procedure UnloadIntf(AAppDomain: _AppDomain); overload;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.3.43 TClrAppDomain.Unwrap Method


Returns the .net application domain object.

Syntax
Delphi

function Unwrap: ClrVariant;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.4 TClrAppDomain Properties


The properties of the TClrAppDomain class are listed here.

1100
.Net Runtime Library for Delphi

Properties

Name Description

BaseDirectory Gets the base directory that the assembly resolver uses to probe for
assemblies.

DefaultInterface Returns the default interface of the TClrAppDomain.

DomainManager Gets the domain manager that was provided by the host when the
application domain was initialized.

Evidence Gets the Evidence associated with this application domain.

FriendlyName Gets the friendly name of this application domain.

ID Gets an integer that uniquely identifies the application domain within


the process.

IsFullyTrusted Gets a value that indicates whether assemblies that are loaded into
the current application domain execute with full trust.

7.1.1.8.2.5.4.1 TClrAppDomain.BaseDirectory Property


Gets the base directory that the assembly resolver uses to probe for assemblies.

Syntax
Delphi

property BaseDirectory: ClrWString;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.4.2 TClrAppDomain.DefaultInterface Property


Returns the default interface of the TClrAppDomain.

Syntax
Delphi

property DefaultInterface: _AppDomain;

See Also

1101
.Net Runtime Library for Delphi

TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.4.3 TClrAppDomain.DomainManager Property


Gets the domain manager that was provided by the host when the application domain was initialized.

Syntax
Delphi

property DomainManager: _AppDomainManager;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.4.4 TClrAppDomain.Evidence Property


Gets the Evidence associated with this application domain.

Syntax
Delphi

property Evidence: _Evidence;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.4.5 TClrAppDomain.FriendlyName Property


Gets the friendly name of this application domain.

Syntax
Delphi

property FriendlyName: ClrWString;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.4.6 TClrAppDomain.ID Property


Gets an integer that uniquely identifies the application domain within the process.

1102
.Net Runtime Library for Delphi

Syntax
Delphi

property ID: ClrInt32;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.5.4.7 TClrAppDomain.IsFullyTrusted Property


Gets a value that indicates whether assemblies that are loaded into the current application domain execute with full
trust.

Syntax
Delphi

property IsFullyTrusted: ClrBoolean;

See Also
TClrAppDomain Class
CNClrLib.Host Namespace

7.1.1.8.2.6 TClrArray Class


Collapse All Expand All

Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the base class for all
arrays in the common language runtime (Clr).

Inheritance Hierarchy
CNClrLib.Host.TClrArray

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrArray = class(TClrBase);

Constructors

Name Description

1103
.Net Runtime Library for Delphi

Name Description

Create(ClrVariant) Creates a new Array by converting the specified array variant.

Create(ClrWString, ClrInt32) Creates a one-dimensional Array of the specified type name and
length, with zero-based indexing.

Create(TClrVariantDynArray, Creates a new Array of the specified dynamic array of variant which
ClrWString) may be converted to the array of the specified type name .

Create(_Array) Creates an Array of the specified array interface.

Create(_ClrObject) Creates a new Array by converting the specified ClrObject interface.

Create(_Type, ClrInt32) Creates a one-dimensional Array of the specified Type and length,
with zero-based indexing.

Create(_Type, ClrInt32, Creates a two-dimensional Array of the specified Type and dimension
ClrInt32) lengths, with zero-based indexing.

Create(_Type, ClrInt32, Creates a three-dimensional Array of the specified Type and


ClrInt32, ClrInt32) dimension lengths, with zero-based indexing.

Create(_Type, Creates a multidimensional Array of the specified Type and


TClrInt32DynArray) dimension lengths, with zero-based indexing. The dimension lengths
are specified in a dynamic array of 32-bit integers.

Create(_Type, Creates a multidimensional Array of the specified Type and


TClrInt32DynArray, dimension lengths, with the specified lower bounds.
TClrInt32DynArray)

Create(_Type, _Int32Array) Creates a multidimensional Array of the specified Type and


dimension lengths, with zero-based indexing. The dimension lengths
are specified in an array of 32-bit integers.

Create(_Type, _Int32Array, Creates a multidimensional Array of the specified Type and


_Int32Array) dimension lengths, with the specified lower bounds.

Destructors

Name Description

Destroy Destroys an instance of the TClrArray.

Methods

1104
.Net Runtime Library for Delphi

Show: Private

No members matching the current filter

Name Description

AsClrObject Returns the Array object as ClrObject Interface.

AsObjectArray Returns the Array object as ObjectArray interface.

AsPointer Returns the Array object as managed pointer.

AsVariantDynArray Converts and returns the Array object as dynamic array of


variant.

BinarySearch(ClrInt32, Searches a range of elements in a one-dimensional sorted array for a


ClrInt32, ClrVariant) value, using the IComparable interface implemented by each element
of the array and by the specified value.

BinarySearch(ClrInt32, Searches a range of elements in a one-dimensional sorted array for a


ClrInt32, ClrVariant, value, using the specified IComparer interface.

IComparer)

BinarySearch(ClrInt32, Searches a range of elements in a one-dimensional sorted array for a


ClrInt32, _ClrObject) value, using the IComparable interface implemented by each element
of the array and by the specified value.

BinarySearch(ClrInt32, Searches a range of elements in a one-dimensional sorted array for a


ClrInt32, _ClrObject, value, using the specified IComparer interface.

IComparer)

BinarySearch(ClrVariant) Searches an entire one-dimensional sorted array for a specific


element, using the IComparable interface implemented by each
element of the array and by the specified object.

BinarySearch(ClrVariant, Searches an entire one-dimensional sorted array for a value using the
IComparer) specified IComparer interface.

BinarySearch(_ClrObject) Searches an entire one-dimensional sorted array for a specific


element, using the IComparable interface implemented by each
element of the array and by the specified object.

BinarySearch(_ClrObject, Searches an entire one-dimensional sorted array for a value using the
IComparer) specified IComparer interface.

Clear Sets a range of elements in an array to the default value of each


element type.

1105
.Net Runtime Library for Delphi

Name Description

Clone Creates a shallow copy of the Array.

ConstrainedCopy Copies a range of elements from an Array starting at the specified


source index and pastes them to another Array starting at the
specified destination index. Guarantees that all changes are undone if
the copy does not succeed completely.

Copy(ClrInt32, TClrArray, Copies a range of elements from an Array starting at the specified
ClrInt32, ClrInt32) source index and pastes them to another Array starting at the
specified destination index. The length and the indexes are specified
as 32-bit integers.

Copy(ClrInt64, TClrArray, Copies a range of elements from an Array starting at the specified
ClrInt64, ClrInt64) source index and pastes them to another Array starting at the
specified destination index. The length and the indexes are specified
as 64-bit integers.

Copy(TClrArray, ClrInt32) Copies all the elements of the current one-dimensional array to the
specified one-dimensional array starting at the specified destination
array index. The index is specified as a 32-bit integer.

CopyTo(TClrArray, ClrInt32) Copies all the elements of the current one-dimensional array to the
specified one-dimensional array starting at the specified destination
array index. The index is specified as a 32-bit integer.

CopyTo(TClrArray, ClrInt64) Copies all the elements of the current one-dimensional array to the
specified one-dimensional array starting at the specified destination
array index. The index is specified as a 64-bit integer.

GetLength Gets a 32-bit integer that represents the number of elements in the
specified dimension of the Array.

GetLongLength Gets a 64-bit integer that represents the number of elements in the
specified dimension of the Array.

GetLowerBound Gets the index of the first element of the specified dimension in the
array.

GetType Gets the Type of the current instance.

GetUpperBound Gets the index of the last element of the specified dimension in the
array.

GetValue(ClrInt32) Gets the value at the specified position in the one-dimensional Array.
The index is specified as a 32-bit integer.

GetValue(ClrInt32, ClrInt32) Gets the value at the specified position in the two-dimensional Array.

1106
.Net Runtime Library for Delphi

Name Description

The indexes are specified as 32-bit integers.

GetValue(ClrInt32, ClrInt32, Gets the value at the specified position in the three-dimensional
ClrInt32) Array. The indexes are specified as 32-bit integers.

GetValue(ClrInt64) Gets the value at the specified position in the one-dimensional Array.
The index is specified as a 64-bit integer.

GetValue(ClrInt64, ClrInt64) Gets the value at the specified position in the two-dimensional Array.
The indexes are specified as 64-bit integers.

GetValue(ClrInt64, ClrInt64, Gets the value at the specified position in the three-dimensional
ClrInt64) Array. The indexes are specified as 64-bit integers.

GetValue(TClrInt32DynArray) Gets the value at the specified position in the multidimensional Array.
The indexes are specified as a dynamic array of 32-bit integers.

GetValue(TClrInt64DynArray) Gets the value at the specified position in the multidimensional Array.
The indexes are specified as a dynamic array of 64-bit integers.

GetValue(_Int32Array) Gets the value at the specified position in the multidimensional Array.
The indexes are specified as an array of 32-bit integers.

GetValue(_Int64Array) Gets the value at the specified position in the multidimensional Array.
The indexes are specified as an array of 64-bit integers.

GetValueO(ClrInt32) Gets the value as ClrObject at the specified position in the one-
dimensional Array. The index is specified as a 32-bit integer.

GetValueO(ClrInt32, ClrInt32) Gets the value as ClrObject at the specified position in the two-
dimensional Array. The indexes are specified as 32-bit integers.

GetValueO(ClrInt32, ClrInt32, Gets the value as ClrObject at the specified position in the three-
ClrInt32) dimensional Array. The indexes are specified as 32-bit integers.

GetValueO(ClrInt64) Gets the value as ClrObject at the specified position in the one-
dimensional Array. The index is specified as a 64-bit integer.

GetValueO(ClrInt64, ClrInt64) Gets the value as ClrObject at the specified position in the two-
dimensional Array. The indexes are specified as 64-bit integers.

GetValueO(ClrInt64, ClrInt64, Gets the value as ClrObject at the specified position in the three-
ClrInt64) dimensional Array. The indexes are specified as 64-bit integers.

GetValueO(TClrInt32DynArray) Gets the value as ClrObject at the specified position in the

1107
.Net Runtime Library for Delphi

Name Description

multidimensional Array. The indexes are specified as a dynamic array


of 32-bit integers.

GetValueO(TClrInt64DynArray) Gets the value as ClrObject at the specified position in the


multidimensional Array. The indexes are specified as a dynamic array
of 64-bit integers.

GetValueO(_Int32Array) Gets the value as ClrObject at the specified position in the


multidimensional Array. The indexes are specified as an array of 32-
bit integers.

GetValueO(_Int64Array) Gets the value as ClrObject at the specified position in the


multidimensional Array. The indexes are specified as an array of 64-
bit integers.

IndexOf(ClrVariant) Searches for the specified variant and returns the index of its first
occurrence in a one-dimensional array.

IndexOf(ClrVariant, ClrInt32) Searches for the specified variant in a range of elements of a one-
dimensional array, and returns the index of its first occurrence. The
range extends from a specified index to the end of the array.

IndexOf(ClrVariant, ClrInt32, Searches for the specified variant in a range of elements of a one-
ClrInt32) dimensional array, and returns the index of ifs first occurrence. The
range extends from a specified index for a specified number of
elements.

IndexOf(_ClrObject) Searches for the specified object and returns the index of its first
occurrence in a one-dimensional array.

IndexOf(_ClrObject, ClrInt32) Searches for the specified object in a range of elements of a one-
dimensional array, and returns the index of its first occurrence. The
range extends from a specified index to the end of the array.

IndexOf(_ClrObject, ClrInt32, Searches for the specified object in a range of elements of a one-
ClrInt32) dimensional array, and returns the index of ifs first occurrence. The
range extends from a specified index for a specified number of
elements.

LastIndexOf(ClrVariant) Searches for the specified variant and returns the index of the last
occurrence within the entire one-dimensional Array.

LastIndexOf(ClrVariant, Searches for the specified variant and returns the index of the last
ClrInt32) occurrence within the range of elements in the one-dimensional
Array that extends from the first element to the specified index.

LastIndexOf(ClrVariant, Searches for the specified variant and returns the index of the last
occurrence within the range of elements in the one-dimensional

1108
.Net Runtime Library for Delphi

Name Description

ClrInt32, ClrInt32) Array that contains the specified number of elements and ends at the
specified index.

LastIndexOf(_ClrObject) Searches for the specified object and returns the index of the last
occurrence within the entire one-dimensional Array.

LastIndexOf(_ClrObject, Searches for the specified object and returns the index of the last
ClrInt32) occurrence within the range of elements in the one-dimensional
Array that extends from the first element to the specified index.

LastIndexOf(_ClrObject, Searches for the specified object and returns the index of the last
ClrInt32, ClrInt32) occurrence within the range of elements in the one-dimensional
Array that contains the specified number of elements and ends at the
specified index.

Reverse() Reverses the sequence of the elements in the entire one-dimensional


Array.

Reverse(ClrInt32, ClrInt32) Reverses the sequence of the elements in a range of elements in the
one-dimensional Array.

SetItem Sets a value to the element at the specified position in the one-
dimensional Array. The index is specified as a 32-bit integer.

SetItemO Sets a clrobject value to the element at the specified position in the
one-dimensional Array. The index is specified as a 32-bit integer.

SetValue(ClrVariant, ClrInt32) Sets a value to the element at the specified position in the one-
dimensional Array. The index is specified as a 32-bit integer.

SetValue(ClrVariant, ClrInt32, Sets a value to the element at the specified position in the two-
ClrInt32) dimensional Array. The indexes are specified as 32-bit integers.

SetValue(ClrVariant, ClrInt32, Sets a value to the element at the specified position in the three-
ClrInt32, ClrInt32) dimensional Array. The indexes are specified as 32-bit integers.

SetValue(ClrVariant, ClrInt64) Sets a value to the element at the specified position in the one-
dimensional Array. The index is specified as a 64-bit integer.

SetValue(ClrVariant, ClrInt64, Sets a value to the element at the specified position in the two-
ClrInt64) dimensional Array. The indexes are specified as 64-bit integers.

SetValue(ClrVariant, ClrInt64, Sets a value to the element at the specified position in the three-
ClrInt64, ClrInt64) dimensional Array. The indexes are specified as 64-bit integers.

SetValue(ClrVariant, Sets a value to the element at the specified position in the


multidimensional Array. The indexes are specified as an array of 32-

1109
.Net Runtime Library for Delphi

Name Description

_Int32Array) bit integers.

SetValue(ClrVariant, Sets a value to the element at the specified position in the


_Int64Array) multidimensional Array. The indexes are specified as an array of 64-
bit integers.

SetValue(_ClrObject, ClrInt32) Sets a clrobject value to the element at the specified position in the
one-dimensional Array. The index is specified as a 32-bit integer.

SetValue(_ClrObject, ClrInt32, Sets a clrobject value to the element at the specified position in the
ClrInt32) two-dimensional Array. The indexes are specified as 32-bit integers.

SetValue(_ClrObject, ClrInt32, Sets a clrobject value to the element at the specified position in the
ClrInt32, ClrInt32) three-dimensional Array. The indexes are specified as 32-bit integers.

SetValue(_ClrObject, ClrInt64) Sets a clrobject value to the element at the specified position in the
one-dimensional Array. The index is specified as a 64-bit integer.

SetValue(_ClrObject, ClrInt64, Sets a clrobject value to the element at the specified position in the
ClrInt64) two-dimensional Array. The indexes are specified as 64-bit integers.

SetValue(_ClrObject, ClrInt64, Sets a clrobject value to the element at the specified position in the
ClrInt64, ClrInt64) three-dimensional Array. The indexes are specified as 64-bit integers.

SetValue(_ClrObject, Sets a clrobject value to the element at the specified position in the
_Int32Array) multidimensional Array. The indexes are specified as an array of 32-
bit integers.

SetValue(_ClrObject, Sets a clrobject value to the element at the specified position in the
_Int64Array) multidimensional Array. The indexes are specified as an array of 64-
bit integers.

Sort() Sorts the elements in an entire one-dimensional Array.

Sort(ClrInt32, ClrInt32) Sorts the elements in a range of elements in a one-dimensional


Array.

Sort(ClrInt32, ClrInt32, Sorts the elements in a range of elements in a one-dimensional Array


IComparer) using the specified IComparer.

Sort(IComparer) Sorts the elements in a one-dimensional Array using the specified


IComparer.

Sort(TClrArray, TClrArray) Sorts a pair of one-dimensional Array objects (one contains the keys
and the other contains the corresponding items) based on the keys
in the first Array using the IComparable implementation of each

1110
.Net Runtime Library for Delphi

Name Description

key.

Sort(TClrArray, TClrArray, Sorts the elements in a range of elements in a one-dimensional Array


ClrInt32, ClrInt32, IComparer) using the specified IComparer.

Sort(TClrArray, TClrArray, Sorts a pair of one-dimensional Array objects (one contains the keys
IComparer) and the other contains the corresponding items) based on the keys
in the first Array using the specified IComparer.

Unwrap Returns the .net System.Array object.

Properties

Name Description

DefaultInterface Returns the default interface of the TClrArray.

IsFixedSize Gets a value indicating whether the Array has a fixed size.

IsReadOnly Gets a value indicating whether the Array is read-only.

IsSynchronized Gets a value indicating whether access to the Array is synchronized


(thread safe).

Item Gets or Sets a value to the element at the specified position


in the one-dimensional Array. The index is specified as a 32-bit
integer.

ItemO Gets or Sets a clrObject value to the element at the specified


position in the one-dimensional Array. The index is specified as a
32-bit integer.

Length Gets the total number of elements in all the dimensions of the Array.

LongLength Gets a 64-bit integer that represents the total number of elements in
all the dimensions of the Array.

Rank Gets the rank (number of dimensions) of the Array. For example, a
one-dimensional array returns 1, a two-dimensional array returns 2,
and so on.

SyncRoot Gets a variant that can be used to synchronize access to the Array.

SyncRootO Gets a clrobject that can be used to synchronize access to the Array.

1111
.Net Runtime Library for Delphi

See Also
Create Constructor
TClrArray Methods
TClrArray Properties

7.1.1.8.2.6.1 Create Constructor


This is the overview for the Create constructor overload.

Overload List

Name Description

Create(ClrVariant) Creates a new Array by converting the specified array variant.

Create(ClrWString, ClrInt32) Creates a one-dimensional Array of the specified type nameand


length, with zero-based indexing.

Create(TClrVariantDynArray, Creates a new Array of the specified dynamic array of variant which
ClrWString) may be converted to the array of the specified t ype name.

Create(_Array) Creates an Array of the specified array interface.

Create(_ClrObject) Creates a new Array by converting the specified ClrObject interface.

Create(_Type, ClrInt32) Creates a one-dimensional Array of the specified Type and length,
with zero-based indexing.

Create(_Type, ClrInt32, Creates a two-dimensional Array of the specified Type and dimension
ClrInt32) lengths, with zero-based indexing.

Create(_Type, ClrInt32, Creates a three-dimensional Array of the specified Type and


ClrInt32, ClrInt32) dimension lengths, with zero-based indexing.

Create(_Type, Creates a multidimensional Array of the specified Type and


TClrInt32DynArray) dimension lengths, with zero-based indexing. The dimension lengths
are specified in a dynamic array of 32-bit integers.

Create(_Type, Creates a multidimensional Array of the specified Type and


TClrInt32DynArray, dimension lengths, with the specified lower bounds.
TClrInt32DynArray)

Create(_Type, _Int32Array) Creates a multidimensional Array of the specified Type and


dimension lengths, with zero-based indexing. The dimension lengths
are specified in an array of 32-bit integers.

1112
.Net Runtime Library for Delphi

Name Description

Create(_Type, _Int32Array, Creates a multidimensional Array of the specified Type and


_Int32Array) dimension lengths, with the specified lower bounds.

7.1.1.8.2.6.1.1 TClrArray.Create Constructor (ClrVariant)


Creates a new Array by converting the specified array variant.

Syntax
Delphi

constructor Create(AArray: ClrVariant); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.1.2 TClrArray.Create Constructor (ClrWString, ClrInt32)


Creates a one-dimensional Arrayof the specified type name and length, with zero-based indexing.

Syntax
Delphi

constructor Create(AElementTypeName: ClrWString; ALength: ClrInt32);


overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.1.3 TClrArray.Create Constructor (TClrVariantDynArray, ClrWString)


Creates a new Array of the specified dynamic array of variant which may be converted to the array of the specified t ype
name.

Syntax
Delphi

constructor Create(AValues: TClrVariantDynArray; AElementTypeName:


ClrWString = ''); overload;

See Also

1113
.Net Runtime Library for Delphi

TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.1.4 TClrArray.Create Constructor (_Array)


Creates an Array of the specified array interface.

Syntax
Delphi

constructor Create(AIntf: _Array); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.1.5 TClrArray.Create Constructor (_ClrObject)

Creates a new Array by converting the specified ClrObject interface.

Syntax
Delphi

constructor Create(AIntf: _ClrObject); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.1.6 TClrArray.Create Constructor (_Type, ClrInt32)


Creates a one-dimensional Array of the specified Type and length, with zero-based indexing.

Syntax
Delphi

constructor Create(AElementType: _Type; ALength: ClrInt32); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.1.7 TClrArray.Create Constructor (_Type, ClrInt32, ClrInt32)


Creates a two-dimensional Array of the specified Type and dimension lengths, with zero-based indexing.

1114
.Net Runtime Library for Delphi

Syntax
Delphi

constructor Create(AElementType: _Type; ALength1: ClrInt32; ALength2:


ClrInt32); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.1.8 TClrArray.Create Constructor (_Type, ClrInt32, ClrInt32, ClrInt32)


Creates a three-dimensional Array of the specified Type and dimension lengths, with zero-based indexing.

Syntax
Delphi

constructor Create(AElementType: _Type; ALength1: ClrInt32; ALength2:


ClrInt32; Length3: ClrInt32); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.1.9 TClrArray.Create Constructor (_Type, TClrInt32DynArray)


Creates a multidimensional Array of the specified Type and dimension lengths, with zero-based indexing. The
dimension lengths are specified in a dynamic array of 32-bit integers.

Syntax
Delphi

constructor Create(AElementType: _Type; ALengths: TClrInt32DynArray);


overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.1.10 TClrArray.Create Constructor (_Type, TClrInt32DynArray,


TClrInt32DynArray)
Creates a multidimensional Array of the specified Type and dimension lengths, with the specified lower bounds.

Syntax

1115
.Net Runtime Library for Delphi

Delphi

constructor Create(AElementType: _Type; ALengths: TClrInt32DynArray;


ALowerBounds: TClrInt32DynArray); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.1.11 TClrArray.Create Constructor (_Type, _Int32Array)


Creates a multidimensional Array of the specified Type and dimension lengths, with zero-based indexing. The
dimension lengths are specified in an array of 32-bit integers.

Syntax
Delphi

constructor Create(AElementType: _Type; ALengths: _Int32Array);


overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.1.12 TClrArray.Create Constructor (_Type, _Int32Array, _Int32Array)


Creates a multidimensional Array of the specified Type and dimension lengths, with the specified lower bounds.

Syntax
Delphi

constructor Create(AElementType: _Type; ALengths: _Int32Array;


ALowerBounds: _Int32Array); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.2 TClrArray.Destroy Destructor


Destroys an instance of the TClrArray.

Syntax
Delphi

destructor Destroy; override;

1116
.Net Runtime Library for Delphi

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3 TClrArray Methods


The methods of the TClrArray class are listed here.

Methods

Show: Private

No members matching the current filter

Name Description

AsClrObject Returns the Array object as ClrObject Interface.

AsObjectArray Returns the Array object as ObjectArray interface.

AsPointer Returns the Array object as managed pointer.

AsVariantDynArray Converts and returns the Array object as dynamic array of


variant.

BinarySearch(ClrInt32, Searches a range of elements in a one-dimensional sorted array for a


ClrInt32, ClrVariant) value, using the IComparable interface implemented by each element
of the array and by the specified value.

BinarySearch(ClrInt32, Searches a range of elements in a one-dimensional sorted array for a


ClrInt32, ClrVariant, value, using the specified IComparer interface.

IComparer)

BinarySearch(ClrInt32, Searches a range of elements in a one-dimensional sorted array for a


ClrInt32, _ClrObject) value, using the Comparable interface implemented by each element
of the array and by the specified value.

BinarySearch(ClrInt32, Searches a range of elements in a one-dimensional sorted array for a


ClrInt32, _ClrObject, value, using the specified IComparer interface.

IComparer)

BinarySearch(ClrVariant) Searches an entire one-dimensional sorted array for a specific


element, using the IComparable interface implemented by each
element of the array and by the specified object.

BinarySearch(ClrVariant, Searches an entire one-dimensional sorted array for a value using the

1117
.Net Runtime Library for Delphi

Name Description

IComparer) specified IComparer interface.

BinarySearch(_ClrObject) Searches an entire one-dimensional sorted array for a


specific element, using the IComparablei nterface implemented
by each element of the array and by the specified object.

BinarySearch(_ClrObject, Searches an entire one-dimensional sorted array for a value using the
IComparer) specified IComparer interface.

Clear Sets a range of elements in an array to the default value of each


element type.

Clone Creates a shallow copy of the Array.

ConstrainedCopy Copies a range of elements from an Array starting at the specified


source index and pastes them to another Array starting at the
specified destination index. Guarantees that all changes are undone if
the copy does not succeed completely.

Copy(ClrInt32, TClrArray, Copies a range of elements from an Array starting at the specified
ClrInt32, ClrInt32) source index and pastes them to another Array starting at the
specified destination index. The length and the indexes are specified
as 32-bit integers.

Copy(ClrInt64, TClrArray, Copies a range of elements from an Array starting at the specified
ClrInt64, ClrInt64) source index and pastes them to another Array starting at the
specified destination index. The length and the indexes are specified
as 64-bit integers.

Copy(TClrArray, ClrInt32) Copies all the elements of the current one-dimensional array to the
specified one-dimensional array starting at the specified destination
array index. The index is specified as a 32-bit integer.

CopyTo(TClrArray, ClrInt32) Copies all the elements of the current one-dimensional array to the
specified one-dimensional array starting at the specified destination
array index. The index is specified as a 32-bit integer.

CopyTo(TClrArray, ClrInt64) Copies all the elements of the current one-dimensional array to the
specified one-dimensional array starting at the specified destination
array index. The index is specified as a 64-bit integer.

GetLength Gets a 32-bit integer that represents the number of elements in the
specified dimension of the Array.

GetLongLength Gets a 64-bit integer that represents the number of elements in the
specified dimension of the Array.

1118
.Net Runtime Library for Delphi

Name Description

GetLowerBound Gets the index of the first element of the specified


dimension in the array.

GetType Gets the Type of the current instance.

GetUpperBound Gets the index of the last element of the specified dimension in the
array.

GetValue(ClrInt32) Gets the value at the specified position in the one-dimensional Array.
The index is specified as a 32-bit integer.

GetValue(ClrInt32, ClrInt32) Gets the value at the specified position in the two-dimensional Array.
The indexes are specified as 32-bit integers.

GetValue(ClrInt32, ClrInt32, Gets the value at the specified position in the three-dimensional
ClrInt32) Array . The indexes are specified as 32-bit integers.

GetValue(ClrInt64) Gets the value at the specified position in the one-


dimensional Array . The index is specified as a 64-bit integer.

GetValue(ClrInt64, ClrInt64) Gets the value at the specified position in the two-dimensional Array
. The indexes are specified as 64-bit integers.

GetValue(ClrInt64, ClrInt64, Gets the value at the specified position in the three-dimensional
ClrInt64) Array. The indexes are specified as 64-bit integers.

GetValue(TClrInt32DynArray) Gets the value at the specified position in the multidimensional Array.
The indexes are specified as a dynamic array of 32-bit integers.

GetValue(TClrInt64DynArray) Gets the value at the specified position in the multidimensional


Array. The indexes are specified as a dynamic array of 64-bit
integers.

GetValue(_Int32Array) Gets the value at the specified position in the multidimensional Array.
The indexes are specified as an array of 32-bit integers.

GetValue(_Int64Array) Gets the value at the specified position in the multidimensional Array.
The indexes are specified as an array of 64-bit integers.

GetValueO(ClrInt32) Gets the value as ClrObject at the specified position in the one-
dimensional Array. The index is specified as a 32-bit integer.

GetValueO(ClrInt32, ClrInt32) Gets the value as ClrObject at the specified position in the
two-dimensional Array. The indexes are specified as 32-bit
integers.

1119
.Net Runtime Library for Delphi

Name Description

GetValueO(ClrInt32, ClrInt32, Gets the value as ClrObject at the specified position in the three-
ClrInt32) dimensional Array. The indexes are specified as 32-bit integers.

GetValueO(ClrInt64) Gets the value as ClrObject at the specified position in the one-
dimensional Array. The index is specified as a 64-bit integer.

GetValueO(ClrInt64, ClrInt64) Gets the value as ClrObject at the specified position in the two-
dimensional Array. The indexes are specified as 64-bit integers.

GetValueO(ClrInt64, ClrInt64, Gets the value as ClrObject at the specified position in the three-
ClrInt64) dimensional Array. The indexes are specified as 64-bit integers.

GetValueO(TClrInt32DynArray) Gets the value as ClrObject at the specified position in the


multidimensional Array. The indexes are specified as a dynamic array
of 32-bit integers.

GetValueO(TClrInt64DynArray) Gets the value as ClrObject at the specified position in the


multidimensional Array. The indexes are specified as a dynamic array
of 64-bit integers.

GetValueO(_Int32Array) Gets the value as ClrObject at the specified position in the


multidimensional Array. The indexes are specified as an array of 32-
bit integers.

GetValueO(_Int64Array) Gets the value as ClrObject at the specified position in the


multidimensional Array. The indexes are specified as an array of 64-
bit integers.

IndexOf(ClrVariant) Searches for the specified variant and returns the index of its first
occurrence in a one-dimensional array.

IndexOf(ClrVariant, ClrInt32) Searches for the specified variant in a range of elements of a one-
dimensional array, and returns the index of its first occurrence. The
range extends from a specified index to the end of the array.

IndexOf(ClrVariant, ClrInt32, Searches for the specified variant in a range of elements of a one-
ClrInt32) dimensional array, and returns the index of ifs first occurrence. The
range extends from a specified index for a specified number of
elements.

IndexOf(_ClrObject) Searches for the specified object and returns the index of its first
occurrence in a one-dimensional array.

IndexOf(_ClrObject, ClrInt32) Searches for the specified object in a range of elements of a one-
dimensional array, and returns the index of its first occurrence. The
range extends from a specified index to the end of the array.

1120
.Net Runtime Library for Delphi

Name Description

IndexOf(_ClrObject, ClrInt32, Searches for the specified object in a range of elements of a one-
ClrInt32) dimensional array, and returns the index of ifs first occurrence. The
range extends from a specified index for a specified number of
elements.

LastIndexOf(ClrVariant) Searches for the specified variant and returns the index of the last
occurrence within the entire one-dimensional Array.

LastIndexOf(ClrVariant, Searches for the specified variant and returns the index of the last
ClrInt32) occurrence within the range of elements in the one-dimensional
Array that extends from the first element to the specified index.

LastIndexOf(ClrVariant, Searches for the specified variant and returns the index of the last
ClrInt32, ClrInt32) occurrence within the range of elements in the one-dimensional
Array that contains the specified number of elements and ends at the
specified index.

LastIndexOf(_ClrObject) Searches for the specified object and returns the index of the last
occurrence within the entire one-dimensional Array.

LastIndexOf(_ClrObject, Searches for the specified object and returns the index of the last
ClrInt32) occurrence within the range of elements in the one-dimensional
Array that extends from the first element to the specified index.

LastIndexOf(_ClrObject, Searches for the specified object and returns the index of the last
ClrInt32, ClrInt32) occurrence within the range of elements in the one-dimensional
Array that contains the specified number of elements and ends at the
specified index.

Reverse() Reverses the sequence of the elements in the entire one-dimensional


Array.

Reverse(ClrInt32, ClrInt32) Reverses the sequence of the elements in a range of elements in the
one-dimensional Array.

SetItem Sets a value to the element at the specified position in the one-
dimensional Array. The index is specified as a 32-bit integer.

SetItemO Sets a clrobject value to the element at the specified position in the
one-dimensional Array. The index is specified as a 32-bit integer.

SetValue(ClrVariant, ClrInt32) Sets a value to the element at the specified position in the one-
dimensional Array. The index is specified as a 32-bit integer.

SetValue(ClrVariant, ClrInt32, Sets a value to the element at the specified position in the two-
ClrInt32) dimensional Array. The indexes are specified as 32-bit integers.

1121
.Net Runtime Library for Delphi

Name Description

SetValue(ClrVariant, ClrInt32, Sets a value to the element at the specified position in the three-
ClrInt32, ClrInt32) dimensional Array. The indexes are specified as 32-bit integers.

SetValue(ClrVariant, ClrInt64) Sets a value to the element at the specified position in the one-
dimensional Array. The index is specified as a 64-bit integer.

SetValue(ClrVariant, ClrInt64, Sets a value to the element at the specified position in the two-
ClrInt64) dimensional Array. The indexes are specified as 64-bit integers.

SetValue(ClrVariant, ClrInt64, Sets a value to the element at the specified position in the three-
ClrInt64, ClrInt64) dimensional Array. The indexes are specified as 64-bit integers.

SetValue(ClrVariant, Sets a value to the element at the specified position in the


_Int32Array) multidimensional Array. The indexes are specified as an array of 32-
bit integers.

SetValue(ClrVariant, Sets a value to the element at the specified position in the


_Int64Array) multidimensional Array. The indexes are specified as an array of 64-
bit integers.

SetValue(_ClrObject, ClrInt32) Sets a clrobject value to the element at the specified position in the
one-dimensional Array. The index is specified as a 32-bit integer.

SetValue(_ClrObject, ClrInt32, Sets a clrobject value to the element at the specified position in the
ClrInt32) two-dimensional Array. The indexes are specified as 32-bit integers.

SetValue(_ClrObject, ClrInt32, Sets a clrobject value to the element at the specified position in the
ClrInt32, ClrInt32) three-dimensional Array. The indexes are specified as 32-bit integers.

SetValue(_ClrObject, ClrInt64) Sets a clrobject value to the element at the specified position in the
one-dimensional Array. The index is specified as a 64-bit integer.

SetValue(_ClrObject, ClrInt64, Sets a clrobject value to the element at the specified position in the
ClrInt64) two-dimensional Array. The indexes are specified as 64-bit integers.

SetValue(_ClrObject, ClrInt64, Sets a clrobject value to the element at the specified position in the
ClrInt64, ClrInt64) three-dimensional Array. The indexes are specified as 64-bit integers.

SetValue(_ClrObject, Sets a clrobject value to the element at the specified position in the
_Int32Array) multidimensional Array. The indexes are specified as an array of 32-
bit integers.

SetValue(_ClrObject, Sets a clrobject value to the element at the specified position in the
_Int64Array) multidimensional Array. The indexes are specified as an array of 64-
bit integers.

1122
.Net Runtime Library for Delphi

Name Description

Sort() Sorts the elements in an entire one-dimensional Array.

Sort(ClrInt32, ClrInt32) Sorts the elements in a range of elements in a one-dimensional


Array.

Sort(ClrInt32, ClrInt32, Sorts the elements in a range of elements in a one-dimensional Array


IComparer) using the specified IComparer.

Sort(IComparer) Sorts the elements in a one-dimensional Array using the specified


IComparer.

Sort(TClrArray, TClrArray) Sorts a pair of one-dimensional Array objects (one contains the keys
and the other contains the corresponding items) based on the keys
in the first Array using the IComparable implementation of each
key.

Sort(TClrArray, TClrArray, Sorts the elements in a range of elements in a one-dimensional Array


ClrInt32, ClrInt32, IComparer) using the specified IComparer.

Sort(TClrArray, TClrArray, Sorts a pair of one-dimensional Array objects (one contains the keys
IComparer) and the other contains the corresponding items) based on the keys
in the first Array using the specified IComparer.

Unwrap Returns the .net System.Array object.

7.1.1.8.2.6.3.1 TClrArray.AsClrObject Method


Returns the Array object as ClrObject Interface.

Syntax
Delphi

function AsClrObject: _ClrObject;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.2 TClrArray.AsObjectArray Method


Returns the Array object as ObjectArray interface.

Syntax

1123
.Net Runtime Library for Delphi

Delphi

function AsObjectArray: _ObjectArray;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.3 TClrArray.AsPointer Method


Returns the Array object as managed pointer.

Syntax
Delphi

function AsPointer: _IntPtr;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.4 TClrArray.AsVariantDynArray Method


Converts and returns the Array object as dynamic array of variant.

Syntax
Delphi

function AsVariantDynArray: TClrVariantDynArray;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.5 BinarySearch Method

This is the overview for the BinarySearch method overload.

Overload List

Name Description

TClrArray.BinarySearch Searches a range of elements in a one-dimensional sorted array for a


(ClrInt32, ClrInt32, value, using the IComparable interface implemented by each element
of the array and by the specified value.
ClrVariant)

1124
.Net Runtime Library for Delphi

Name Description

TClrArray.BinarySearch Searches a range of elements in a one-dimensional sorted array for a


(ClrInt32, ClrInt32, value, using the specified IComparer interface.

ClrVariant, IComparer)

TClrArray.BinarySearch Searches a range of elements in a one-dimensional sorted array for a


(ClrInt32, ClrInt32, value, using the IComparable interface implemented by each element
of the array and by the specified value.
_ClrObject)

TClrArray.BinarySearch Searches a range of elements in a one-dimensional sorted array for a


(ClrInt32, ClrInt32, value, using the specified IComparer interface.

_ClrObject, IComparer)

TClrArray.BinarySearch Searches an entire one-dimensional sorted array for a specific


(ClrVariant) element, using the IComparable interface implemented by each
element of the array and by the specified object.

TClrArray.BinarySearch Searches an entire one-dimensional sorted array for a value using the
(ClrVariant, IComparer) specified IComparer interface.

TClrArray.BinarySearch Searches an entire one-dimensional sorted array for a specific


(_ClrObject) element, using the IComparable interface implemented by each
element of the array and by the specified object.

TClrArray.BinarySearch Searches an entire one-dimensional sorted array for a value using the
(_ClrObject, IComparer) specified IComparer interface.

7.1.1.8.2.6.3.5.1 TClrArray.BinarySearch Method (ClrInt32, ClrInt32, ClrVariant)

Searches a range of elements in a one-dimensional sorted array for a value, using the IComparable interface
implemented by each element of the array and by the specified value.

Syntax
Delphi

function BinarySearch(AIndex: ClrInt32; ALength: ClrInt32; AValue:


ClrVariant): ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.5.2 TClrArray.BinarySearch Method (ClrInt32, ClrInt32, ClrVariant, IComparer)

Searches a range of elements in a one-dimensional sorted array for a value, using the specified IComparer interface.

1125
.Net Runtime Library for Delphi

Syntax
Delphi

function BinarySearch(AIndex: ClrInt32; ALength: ClrInt32; AValue:


ClrVariant; AComparer: IComparer): ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.5.3 TClrArray.BinarySearch Method (ClrInt32, ClrInt32, _ClrObject)

Searches a range of elements in a one-dimensional sorted array for a value, using the IComparable interface
implemented by each element of the array and by the specified value.

Syntax
Delphi

function BinarySearch(AIndex: ClrInt32; ALength: ClrInt32; AValue:


_ClrObject): ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.5.4 TClrArray.BinarySearch Method (ClrInt32, ClrInt32, _ClrObject, IComparer)

Searches a range of elements in a one-dimensional sorted array for a value, using the specified IComparer interface.

Syntax
Delphi

function BinarySearch(AIndex: ClrInt32; ALength: ClrInt32; AValue:


_ClrObject; AComparer: IComparer): ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.5.5 TClrArray.BinarySearch Method (ClrVariant)

Searches an entire one-dimensional sorted array for a specific element, using the IComparable interface implemented
by each element of the array and by the specified object.

Syntax
Delphi

1126
.Net Runtime Library for Delphi

function BinarySearch(AValue: ClrVariant): ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.5.6 TClrArray.BinarySearch Method (ClrVariant, IComparer)

Searches an entire one-dimensional sorted array for a value using the specified IComparer interface.

Syntax
Delphi

function BinarySearch(AValue: ClrVariant; AComparer: IComparer):


ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.5.7 TClrArray.BinarySearch Method (_ClrObject)

Searches an entire one-dimensional sorted array for a specific element, using the IComparable interface implemented
by each element of the array and by the specified object.

Syntax
Delphi

function BinarySearch(AValue: _ClrObject): ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.5.8 TClrArray.BinarySearch Method (_ClrObject, IComparer)

Searches an entire one-dimensional sorted array for a value using the specified IComparer interface.

Syntax
Delphi

function BinarySearch(AValue: _ClrObject; AComparer: IComparer):


ClrInt32; overload;

See Also

1127
.Net Runtime Library for Delphi

TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.6 TClrArray.Clear Method


Sets a range of elements in an array to the default value of each element type.

Syntax
Delphi

procedure Clear(AIndex: ClrInt32; ALength: ClrInt32);

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.7 TClrArray.Clone Method


Creates a shallow copy of the Array.

Syntax
Delphi

function Clone: TClrArray;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.8 TClrArray.ConstrainedCopy Method


Copies a range of elements from an Array starting at the specified source index and pastes them to another Array
starting at the specified destination index. Guarantees that all changes are undone if the copy does not succeed
completely.

Syntax
Delphi

procedure ConstrainedCopy(ASourceIndex: ClrInt32; ADestinationArray:


TClrArray; ADestinationIndex: ClrInt32; ALength: ClrInt32);

See Also
TClrArray Class
CNClrLib.Host Namespace

1128
.Net Runtime Library for Delphi

7.1.1.8.2.6.3.9 Copy Method

This is the overview for the Copy method overload.

Overload List

Name Description

TClrArray.Copy (ClrInt32, Copies a range of elements from an Array starting at the specified
TClrArray, ClrInt32, ClrInt32) source index and pastes them to another Array starting at the
specified destination index. The length and the indexes are specified
as 32-bit integers.

TClrArray.Copy (ClrInt64, Copies a range of elements from an Array starting at the specified
TClrArray, ClrInt64, ClrInt64) source index and pastes them to another Array starting at the
specified destination index. The length and the indexes are specified
as 64-bit integers.

TClrArray.Copy (TClrArray, Copies all the elements of the current one-dimensional array to the
ClrInt32) specified one-dimensional array starting at the specified destination
array index. The index is specified as a 32-bit integer.

7.1.1.8.2.6.3.9.1 TClrArray.Copy Method (ClrInt32, TClrArray, ClrInt32, ClrInt32)

Copies a range of elements from an Array starting at the specified source index and pastes them to another Array
starting at the specified destination index. The length and the indexes are specified as 32-bit integers.

Syntax
Delphi

procedure Copy(ASourceIndex: ClrInt32; ADestinationArray: TClrArray;


ADestinationIndex: ClrInt32; ALength: ClrInt32); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.9.2 TClrArray.Copy Method (ClrInt64, TClrArray, ClrInt64, ClrInt64)

Copies a range of elements from an Array starting at the specified source index and pastes them to another Array
starting at the specified destination index. The length and the indexes are specified as 64-bit integers.

Syntax
Delphi

procedure Copy(ASourceIndex: ClrInt64; ADestinationArray: TClrArray;


ADestinationIndex: ClrInt64; ALength: ClrInt64); overload;

1129
.Net Runtime Library for Delphi

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.9.3 TClrArray.Copy Method (TClrArray, ClrInt32)

Copies all the elements of the current one-dimensional array to the specified one-dimensional array starting at the
specified destination array index. The index is specified as a 32-bit integer.

Syntax
Delphi

procedure Copy(ADestinationArray: TClrArray; ALength: ClrInt32);


overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.10 CopyTo Method

This is the overview for the CopyTo method overload.

Overload List

Name Description

TClrArray.CopyTo (TClrArray, Copies all the elements of the current one-dimensional array to the
ClrInt32) specified one-dimensional array starting at the specified destination
array index. The index is specified as a 32-bit integer.

TClrArray.CopyTo (TClrArray, Copies all the elements of the current one-dimensional array to the
ClrInt64) specified one-dimensional array starting at the specified destination
array index. The index is specified as a 64-bit integer.

7.1.1.8.2.6.3.10.1 TClrArray.CopyTo Method (TClrArray, ClrInt32)

Copies all the elements of the current one-dimensional array to the specified one-dimensional array starting at the
specified destination array index. The index is specified as a 32-bit integer.

Syntax
Delphi

procedure CopyTo(AArray: TClrArray; AIndex: ClrInt32); overload;

See Also

1130
.Net Runtime Library for Delphi

TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.10.2 TClrArray.CopyTo Method (TClrArray, ClrInt64)

Copies all the elements of the current one-dimensional array to the specified one-dimensional array starting at the
specified destination array index. The index is specified as a 64-bit integer.

Syntax
Delphi

procedure CopyTo(AArray: TClrArray; AIndex: ClrInt64); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.11 TClrArray.GetLength Method


Gets a 32-bit integer that represents the number of elements in the specified dimension of the Array.

Syntax
Delphi

function GetLength(ADimension: ClrInt32): ClrInt32;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.12 TClrArray.GetLongLength Method


Gets a 64-bit integer that represents the number of elements in the specified dimension of the Array.

Syntax
Delphi

function GetLongLength(ADimension: ClrInt32): ClrInt64;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.13 TClrArray.GetLowerBound Method


Gets the index of the first element of the specified dimension in the array.

1131
.Net Runtime Library for Delphi

Syntax
Delphi

function GetLowerBound(ADimension: ClrInt32): ClrInt32;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.14 TClrArray.GetType Method


Gets the Type of the current instance.

Syntax
Delphi

function GetType: _Type;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.15 TClrArray.GetUpperBound Method


Gets the index of the last element of the specified dimension in the array.

Syntax
Delphi

function GetUpperBound(ADimension: ClrInt32): ClrInt32;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.16 GetValue Method

This is the overview for the GetValue method overload.

Overload List

Name Description

TClrArray.GetValue Gets the value at the specified position in the one-dimensional Array.

1132
.Net Runtime Library for Delphi

Name Description

(ClrInt32) The index is specified as a 32-bit integer.

TClrArray.GetValue Gets the value at the specified position in the two-dimensional Array.
(ClrInt32, ClrInt32) The indexes are specified as 32-bit integers.

TClrArray.GetValue Gets the value at the specified position in the three-dimensional Array.
(ClrInt32, ClrInt32, ClrInt32) The indexes are specified as 32-bit integers.

TClrArray.GetValue Gets the value at the specified position in the one-dimensional Array.
(ClrInt64) The index is specified as a 64-bit integer.

TClrArray.GetValue Gets the value at the specified position in the two-dimensional Array.
(ClrInt64, ClrInt64) The indexes are specified as 64-bit integers.

TClrArray.GetValue Gets the value at the specified position in the three-dimensional Array.
(ClrInt64, ClrInt64, ClrInt64) The indexes are specified as 64-bit integers.

TClrArray.GetValue Gets the value at the specified position in the multidimensional Array.
(TClrInt32DynArray) The indexes are specified as a dynamic array of 32-bit integers.

TClrArray.GetValue Gets the value at the specified position in the multidimensional Array.
(TClrInt64DynArray) The indexes are specified as a dynamic array of 64-bit integers.

TClrArray.GetValue Gets the value at the specified position in the multidimensional Array.
(_Int32Array) The indexes are specified as an array of 32-bit integers.

TClrArray.GetValue Gets the value at the specified position in the multidimensional Array.
(_Int64Array) The indexes are specified as an array of 64-bit integers.

7.1.1.8.2.6.3.16.1 TClrArray.GetValue Method (ClrInt32)

Gets the value at the specified position in the one-dimensional Array. The index is specified as a 32-bit integer.

Syntax
Delphi

function GetValue(AIndex: ClrInt32): ClrVariant; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

1133
.Net Runtime Library for Delphi

7.1.1.8.2.6.3.16.2 TClrArray.GetValue Method (ClrInt32, ClrInt32)

Gets the value at the specified position in the two-dimensional Array. The indexes are specified as 32-bit integers.

Syntax
Delphi

function GetValue(AIndex1: ClrInt32; AIndex2: ClrInt32): ClrVariant;


overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.16.3 TClrArray.GetValue Method (ClrInt32, ClrInt32, ClrInt32)

Gets the value at the specified position in the three-dimensional Array. The indexes are specified as 32-bit integers.

Syntax
Delphi

function GetValue(AIndex1: ClrInt32; AIndex2: ClrInt32; AIndex3:


ClrInt32): ClrVariant; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.16.4 TClrArray.GetValue Method (ClrInt64)

Gets the value at the specified position in the one-dimensional Array. The index is specified as a 64-bit integer.

Syntax
Delphi

function GetValue(AIndex: ClrInt64): ClrVariant; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.16.5 TClrArray.GetValue Method (ClrInt64, ClrInt64)

Gets the value at the specified position in the two-dimensional Array. The indexes are specified as 64-bit integers.

Syntax

1134
.Net Runtime Library for Delphi

Delphi

function GetValue(AIndex1: ClrInt64; AIndex2: ClrInt64): ClrVariant;


overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.16.6 TClrArray.GetValue Method (ClrInt64, ClrInt64, ClrInt64)

Gets the value at the specified position in the three-dimensional Array. The indexes are specified as 64-bit integers.

Syntax
Delphi

function GetValue(AIndex1: ClrInt64; AIndex2: ClrInt64; AIndex3:


ClrInt64): ClrVariant; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.16.7 TClrArray.GetValue Method (TClrInt32DynArray)

Gets the value at the specified position in the multidimensional Array. The indexes are specified as a dynamic array of
32-bit integers.

Syntax
Delphi

function GetValue(AIndices: TClrInt32DynArray): ClrVariant; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.16.8 TClrArray.GetValue Method (TClrInt64DynArray)

Gets the value at the specified position in the multidimensional Array. The indexes are specified as a dynamic array of
64-bit integers.

Syntax
Delphi

function GetValue(AIndices: TClrInt64DynArray): ClrVariant; overload;

1135
.Net Runtime Library for Delphi

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.16.9 TClrArray.GetValue Method (_Int32Array)

Gets the value at the specified position in the multidimensional Array. The indexes are specified as an array of 32-bit
integers.

Syntax
Delphi

function GetValue(AIndices: _Int32Array): ClrVariant; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.16.10 TClrArray.GetValue Method (_Int64Array)

Gets the value at the specified position in the multidimensional Array. The indexes are specified as an array of 64-bit
integers.

Syntax
Delphi

function GetValue(AIndices: _Int64Array): ClrVariant; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.17 GetValueO Method

This is the overview for the GetValueO method overload.

Overload List

Name Description

TClrArray.GetValueO Gets the value as ClrObject at the specified position in the one-
(ClrInt32) dimensional Array. The index is specified as a 32-bit integer.

TClrArray.GetValueO Gets the value as ClrObject at the specified position in the two-
(ClrInt32, ClrInt32) dimensional Array. The indexes are specified as 32-bit integers.

1136
.Net Runtime Library for Delphi

Name Description

TClrArray.GetValueO Gets the value as ClrObject at the specified position in the three-
(ClrInt32, ClrInt32, ClrInt32) dimensional Array. The indexes are specified as 32-bit integers.

TClrArray.GetValueO Gets the value as ClrObject at the specified position in the one-
(ClrInt64) dimensional Array. The index is specified as a 64-bit integer.

TClrArray.GetValueO Gets the value as ClrObject at the specified position in the two-
(ClrInt64, ClrInt64) dimensional Array. The indexes are specified as 64-bit integers.

TClrArray.GetValueO Gets the value as ClrObject at the specified position in the three-
(ClrInt64, ClrInt64, ClrInt64) dimensional Array. The indexes are specified as 64-bit integers.

TClrArray.GetValueO Gets the value as ClrObject at the specified position in the


(TClrInt32DynArray) multidimensional Array. The indexes are specified as a dynamic array
of 32-bit integers.

TClrArray.GetValueO Gets the value as ClrObject at the specified position in the


(TClrInt64DynArray) multidimensional Array. The indexes are specified as a dynamic array
of 64-bit integers.

TClrArray.GetValueO Gets the value as ClrObject at the specified position in the


(_Int32Array) multidimensional Array. The indexes are specified as an array of 32-bit
integers.

TClrArray.GetValueO Gets the value as ClrObject at the specified position in the


(_Int64Array) multidimensional Array. The indexes are specified as an array of 64-bit
integers.

7.1.1.8.2.6.3.17.1 TClrArray.GetValueO Method (ClrInt32)

Gets the value as ClrObject at the specified position in the one-dimensional Array. The index is specified as a 32-bit
integer.

Syntax
Delphi

function GetValueO(AIndex: ClrInt32): _ClrObject; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

1137
.Net Runtime Library for Delphi

7.1.1.8.2.6.3.17.2 TClrArray.GetValueO Method (ClrInt32, ClrInt32)

Gets the value as ClrObject at the specified position in the two-dimensional Array. The indexes are specified as 32-bit
integers.

Syntax
Delphi

function GetValueO(AIndex1: ClrInt32; AIndex2: ClrInt32): _ClrObject;


overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.17.3 TClrArray.GetValueO Method (ClrInt32, ClrInt32, ClrInt32)

Gets the value as ClrObject at the specified position in the three-dimensional Array. The indexes are specified as 32-
bit integers.

Syntax
Delphi

function GetValueO(AIndex1: ClrInt32; AIndex2: ClrInt32; AIndex3:


ClrInt32): _ClrObject; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.17.4 TClrArray.GetValueO Method (ClrInt64)

Gets the value as ClrObject at the specified position in the one-dimensional Array. The index is specified as a 64-bit
integer.

Syntax
Delphi

function GetValueO(AIndex: ClrInt64): _ClrObject; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

1138
.Net Runtime Library for Delphi

7.1.1.8.2.6.3.17.5 TClrArray.GetValueO Method (ClrInt64, ClrInt64)

Gets the value as ClrObject at the specified position in the two-dimensional Array. The indexes are specified as 64-bit
integers.

Syntax
Delphi

function GetValueO(AIndex1: ClrInt64; AIndex2: ClrInt64): _ClrObject;


overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.17.6 TClrArray.GetValueO Method (ClrInt64, ClrInt64, ClrInt64)

Gets the value as ClrObject at the specified position in the three-dimensional Array. The indexes are specified as 64-
bit integers.

Syntax
Delphi

function GetValueO(AIndex1: ClrInt64; AIndex2: ClrInt64; AIndex3:


ClrInt64): _ClrObject; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.17.7 TClrArray.GetValueO Method (TClrInt32DynArray)

Gets the value as ClrObject at the specified position in the multidimensional Array. The indexes are specified as a
dynamic array of 32-bit integers.

Syntax
Delphi

function GetValueO(AIndices: TClrInt32DynArray): _ClrObject; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

1139
.Net Runtime Library for Delphi

7.1.1.8.2.6.3.17.8 TClrArray.GetValueO Method (TClrInt64DynArray)

Gets the value as ClrObject at the specified position in the multidimensional Array. The indexes are specified as a
dynamic array of 64-bit integers.

Syntax
Delphi

function GetValueO(AIndices: TClrInt64DynArray): _ClrObject; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.17.9 TClrArray.GetValueO Method (_Int32Array)

Gets the value as ClrObject at the specified position in the multidimensional Array. The indexes are specified as an
array of 32-bit integers.

Syntax
Delphi

function GetValueO(AIndices: _Int32Array): _ClrObject; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.17.10 TClrArray.GetValueO Method (_Int64Array)

Gets the value as ClrObject at the specified position in the multidimensional Array. The indexes are specified as an
array of 64-bit integers.

Syntax
Delphi

function GetValueO(AIndices: _Int64Array): _ClrObject; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.18 IndexOf Method

This is the overview for the IndexOf method overload.

Overload List

1140
.Net Runtime Library for Delphi

Name Description

TClrArray.IndexOf Searches for the specified variant and returns the index of its first
(ClrVariant) occurrence in a one-dimensional array.

TClrArray.IndexOf Searches for the specified variant in a range of elements of a one-


(ClrVariant, ClrInt32) dimensional array, and returns the index of its first occurrence. The
range extends from a specified index to the end of the array.

TClrArray.IndexOf Searches for the specified variant in a range of elements of a one-


(ClrVariant, ClrInt32, dimensional array, and returns the index of ifs first occurrence. The
range extends from a specified index for a specified number of
ClrInt32)
elements.

TClrArray.IndexOf Searches for the specified object and returns the index of its first
(_ClrObject) occurrence in a one-dimensional array.

TClrArray.IndexOf Searches for the specified object in a range of elements of a one-


(_ClrObject, ClrInt32) dimensional array, and returns the index of its first occurrence. The
range extends from a specified index to the end of the array.

TClrArray.IndexOf Searches for the specified object in a range of elements of a one-


(_ClrObject, ClrInt32, dimensional array, and returns the index of ifs first occurrence. The
range extends from a specified index for a specified number of
ClrInt32)
elements.

7.1.1.8.2.6.3.18.1 TClrArray.IndexOf Method (ClrVariant)

Searches for the specified variant and returns the index of its first occurrence in a one-dimensional array.

Syntax
Delphi

function IndexOf(AValue: ClrVariant): ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.18.2 TClrArray.IndexOf Method (ClrVariant, ClrInt32)

Searches for the specified variant in a range of elements of a one-dimensional array, and returns the index of its first
occurrence. The range extends from a specified index to the end of the array.

Syntax
Delphi

1141
.Net Runtime Library for Delphi

function IndexOf(AValue: ClrVariant; AStartIndex: ClrInt32): ClrInt32;


overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.18.3 TClrArray.IndexOf Method (ClrVariant, ClrInt32, ClrInt32)

Searches for the specified variant in a range of elements of a one-dimensional array, and returns the index of ifs first
occurrence. The range extends from a specified index for a specified number of elements.

Syntax
Delphi

function IndexOf(AValue: ClrVariant; AStartIndex: ClrInt32; ACount:


ClrInt32): ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.18.4 TClrArray.IndexOf Method (_ClrObject)

Searches for the specified object and returns the index of its first occurrence in a one-dimensional array.

Syntax
Delphi

function IndexOf(AValue: _ClrObject): ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.18.5 TClrArray.IndexOf Method (_ClrObject, ClrInt32)

Searches for the specified object in a range of elements of a one-dimensional array, and returns the index of its first
occurrence. The range extends from a specified index to the end of the array.

Syntax
Delphi

function IndexOf(AValue: _ClrObject; AStartIndex: ClrInt32): ClrInt32;


overload;

See Also

1142
.Net Runtime Library for Delphi

TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.18.6 TClrArray.IndexOf Method (_ClrObject, ClrInt32, ClrInt32)

Searches for the specified object in a range of elements of a one-dimensional array, and returns the index of ifs first
occurrence. The range extends from a specified index for a specified number of elements.

Syntax
Delphi

function IndexOf(AValue: _ClrObject; AStartIndex: ClrInt32; ACount:


ClrInt32): ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.19 LastIndexOf Method

This is the overview for the LastIndexOf method overload.

Overload List

Name Description

TClrArray.LastIndexOf Searches for the specified variant and returns the index of the last
(ClrVariant) occurrence within the entire one-dimensional Array.

TClrArray.LastIndexOf Searches for the specified variant and returns the index of the last
(ClrVariant, ClrInt32) occurrence within the range of elements in the one-dimensional Array
that extends from the first element to the specified index.

TClrArray.LastIndexOf Searches for the specified variant and returns the index of the last
(ClrVariant, ClrInt32, occurrence within the range of elements in the one-dimensional Array
that contains the specified number of elements and ends at the
ClrInt32)
specified index.

TClrArray.LastIndexOf Searches for the specified object and returns the index of the last
(_ClrObject) occurrence within the entire one-dimensional Array.

TClrArray.LastIndexOf Searches for the specified object and returns the index of the last
(_ClrObject, ClrInt32) occurrence within the range of elements in the one-dimensional Array
that extends from the first element to the specified index.

TClrArray.LastIndexOf Searches for the specified object and returns the index of the last
(_ClrObject, ClrInt32, occurrence within the range of elements in the one-dimensional Array
that contains the specified number of elements and ends at the
ClrInt32)

1143
.Net Runtime Library for Delphi

Name Description

specified index.

7.1.1.8.2.6.3.19.1 TClrArray.LastIndexOf Method (ClrVariant)

Searches for the specified variant and returns the index of the last occurrence within the entire one-dimensional Array.

Syntax
Delphi

function LastIndexOf(AValue: ClrVariant): ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.19.2 TClrArray.LastIndexOf Method (ClrVariant, ClrInt32)

Searches for the specified variant and returns the index of the last occurrence within the range of elements in the one-
dimensional Array that extends from the first element to the specified index.

Syntax
Delphi

function LastIndexOf(AValue: ClrVariant; AStartIndex: ClrInt32):


ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.19.3 TClrArray.LastIndexOf Method (ClrVariant, ClrInt32, ClrInt32)

Searches for the specified variant and returns the index of the last occurrence within the range of elements in the one-
dimensional Array that contains the specified number of elements and ends at the specified index.

Syntax
Delphi

function LastIndexOf(AValue: ClrVariant; AStartIndex: ClrInt32;


ACount: ClrInt32): ClrInt32; overload;

See Also

1144
.Net Runtime Library for Delphi

TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.19.4 TClrArray.LastIndexOf Method (_ClrObject)

Searches for the specified object and returns the index of the last occurrence within the entire one-dimensional Array.

Syntax
Delphi

function LastIndexOf(AValue: _ClrObject): ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.19.5 TClrArray.LastIndexOf Method (_ClrObject, ClrInt32)

Searches for the specified object and returns the index of the last occurrence within the range of elements in the one-
dimensional Array that extends from the first element to the specified index.

Syntax
Delphi

function LastIndexOf(AValue: _ClrObject; AStartIndex: ClrInt32):


ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.19.6 TClrArray.LastIndexOf Method (_ClrObject, ClrInt32, ClrInt32)

Searches for the specified object and returns the index of the last occurrence within the range of elements in the one-
dimensional Array that contains the specified number of elements and ends at the specified index.

Syntax
Delphi

function LastIndexOf(AValue: _ClrObject; AStartIndex: ClrInt32;


ACount: ClrInt32): ClrInt32; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

1145
.Net Runtime Library for Delphi

7.1.1.8.2.6.3.20 Reverse Method

This is the overview for the Reverse method overload.

Overload List

Name Description

TClrArray.Reverse () Reverses the sequence of the elements in the entire one-dimensional


Array.

TClrArray.Reverse (ClrInt32, This is Reverse, a member of class TClrArray.


ClrInt32)

7.1.1.8.2.6.3.20.1 TClrArray.Reverse Method

Reverses the sequence of the elements in the entire one-dimensional Array.

Syntax
Delphi

procedure Reverse; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.20.2 TClrArray.Reverse Method (ClrInt32, ClrInt32)

Reverses the sequence of the elements in a range of elements in the one-dimensional Array.

Syntax
Delphi

procedure Reverse(AIndex: ClrInt32; ALength: ClrInt32); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.21 TClrArray.SetItem Method


Sets a value to the element at the specified position in the one-dimensional Array. The index is specified as a 32-bit
integer.

Syntax

1146
.Net Runtime Library for Delphi

Delphi

procedure SetItem(AIndex: ClrInt32; AValue: ClrVariant);

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.22 TClrArray.SetItemO Method


Sets a clrobject value to the element at the specified position in the one-dimensional Array. The index is specified as a
32-bit integer.

Syntax
Delphi

procedure SetItemO(AIndex: ClrInt32; AValue: _ClrObject);

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23 SetValue Method

This is the overview for the SetValue method overload.

Overload List

Name Description

TClrArray.SetValue Sets a value to the element at the specified position in the one-
(ClrVariant, ClrInt32) dimensional Array. The index is specified as a 32-bit integer.

TClrArray.SetValue Sets a value to the element at the specified position in the two-
(ClrVariant, ClrInt32, dimensional Array. The indexes are specified as 32-bit integers.

ClrInt32)

TClrArray.SetValue Sets a value to the element at the specified position in the three-
(ClrVariant, ClrInt32, dimensional Array. The indexes are specified as 32-bit integers.

ClrInt32, ClrInt32)

TClrArray.SetValue Sets a value to the element at the specified position in the one-
(ClrVariant, ClrInt64) dimensional Array. The index is specified as a 64-bit integer.

TClrArray.SetValue Sets a value to the element at the specified position in the two-
(ClrVariant, ClrInt64, dimensional Array. The indexes are specified as 64-bit integers.

1147
.Net Runtime Library for Delphi

Name Description

ClrInt64)

TClrArray.SetValue Sets a value to the element at the specified position in the three-
(ClrVariant, ClrInt64, dimensional Array. The indexes are specified as 64-bit integers.

ClrInt64, ClrInt64)

TClrArray.SetValue Sets a value to the element at the specified position in the


(ClrVariant, _Int32Array) multidimensional Array. The indexes are specified as an array of 32-bit
integers.

TClrArray.SetValue Sets a value to the element at the specified position in the


(ClrVariant, _Int64Array) multidimensional Array. The indexes are specified as an array of 64-bit
integers.

TClrArray.SetValue Sets a clrobject value to the element at the specified position in the
(_ClrObject, ClrInt32) one-dimensional Array. The index is specified as a 32-bit integer.

TClrArray.SetValue Sets a clrobject value to the element at the specified position in the
(_ClrObject, ClrInt32, two-dimensional Array. The indexes are specified as 32-bit integers.

ClrInt32)

TClrArray.SetValue Sets a clrobject value to the element at the specified position in the
(_ClrObject, ClrInt32, three-dimensional Array. The indexes are specified as 32-bit integers.

ClrInt32, ClrInt32)

TClrArray.SetValue Sets a clrobject value to the element at the specified position in the
(_ClrObject, ClrInt64) one-dimensional Array. The index is specified as a 64-bit integer.

TClrArray.SetValue Sets a clrobject value to the element at the specified position in the
(_ClrObject, ClrInt64, two-dimensional Array. The indexes are specified as 64-bit integers.

ClrInt64)

TClrArray.SetValue Sets a clrobject value to the element at the specified position in the
(_ClrObject, ClrInt64, three-dimensional Array. The indexes are specified as 64-bit integers.

ClrInt64, ClrInt64)

TClrArray.SetValue Sets a clrobject value to the element at the specified position in the
(_ClrObject, _Int32Array) multidimensional Array. The indexes are specified as an array of 32-bit
integers.

TClrArray.SetValue Sets a clrobject value to the element at the specified position in the
(_ClrObject, _Int64Array) multidimensional Array. The indexes are specified as an array of 64-bit
integers.

1148
.Net Runtime Library for Delphi

7.1.1.8.2.6.3.23.1 TClrArray.SetValue Method (ClrVariant, ClrInt32)

Sets a value to the element at the specified position in the one-dimensional Array. The index is specified as a 32-bit
integer.

Syntax
Delphi

procedure SetValue(AValue: ClrVariant; AIndex: ClrInt32); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.2 TClrArray.SetValue Method (ClrVariant, ClrInt32, ClrInt32)

Sets a value to the element at the specified position in the two-dimensional Array. The indexes are specified as 32-bit
integers.

Syntax
Delphi

procedure SetValue(AValue: ClrVariant; AIndex1: ClrInt32; AIndex2:


ClrInt32); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.3 TClrArray.SetValue Method (ClrVariant, ClrInt32, ClrInt32, ClrInt32)

Sets a value to the element at the specified position in the three-dimensional Array. The indexes are specified as 32-bit
integers.

Syntax
Delphi

procedure SetValue(AValue: ClrVariant; AIndex1: ClrInt32; AIndex2:


ClrInt32; AIndex3: ClrInt32); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.4 TClrArray.SetValue Method (ClrVariant, ClrInt64)

Sets a value to the element at the specified position in the one-dimensional Array. The index is specified as a 64-bit
integer.

1149
.Net Runtime Library for Delphi

Syntax
Delphi

procedure SetValue(AValue: ClrVariant; AIndex: ClrInt64); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.5 TClrArray.SetValue Method (ClrVariant, ClrInt64, ClrInt64)

Sets a value to the element at the specified position in the two-dimensional Array. The indexes are specified as 64-bit
integers.

Syntax
Delphi

procedure SetValue(AValue: ClrVariant; AIndex1: ClrInt64; AIndex2:


ClrInt64); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.6 TClrArray.SetValue Method (ClrVariant, ClrInt64, ClrInt64, ClrInt64)

Sets a value to the element at the specified position in the three-dimensional Array. The indexes are specified as 64-bit
integers.

Syntax
Delphi

procedure SetValue(AValue: ClrVariant; AIndex1: ClrInt64; AIndex2:


ClrInt64; AIndex3: ClrInt64); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.7 TClrArray.SetValue Method (ClrVariant, _Int32Array)

Sets a value to the element at the specified position in the multidimensional Array. The indexes are specified as an array
of 32-bit integers.

Syntax
Delphi

1150
.Net Runtime Library for Delphi

procedure SetValue(AValue: ClrVariant; AIndices: _Int32Array);


overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.8 TClrArray.SetValue Method (ClrVariant, _Int64Array)

Sets a value to the element at the specified position in the multidimensional Array. The indexes are specified as an array
of 64-bit integers.

Syntax
Delphi

procedure SetValue(AValue: ClrVariant; AIndices: _Int64Array);


overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.9 TClrArray.SetValue Method (_ClrObject, ClrInt32)

Sets a clrobject value to the element at the specified position in the one-dimensional Array. The index is specified as a
32-bit integer.

Syntax
Delphi

procedure SetValue(AValue: _ClrObject; AIndex: ClrInt32); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.10 TClrArray.SetValue Method (_ClrObject, ClrInt32, ClrInt32)

Sets a clrobject value to the element at the specified position in the two-dimensional Array. The indexes are specified as
32-bit integers.

Syntax
Delphi

procedure SetValue(AValue: _ClrObject; AIndex1: ClrInt32; AIndex2:


ClrInt32); overload;

1151
.Net Runtime Library for Delphi

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.11 TClrArray.SetValue Method (_ClrObject, ClrInt32, ClrInt32, ClrInt32)

Sets a clrobject value to the element at the specified position in the three-dimensional Array. The indexes are specified
as 32-bit integers.

Syntax
Delphi

procedure SetValue(AValue: _ClrObject; AIndex1: ClrInt32; AIndex2:


ClrInt32; AIndex3: ClrInt32); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.12 TClrArray.SetValue Method (_ClrObject, ClrInt64)

Sets a clrobject value to the element at the specified position in the one-dimensional Array. The index is specified as a
64-bit integer.

Syntax
Delphi

procedure SetValue(AValue: _ClrObject; AIndex: ClrInt64); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.13 TClrArray.SetValue Method (_ClrObject, ClrInt64, ClrInt64)

Sets a clrobject value to the element at the specified position in the two-dimensional Array. The indexes are specified as
64-bit integers.

Syntax
Delphi

procedure SetValue(AValue: _ClrObject; AIndex1: ClrInt64; AIndex2:


ClrInt64); overload;

See Also

1152
.Net Runtime Library for Delphi

TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.14 TClrArray.SetValue Method (_ClrObject, ClrInt64, ClrInt64, ClrInt64)

Sets a clrobject value to the element at the specified position in the three-dimensional Array. The indexes are specified
as 64-bit integers.

Syntax
Delphi

procedure SetValue(AValue: _ClrObject; AIndex1: ClrInt64; AIndex2:


ClrInt64; AIndex3: ClrInt64); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.15 TClrArray.SetValue Method (_ClrObject, _Int32Array)

Sets a clrobject value to the element at the specified position in the multidimensional Array. The indexes are specified as
an array of 32-bit integers.

Syntax
Delphi

procedure SetValue(AValue: _ClrObject; AIndices: _Int32Array);


overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.23.16 TClrArray.SetValue Method (_ClrObject, _Int64Array)

Sets a clrobject value to the element at the specified position in the multidimensional Array. The indexes are specified as
an array of 64-bit integers.

Syntax
Delphi

procedure SetValue(AValue: _ClrObject; AIndices: _Int64Array);


overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

1153
.Net Runtime Library for Delphi

7.1.1.8.2.6.3.24 Sort Method

This is the overview for the Sort method overload.

Overload List

Name Description

TClrArray.Sort Sorts the elements in an entire one-dimensional Array.

TClrArray.Sort (ClrInt32, Sorts the elements in a range of elements in a one-dimensional Array.


ClrInt32)

TClrArray.Sort (ClrInt32, Sorts the elements in a range of elements in a one-dimensional Array


ClrInt32, IComparer) using the specified IComparer.

TClrArray.Sort (IComparer) Sorts the elements in a one-dimensional Array using the specified
IComparer.

TClrArray.Sort (TClrArray, Sorts a pair of one-dimensional Array objects (one contains the keys
TClrArray) and the other contains the corresponding items) based on the keys in
the first Array using the IComparable implementation of each key.

TClrArray.Sort (TClrArray, Sorts the elements in a range of elements in a one-dimensional Array


TClrArray, ClrInt32, ClrInt32, using the specified IComparer.

IComparer)

TClrArray.Sort (TClrArray, Sorts a pair of one-dimensional Array objects (one contains the keys
TClrArray, IComparer) and the other contains the corresponding items) based on the keys in
the first Array using the specified IComparer.

7.1.1.8.2.6.3.24.1 TClrArray.Sort Method

Sorts the elements in an entire one-dimensional Array.

Syntax
Delphi

procedure Sort; overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

1154
.Net Runtime Library for Delphi

7.1.1.8.2.6.3.24.2 TClrArray.Sort Method (ClrInt32, ClrInt32)

Sorts the elements in a range of elements in a one-dimensional Array.

Syntax
Delphi

procedure Sort(AIndex: ClrInt32; ALength: ClrInt32); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.24.3 TClrArray.Sort Method (ClrInt32, ClrInt32, IComparer)

Sorts the elements in a range of elements in a one-dimensional Array using the specified IComparer.

Syntax
Delphi

procedure Sort(AIndex: ClrInt32; ALength: ClrInt32; AComparer:


IComparer); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.24.4 TClrArray.Sort Method (IComparer)

Sorts the elements in a one-dimensional Array using the specified IComparer.

Syntax
Delphi

procedure Sort(AComparer: IComparer); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.24.5 TClrArray.Sort Method (TClrArray, TClrArray)

Sorts a pair of one-dimensional Array objects (one contains the keys and the other contains the corresponding items)
based on the keys in the first Array using the IComparable implementation of each key.

Syntax

1155
.Net Runtime Library for Delphi

Delphi

procedure Sort(AKeys: TClrArray; AItems: TClrArray); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.24.6 TClrArray.Sort Method (TClrArray, TClrArray, ClrInt32, ClrInt32, IComparer)

Sorts the elements in a range of elements in a one-dimensional Array using the specified IComparer.

Syntax
Delphi

procedure Sort(AKeys: TClrArray; AItems: TClrArray; Index: ClrInt32;


Length: ClrInt32; AComparer: IComparer); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.24.7 TClrArray.Sort Method (TClrArray, TClrArray, IComparer)

Sorts a pair of one-dimensional Array objects (one contains the keys and the other contains the corresponding items)
based on the keys in the first Array using the specified IComparer.

Syntax
Delphi

procedure Sort(AKeys: TClrArray; AItems: TClrArray; AComparer:


IComparer); overload;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.3.25 TClrArray.Unwrap Method


Returns the .net System.Array object.

Syntax
Delphi

function Unwrap: ClrVariant;

See Also

1156
.Net Runtime Library for Delphi

TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.4 TClrArray Properties


The properties of the TClrArray class are listed here.

Properties

Name Description

DefaultInterface This is DefaultInterface, a member of class TClrArray.

IsFixedSize This is IsFixedSize, a member of class TClrArray.

IsReadOnly This is IsReadOnly, a member of class TClrArray.

IsSynchronized This is IsSynchronized, a member of class TClrArray.

Item This is Item, a member of class TClrArray.

ItemO This is ItemO, a member of class TClrArray.

Length This is Length, a member of class TClrArray.

LongLength This is LongLength, a member of class TClrArray.

Rank This is Rank, a member of class TClrArray.

SyncRoot This is SyncRoot, a member of class TClrArray.

SyncRootO This is SyncRootO, a member of class TClrArray.

7.1.1.8.2.6.4.1 TClrArray.DefaultInterface Property

This is DefaultInterface, a member of class TClrArray.

Syntax
Delphi

property DefaultInterface: _Array;

See Also

1157
.Net Runtime Library for Delphi

TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.4.2 TClrArray.IsFixedSize Property

This is IsFixedSize, a member of class TClrArray.

Syntax
Delphi

property IsFixedSize: ClrBoolean;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.4.3 TClrArray.IsReadOnly Property

This is IsReadOnly, a member of class TClrArray.

Syntax
Delphi

property IsReadOnly: ClrBoolean;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.4.4 TClrArray.IsSynchronized Property

This is IsSynchronized, a member of class TClrArray.

Syntax
Delphi

property IsSynchronized: ClrBoolean;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.4.5 TClrArray.Item Property

This is Item, a member of class TClrArray.

1158
.Net Runtime Library for Delphi

Syntax
Delphi

property Item [index: ClrInt32]: ClrVariant;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.4.6 TClrArray.ItemO Property

This is ItemO, a member of class TClrArray.

Syntax
Delphi

property ItemO [index: ClrInt32]: _ClrObject;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.4.7 TClrArray.Length Property

This is Length, a member of class TClrArray.

Syntax
Delphi

property Length: ClrInt32;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.4.8 TClrArray.LongLength Property

This is LongLength, a member of class TClrArray.

Syntax
Delphi

property LongLength: ClrInt64;

1159
.Net Runtime Library for Delphi

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.4.9 TClrArray.Rank Property

This is Rank, a member of class TClrArray.

Syntax
Delphi

property Rank: ClrInt32;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.4.10 TClrArray.SyncRoot Property

This is SyncRoot, a member of class TClrArray.

Syntax
Delphi

property SyncRoot: ClrVariant;

See Also
TClrArray Class
CNClrLib.Host Namespace

7.1.1.8.2.6.4.11 TClrArray.SyncRootO Property

This is SyncRootO, a member of class TClrArray.

Syntax
Delphi

property SyncRootO: _ClrObject;

See Also
TClrArray Class
CNClrLib.Host Namespace

1160
.Net Runtime Library for Delphi

7.1.1.8.2.7 TClrArrayHelper Class


Collapse All Expand All

Helper class for the TClrArray class. This class cannot be inherited.

Inheritance Hierarchy
CNClrLib.Host.TClrArrayHelper

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrArrayHelper = class(TClrBase);

Methods

Name Description

CreateInstance(ClrWString, ClrInt32) Creates a one-dimensional Array of the Type from the


specified Type Name and length, with zero-based indexing.

CreateInstance(TTypeCode, ClrInt32) Creates a one-dimensional Array of the Type from the


specified TypeCode and length, with zero-based indexing.

CreateInstance(_Type, ClrInt32) Creates a one-dimensional Array of the specified Type and


length, with zero-based indexing.

CreateInstance(_Type, ClrInt32, ClrInt32) Creates a two-dimensional Array of the specified Type and
dimension lengths, with zero-based indexing.

CreateInstance(_Type, ClrInt32, ClrInt32, Creates a three-dimensional Array of the specified Type and
ClrInt32) dimension lengths, with zero-based indexing.

CreateInstance(_Type, TClrInt32DynArray) Creates a multidimensional Array of the specified Typeand


dimension lengths, with zero-based indexing. The
dimension lengths are specified in an array of 32-bit
integers.

CreateInstance(_Type, TClrInt32DynArray, Creates a multidimensional Array of the specified Typeand


TClrInt32DynArray) dimension lengths, with the specified lower bounds.

CreateInstance(_Type, _Int32Array) Creates a multidimensional Array of the specified Typeand


dimension lengths, with zero-based indexing. The
dimension lengths are specified in an array of 32-bit

1161
.Net Runtime Library for Delphi

Name Description

integers.

CreateInstance(_Type, _Int32Array, Creates a multidimensional Array of the specified Typeand


_Int32Array) dimension lengths, with the specified lower bounds.

ToAnsiCharDynArray Converts a .net one-dimensional array of unicode


characters to a delphi dynamic array of ansi
characters.

ToBooleanArray Converts a delphi dynamic array of Boolean to a


.net one-dimensional array of boolean.

ToBooleanDynArray Converts a .net one-dimensional array of Boolean


to a delphi dynamic array of Boolean.

ToByteArray(ClrWString) Converts a specified string to a .net one-


dimensional array of Bytes.

ToByteArray(TClrByteDynArray) Converts a delphi dynamic array of Bytes to a .net


one-dimensional array of Bytes.

ToByteArray(TStream) Converts a specified TStream value to a .net one-


dimensional array of Bytes.

ToByteDynArray(TStream) Converts a specified TStream value to a delphi


dynamic array of Bytes.

ToByteDynArray(_ByteArray) Converts a .net one-dimensional array of Bytes to a


delphi dynamic array of Bytes.

ToCharArray(ClrString) Converts a specified string to a .net one-


dimensional array of Unicode Characters.

ToCharArray(TClrCharDynArray) Converts a dynamic array of Unicode Characters to


a .net one-dimensional array of Unicode Characters.

ToCharArray(TClrWCharDynArray) Converts a dynamic array of Unicode Characters to


a .net one-dimensional array of Unicode Characters.

ToCharDynArray Converts a .net one-dimensional array of Unicode


Characters to a delphi dynamic array of Unicode
Characters.

1162
.Net Runtime Library for Delphi

Name Description

ToDateTimeArray Converts a delphi dynamic array of TDateTime to a


.net one-dimensional array of DateTime.

ToDateTimeDynArray Converts a .net one-dimensional array of DateTime


to a delphi dynamic array of TDateTime.

ToDecimalArray(TClrDecimalDynArray) Converts a delphi dynamic array of Decimal to a


.net one-dimensional array of Decimal.

ToDecimalArray(TClrExtendedDynArray) Converts a delphi dynamic array of Double to a .net


one-dimensional array of Decimal.

ToDecimalDynArray Converts a .net one-dimensional array of Decimal to


a delphi dynamic array of Decimal.

ToDoubleArray Converts a delphi dynamic array of Double to a .net


one-dimensional array of Double.

ToDoubleDynArray Converts a .net one-dimensional array of Double to


a delphi dynamic array of Double.

ToExceptionArray(TClrExceptionDynArray) Converts a delphi dynamic array of Exception to a


.net one-dimensional array of Exception.

ToExceptionArray(TExceptionDynArray) Converts a delphi dynamic array of


SysUtils.Exception to a .net one-dimensional array
of System.Exception.

ToExceptionDynArray Converts a .net one-dimensional array of


System.Exception to a delphi dynamic array of
SysUtils.Exception.

ToInt16Array Converts a delphi dynamic array of smallInt to a


.net one-dimensional array of Int16.

ToInt16DynArray Converts a .net one-dimensional array of Int16 to a


delphi dynamic array of SmallInt.

ToInt32Array Converts a delphi dynamic array of Integer to a .net


one-dimensional array of Int32.

ToInt32DynArray Converts a .net one-dimensional array of Int32 to a


delphi dynamic array of Integer.

1163
.Net Runtime Library for Delphi

Name Description

ToInt64Array Converts a delphi dynamic array of Int64 to a .net


one-dimensional array of Int64.

ToInt64DynArray Converts a .net one-dimensional array of Int64 to a


delphi dynamic array of Int64.

ToObjectArray(TClrObjectDynArray) Converts a dynamic array of Object to a .net one-


dimensional array of Object.

ToObjectArray(TClrVariantDynArray) Converts a delphi dynamic array of variants to a


.net one-dimensional array of Object.

ToObjectArray(TTClrObjectDynArray) Converts a delphi dynamic array of TClrBaseObject


to a .net one-dimensional array of Object.

ToObjectArray(array of const) Converts a delphi dynamic array of TVarRec to a


.net one-dimensional array of Object.

ToSByteArray Converts a delphi dynamic array of ShortInt to a


.net one-dimensional array of SByte.

ToSByteDynArray Converts a .net one-dimensional array of SByte to a


delphi dynamic array of ShortInt.

ToSingleArray Converts a delphi dynamic array of Single to a .net


one-dimensional array of Single.

ToSingleDynArray Converts a .net one-dimensional array of Single to a


delphi dynamic array of Single.

ToStringArray(TClrVariantDynArray) Converts a delphi dynamic array of variants to a


.net one-dimensional array of String.

ToStringArray(TClrWStringDynArray) Converts a delphi dynamic array of WideString to a


.net one-dimensional array of String.

ToStringArray(TStrings) Converts a delphi TStrings value to a .net one-


dimensional array of String.

ToStringDynArray Converts a .net one-dimensional array of string to a


delphi dynamic array of string.

ToTypeArray(TClrStringDynArray) Converts a delphi dynamic array of strings as type

1164
.Net Runtime Library for Delphi

Name Description

names to a .net one-dimensional array of Type.

ToTypeArray(TClrTypeDynArray) Converts a delphi dynamic array of Type to a .net


one-dimensional array of Type .

ToUInt16Array Converts a delphi dynamic array of Word to a .net


one-dimensional array of UInt16.

ToUInt16DynArray Converts a .net one-dimensional array of UInt16 to


a delphi dynamic array of Word.

ToUInt32Array Converts a delphi dynamic array of LongWord to a


.net one-dimensional array of UInt32.

ToUInt32DynArray Converts a .net one-dimensional array of UInt32 to


a delphi dynamic array of LongWord.

ToUInt64Array Converts a delphi dynamic array of LargeUInt to a


.net one-dimensional array of UInt64.

ToUInt64DynArray Converts a .net one-dimensional array of UInt64 to


a delphi dynamic array of LargeUInt.

ToVariantDynArray Converts a .net one-dimensional array of Object to


a delphi dynamic array of variants.

ToWideStringDynArray Converts a .net one-dimensional array of string to a


delphi dynamic array of WideString/UnicodeString.

See Also
TClrArrayHelper Methods

7.1.1.8.2.7.1 TClrArrayHelper Methods


Collapse All Expand All

Helper class for the TClrArray class. This class cannot be inherited.

Inheritance Hierarchy
CNClrLib.Host.TClrArrayHelper

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

1165
.Net Runtime Library for Delphi

Syntax
Delphi

TClrArrayHelper = class(TClrBase);

Methods

Name Description

CreateInstance(ClrWString, ClrInt32) Creates a one-dimensional Array of the Type from the


specified Type Name and length, with zero-based indexing.

CreateInstance(TTypeCode, ClrInt32) Creates a one-dimensional Array of the Type from the


specified TypeCode and length, with zero-based indexing.

CreateInstance(_Type, ClrInt32) Creates a one-dimensional Array of the specified Type and


length, with zero-based indexing.

CreateInstance(_Type, ClrInt32, ClrInt32) Creates a two-dimensional Array of the specified Type and
dimension lengths, with zero-based indexing.

CreateInstance(_Type, ClrInt32, ClrInt32, Creates a three-dimensional Array of the specified Type and
ClrInt32) dimension lengths, with zero-based indexing.

CreateInstance(_Type, TClrInt32DynArray) Creates a multidimensional Array of the specified Typeand


dimension lengths, with zero-based indexing. The
dimension lengths are specified in an array of 32-bit
integers.

CreateInstance(_Type, TClrInt32DynArray, Creates a multidimensional Array of the specified Typeand


TClrInt32DynArray) dimension lengths, with the specified lower bounds.

CreateInstance(_Type, _Int32Array) Creates a multidimensional Array of the specified Typeand


dimension lengths, with zero-based indexing. The
dimension lengths are specified in an array of 32-bit
integers.

CreateInstance(_Type, _Int32Array, Creates a multidimensional Array of the specified Typeand


_Int32Array) dimension lengths, with the specified lower bounds.

ToAnsiCharDynArray Converts a .net one-dimensional array of unicode


characters to a delphi dynamic array of ansi
characters.

ToBooleanArray Converts a delphi dynamic array of Boolean to a


.net one-dimensional array of boolean.

1166
.Net Runtime Library for Delphi

Name Description

ToBooleanDynArray Converts a .net one-dimensional array of Boolean


to a delphi dynamic array of Boolean.

ToByteArray(ClrWString) Converts a specified string to a .net one-


dimensional array of Bytes.

ToByteArray(TClrByteDynArray) Converts a delphi dynamic array of Bytes to a .net


one-dimensional array of Bytes.

ToByteArray(TStream) Converts a specified TStream value to a .net one-


dimensional array of Bytes.

ToByteDynArray(TStream) Converts a specified TStream value to a delphi


dynamic array of Bytes.

ToByteDynArray(_ByteArray) Converts a .net one-dimensional array of Bytes to a


delphi dynamic array of Bytes.

ToCharArray(ClrString) Converts a specified string to a .net one-


dimensional array of Unicode Characters.

ToCharArray(TClrCharDynArray) Converts a dynamic array of Unicode Characters to


a .net one-dimensional array of Unicode Characters.

ToCharArray(TClrWCharDynArray) Converts a dynamic array of Unicode Characters to


a .net one-dimensional array of Unicode Characters.

ToCharDynArray Converts a .net one-dimensional array of Unicode


Characters to a delphi dynamic array of Unicode
Characters.

ToDateTimeArray Converts a delphi dynamic array of TDateTime to a


.net one-dimensional array of DateTime.

ToDateTimeDynArray Converts a .net one-dimensional array of DateTime


to a delphi dynamic array of TDateTime.

ToDecimalArray(TClrDecimalDynArray) Converts a delphi dynamic array of Decimal to a


.net one-dimensional array of Decimal.

ToDecimalArray(TClrExtendedDynArray) Converts a delphi dynamic array of Double to a .net


one-dimensional array of Decimal.

1167
.Net Runtime Library for Delphi

Name Description

ToDecimalDynArray Converts a .net one-dimensional array of Decimal to


a delphi dynamic array of Decimal.

ToDoubleArray Converts a delphi dynamic array of Double to a .net


one-dimensional array of Double.

ToDoubleDynArray Converts a .net one-dimensional array of Double to


a delphi dynamic array of Double.

ToExceptionArray(TClrExceptionDynArray) Converts a delphi dynamic array of Exception to a


.net one-dimensional array of Exception.

ToExceptionArray(TExceptionDynArray) Converts a delphi dynamic array of


SysUtils.Exception to a .net one-dimensional array
of System.Exception.

ToExceptionDynArray Converts a .net one-dimensional array of


System.Exception to a delphi dynamic array of
SysUtils.Exception.

ToInt16Array Converts a delphi dynamic array of smallInt to a


.net one-dimensional array of Int16.

ToInt16DynArray Converts a .net one-dimensional array of Int16 to a


delphi dynamic array of SmallInt.

ToInt32Array Converts a delphi dynamic array of Integer to a .net


one-dimensional array of Int32.

ToInt32DynArray Converts a .net one-dimensional array of Int32 to a


delphi dynamic array of Integer.

ToInt64Array Converts a delphi dynamic array of Int64 to a .net


one-dimensional array of Int64.

ToInt64DynArray Converts a .net one-dimensional array of Int64 to a


delphi dynamic array of Int64.

ToObjectArray(TClrObjectDynArray) Converts a dynamic array of Object to a .net one-


dimensional array of Object.

ToObjectArray(TClrVariantDynArray) Converts a delphi dynamic array of variants to a


.net one-dimensional array of Object.

1168
.Net Runtime Library for Delphi

Name Description

ToObjectArray(TTClrObjectDynArray) Converts a delphi dynamic array of TClrBaseObject


to a .net one-dimensional array of Object.

ToObjectArray(array of const) Converts a delphi dynamic array of TVarRec to a


.net one-dimensional array of Object.

ToSByteArray Converts a delphi dynamic array of ShortInt to a


.net one-dimensional array of SByte.

ToSByteDynArray Converts a .net one-dimensional array of SByte to a


delphi dynamic array of ShortInt.

ToSingleArray Converts a delphi dynamic array of Single to a .net


one-dimensional array of Single.

ToSingleDynArray Converts a .net one-dimensional array of Single to a


delphi dynamic array of Single.

ToStringArray(TClrVariantDynArray) Converts a delphi dynamic array of variants to a


.net one-dimensional array of String.

ToStringArray(TClrWStringDynArray) Converts a delphi dynamic array of WideString to a


.net one-dimensional array of String.

ToStringArray(TStrings) Converts a delphi TStrings value to a .net one-


dimensional array of String.

ToStringDynArray Converts a .net one-dimensional array of string to a


delphi dynamic array of string.

ToTypeArray(TClrStringDynArray) Converts a delphi dynamic array of strings as type


names to a .net one-dimensional array of Type.

ToTypeArray(TClrTypeDynArray) Converts a delphi dynamic array of Type to a .net


one-dimensional array of Type .

ToUInt16Array Converts a delphi dynamic array of Word to a .net


one-dimensional array of UInt16.

ToUInt16DynArray Converts a .net one-dimensional array of UInt16 to


a delphi dynamic array of Word.

ToUInt32Array Converts a delphi dynamic array of LongWord to a

1169
.Net Runtime Library for Delphi

Name Description

.net one-dimensional array of UInt32.

ToUInt32DynArray Converts a .net one-dimensional array of UInt32 to


a delphi dynamic array of LongWord.

ToUInt64Array Converts a delphi dynamic array of LargeUInt to a


.net one-dimensional array of UInt64.

ToUInt64DynArray Converts a .net one-dimensional array of UInt64 to


a delphi dynamic array of LargeUInt.

ToVariantDynArray Converts a .net one-dimensional array of Object to


a delphi dynamic array of variants.

ToWideStringDynArray Converts a .net one-dimensional array of string to a


delphi dynamic array of WideString/UnicodeString.

See Also
TClrArrayHelper Methods

7.1.1.8.2.7.1.1 CreateInstance Method

This is the overview for the CreateInstance method overload.

Overload List

Name Description

TClrArrayHelper.CreateInstance Creates a one-dimensional Array of the Type from the specified Type
(ClrWString, ClrInt32) Name and length, with zero-based indexing.

TClrArrayHelper.CreateInstance Creates a one-dimensional Array of the Type from the specified


(TTypeCode, ClrInt32) TypeCode and length, with zero-based indexing.

TClrArrayHelper.CreateInstance Creates a one-dimensional Array of the specified Type and length,


(_Type, ClrInt32) with zero-based indexing.

TClrArrayHelper.CreateInstance Creates a two-dimensional Array of the specified Type and


(_Type, ClrInt32, ClrInt32) dimension lengths, with zero-based indexing.

TClrArrayHelper.CreateInstance Creates a three-dimensional Array of the specified Type and


(_Type, ClrInt32, ClrInt32, dimension lengths, with zero-based indexing.

ClrInt32)

1170
.Net Runtime Library for Delphi

Name Description

TClrArrayHelper.CreateInstance Creates a multidimensional Array of the specified Typeand


(_Type, TClrInt32DynArray) dimension lengths, with zero-based indexing. The dimension lengths
are specified in an array of 32-bit integers.

TClrArrayHelper.CreateInstance Creates a multidimensional Array of the specified Typeand


(_Type, TClrInt32DynArray, dimension lengths, with the specified lower bounds.

TClrInt32DynArray)

TClrArrayHelper.CreateInstance Creates a multidimensional Array of the specified Typeand


(_Type, _Int32Array) dimension lengths, with zero-based indexing. The dimension lengths
are specified in an array of 32-bit integers.

TClrArrayHelper.CreateInstance Creates a multidimensional Array of the specified Typeand


(_Type, _Int32Array, dimension lengths, with the specified lower bounds.

_Int32Array)

7.1.1.8.2.7.1.1.1 TClrArrayHelper.CreateInstance Method (ClrWString, ClrInt32)

Creates a one-dimensional Array of the Type from the specified Type Name and length, with zero-based indexing.

Syntax
Delphi

class function CreateInstance(AElementTypeName: ClrWString; ALength:


ClrInt32): _Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.1.2 TClrArrayHelper.CreateInstance Method (TTypeCode, ClrInt32)

Creates a one-dimensional Array of the Type from the specified TypeCode and length, with zero-based indexing.

Syntax
Delphi

class function CreateInstance(AElementTypeCode: TTypeCode; ALength:


ClrInt32): _Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

1171
.Net Runtime Library for Delphi

7.1.1.8.2.7.1.1.3 TClrArrayHelper.CreateInstance Method (_Type, ClrInt32)

Creates a one-dimensional Array of the specified Type and length, with zero-based indexing.

Syntax
Delphi

class function CreateInstance(AElementType: _Type; ALength: ClrInt32):


_Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.1.4 TClrArrayHelper.CreateInstance Method (_Type, ClrInt32, ClrInt32)

Creates a two-dimensional Array of the specified Type and dimension lengths, with zero-based indexing.

Syntax
Delphi

class function CreateInstance(AElementType: _Type; ALength1: ClrInt32;


ALength2: ClrInt32): _Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.1.5 TClrArrayHelper.CreateInstance Method (_Type, ClrInt32, ClrInt32, ClrInt32)

Creates a three-dimensional Array of the specified Type and dimension lengths, with zero-based indexing.

Syntax
Delphi

class function CreateInstance(AElementType: _Type; ALength1: ClrInt32;


ALength2: ClrInt32; ALength3: ClrInt32): _Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.1.6 TClrArrayHelper.CreateInstance Method (_Type, TClrInt32DynArray)

Creates a multidimensional Array of the specified Typeand dimension lengths, with zero-based indexing. The dimension
lengths are specified in an array of 32-bit integers.

1172
.Net Runtime Library for Delphi

Syntax
Delphi

class function CreateInstance(AElementType: _Type; ALengths:


TClrInt32DynArray): _Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.1.7 TClrArrayHelper.CreateInstance Method (_Type, TClrInt32DynArray,


TClrInt32DynArray)

Creates a multidimensional Array of the specified Typeand dimension lengths, with the specified lower bounds.

Syntax
Delphi

class function CreateInstance(AElementType: _Type; ALengths:


TClrInt32DynArray; ALowerBounds: TClrInt32DynArray): _Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.1.8 TClrArrayHelper.CreateInstance Method (_Type, _Int32Array)

Creates a multidimensional Array of the specified Typeand dimension lengths, with zero-based indexing. The dimension
lengths are specified in an array of 32-bit integers.

Syntax
Delphi

class function CreateInstance(AElementType: _Type; ALengths:


_Int32Array): _Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.1.9 TClrArrayHelper.CreateInstance Method (_Type, _Int32Array, _Int32Array)

Creates a multidimensional Array of the specified Typeand dimension lengths, with the specified lower bounds.

Syntax
Delphi

1173
.Net Runtime Library for Delphi

class function CreateInstance(AElementType: _Type; ALengths:


_Int32Array; ALowerBounds: _Int32Array): _Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.2 TClrArrayHelper.ToAnsiCharDynArray Method


Converts a .net one-dimensional array of unicode characters to a delphi dynamic array of ansi characters.

Syntax
Delphi

class function ToAnsiCharDynArray(const AArray: _CharArray):


TClrACharDynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.3 TClrArrayHelper.ToBooleanArray Method


Converts a delphi dynamic array of Boolean to a .net one-dimensional array of boolean.

Syntax
Delphi

class function ToBooleanArray(const AArray: TClrBooleanDynArray):


_BooleanArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.4 TClrArrayHelper.ToBooleanDynArray Method


Converts a .net one-dimensional array of Boolean to a delphi dynamic array of Boolean.

Syntax
Delphi

class function ToBooleanDynArray(const AArray: _BooleanArray):


TClrBooleanDynArray;

See Also

1174
.Net Runtime Library for Delphi

TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.5 ToByteArray Method

This is the overview for the ToByteArray method overload.

Overload List

Name Description

TClrArrayHelper.ToByteArray Converts a specified string to a .net one-dimensional array of


(ClrWString) Bytes.

TClrArrayHelper.ToByteArray Converts a delphi dynamic array of Bytes to a .net one-


(TClrByteDynArray) dimensional array of Bytes.

TClrArrayHelper.ToByteArray Converts a specified TStream value to a .net one-dimensional


(TStream) array of Bytes.

7.1.1.8.2.7.1.5.1 TClrArrayHelper.ToByteArray Method (ClrWString)

Converts a specified string to a .net one-dimensional array of Bytes.

Syntax
Delphi

class function ToByteArray(const AHex: ClrWString): _ByteArray;


overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.5.2 TClrArrayHelper.ToByteArray Method (TClrByteDynArray)

Converts a delphi dynamic array of Bytes to a .net one-dimensional array of Bytes.

Syntax
Delphi

class function ToByteArray(const AArray: TClrByteDynArray):


_ByteArray; overload;

See Also

1175
.Net Runtime Library for Delphi

TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.5.3 TClrArrayHelper.ToByteArray Method (TStream)

Converts a specified TStream value to a .net one-dimensional array of Bytes.

Syntax
Delphi

class function ToByteArray(const AStream: TStream): _ByteArray;


overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.6 ToByteDynArray Method

This is the overview for the ToByteDynArray method overload.

Overload List

Name Description

TClrArrayHelper.ToByteDynArray Converts a specified TStream value to a delphi dynamic array of


(TStream) Bytes.

TClrArrayHelper.ToByteDynArray Converts a .net one-dimensional array of Bytes to a delphi


(_ByteArray) dynamic array of Bytes.

7.1.1.8.2.7.1.6.1 TClrArrayHelper.ToByteDynArray Method (TStream)

Converts a specified TStream value to a delphi dynamic array of Bytes.

Syntax
Delphi

class function ToByteDynArray(AStream: TStream): TClrByteDynArray;


overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

1176
.Net Runtime Library for Delphi

7.1.1.8.2.7.1.6.2 TClrArrayHelper.ToByteDynArray Method (_ByteArray)

Converts a .net one-dimensional array of Bytes to a delphi dynamic array of Bytes.

Syntax
Delphi

class function ToByteDynArray(const AArray: _ByteArray):


TClrByteDynArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.7 ToCharArray Method

This is the overview for the ToCharArray method overload.

Overload List

Name Description

TClrArrayHelper.ToCharArray Converts a specified string to a .net one-dimensional array of


(ClrString) Unicode Characters.

TClrArrayHelper.ToCharArray Converts a dynamic array of Unicode Characters to a .net one-


(TClrCharDynArray) dimensional array of Unicode Characters.

TClrArrayHelper.ToCharArray Converts a dynamic array of Unicode Characters to a .net one-


(TClrWCharDynArray) dimensional array of Unicode Characters.

7.1.1.8.2.7.1.7.1 TClrArrayHelper.ToCharArray Method (ClrString)

Converts a specified string to a .net one-dimensional array of Unicode Characters.

Syntax
Delphi

class function ToCharArray(const AStringOfChars: ClrString):


_CharArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

1177
.Net Runtime Library for Delphi

7.1.1.8.2.7.1.7.2 TClrArrayHelper.ToCharArray Method (TClrCharDynArray)

Converts a dynamic array of Unicode Characters to a .net one-dimensional array of Unicode Characters.

Syntax
Delphi

class function ToCharArray(const AArray: TClrCharDynArray):


_CharArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.7.3 TClrArrayHelper.ToCharArray Method (TClrWCharDynArray)

Converts a dynamic array of Unicode Characters to a .net one-dimensional array of Unicode Characters.

Syntax
Delphi

class function ToCharArray(const AArray: TClrWCharDynArray):


_CharArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.8 TClrArrayHelper.ToCharDynArray Method


Converts a .net one-dimensional array of Unicode Characters to a delphi dynamic array of Unicode Characters.

Syntax
Delphi

class function ToCharDynArray(const AArray: _CharArray):


TClrWCharDynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.9 TClrArrayHelper.ToDateTimeArray Method


Converts a delphi dynamic array of TDateTime to a .net one-dimensional array of DateTime.

1178
.Net Runtime Library for Delphi

Syntax
Delphi

class function ToDateTimeArray(const AArray: TClrDateTimeDynArray):


_DateTimeArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.10 TClrArrayHelper.ToDateTimeDynArray Method


Converts a .net one-dimensional array of DateTime to a delphi dynamic array of TDateTime.

Syntax
Delphi

class function ToDateTimeDynArray(const AArray: _DateTimeArray):


TClrDateTimeDynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.11 ToDecimalArray Method

This is the overview for the ToDecimalArray method overload.

Overload List

Name Description

TClrArrayHelper.ToDecimalArray Converts a delphi dynamic array of Decimal to a .net one-


(TClrDecimalDynArray) dimensional array of Decimal.

TClrArrayHelper.ToDecimalArray Converts a delphi dynamic array of Double to a .net one-


(TClrExtendedDynArray) dimensional array of Decimal.

7.1.1.8.2.7.1.11.1 TClrArrayHelper.ToDecimalArray Method (TClrDecimalDynArray)

Converts a delphi dynamic array of Decimal to a .net one-dimensional array of Decimal.

Syntax
Delphi

1179
.Net Runtime Library for Delphi

class function ToDecimalArray(const AArray: TClrDecimalDynArray):


_DecimalArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.11.2 TClrArrayHelper.ToDecimalArray Method (TClrExtendedDynArray)

Converts a delphi dynamic array of Double to a .net one-dimensional array of Decimal.

Syntax
Delphi

class function ToDecimalArray(const AArray: TClrExtendedDynArray):


_DecimalArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.12 TClrArrayHelper.ToDecimalDynArray Method


Converts a .net one-dimensional array of Decimal to a delphi dynamic array of Decimal.

Syntax
Delphi

class function ToDecimalDynArray(const AArray: _DecimalArray):


TClrExtendedDynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.13 TClrArrayHelper.ToDoubleArray Method


Converts a delphi dynamic array of Double to a .net one-dimensional array of Double.

Syntax
Delphi

class function ToDoubleArray(const AArray: TClrDoubleDynArray):


_DoubleArray; overload;

See Also

1180
.Net Runtime Library for Delphi

TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.14 TClrArrayHelper.ToDoubleDynArray Method


Converts a .net one-dimensional array of Double to a delphi dynamic array of Double.

Syntax
Delphi

class function ToDoubleDynArray(const AArray: _DoubleArray):


TClrDoubleDynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.15 ToExceptionArray Method

This is the overview for the ToExceptionArray method overload.

Overload List

Name Description

TClrArrayHelper.ToExceptionArray Converts a delphi dynamic array of Exception to a .net one-


(TClrExceptionDynArray) dimensional array of Exception.

TClrArrayHelper.ToExceptionArray Converts a delphi dynamic array of SysUtils.Exception to a .net


(TExceptionDynArray) one-dimensional array of System.Exception.

7.1.1.8.2.7.1.15.1 TClrArrayHelper.ToExceptionArray Method (TClrExceptionDynArray)

Converts a delphi dynamic array of Exception to a .net one-dimensional array of Exception.

Syntax
Delphi

class function ToExceptionArray(const AArray: TClrExceptionDynArray):


_ExceptionArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

1181
.Net Runtime Library for Delphi

7.1.1.8.2.7.1.15.2 TClrArrayHelper.ToExceptionArray Method (TExceptionDynArray)

Converts a delphi dynamic array of SysUtils.Exception to a .net one-dimensional array of System.Exception.

Syntax
Delphi

class function ToExceptionArray(const AArray: TExceptionDynArray):


_ExceptionArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.16 TClrArrayHelper.ToExceptionDynArray Method


Converts a .net one-dimensional array of System.Exception to a delphi dynamic array of SysUtils.Exception.

Syntax
Delphi

class function ToExceptionDynArray(const AArray: _ExceptionArray):


TExceptionDynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.17 TClrArrayHelper.ToInt16Array Method


Converts a delphi dynamic array of smallInt to a .net one-dimensional array of Int16.

Syntax
Delphi

class function ToInt16Array(const AArray: TClrInt16DynArray):


_Int16Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.18 TClrArrayHelper.ToInt16DynArray Method


Converts a .net one-dimensional array of Int16 to a delphi dynamic array of SmallInt.

1182
.Net Runtime Library for Delphi

Syntax
Delphi

class function ToInt16DynArray(const AArray: _Int16Array):


TClrInt16DynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.19 TClrArrayHelper.ToInt32Array Method


Converts a delphi dynamic array of Integer to a .net one-dimensional array of Int32.

Syntax
Delphi

class function ToInt32Array(const AArray: TClrInt32DynArray):


_Int32Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.20 TClrArrayHelper.ToInt32DynArray Method


Converts a .net one-dimensional array of Int32 to a delphi dynamic array of Integer.

Syntax
Delphi

class function ToInt32DynArray(const AArray: _Int32Array):


TClrInt32DynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.21 TClrArrayHelper.ToInt64Array Method


Converts a delphi dynamic array of Int64 to a .net one-dimensional array of Int64.

Syntax
Delphi

1183
.Net Runtime Library for Delphi

class function ToInt64Array(const AArray: TClrInt64DynArray):


_Int64Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.22 TClrArrayHelper.ToInt64DynArray Method


Converts a .net one-dimensional array of Int64 to a delphi dynamic array of Int64.

Syntax
Delphi

class function ToInt64DynArray(const AArray: _Int64Array):


TClrInt64DynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.23 ToObjectArray Method

This is the overview for the ToObjectArray method overload.

Overload List

Name Description

TClrArrayHelper.ToObjectArray Converts a dynamic array of Object to a .net one-dimensional


(TClrObjectDynArray) array of Object.

TClrArrayHelper.ToObjectArray Converts a delphi dynamic array of variants to a .net one-


(TClrVariantDynArray) dimensional array of Object.

TClrArrayHelper.ToObjectArray Converts a delphi dynamic array of TClrBaseObject to a .net one-


(TTClrObjectDynArray) dimensional array of Object.

TClrArrayHelper.ToObjectArray Converts a delphi dynamic array of TVarRec to a .net one-


(array of const) dimensional array of Object.

7.1.1.8.2.7.1.23.1 TClrArrayHelper.ToObjectArray Method (TClrObjectDynArray)

Converts a dynamic array of Object to a .net one-dimensional array of Object.

1184
.Net Runtime Library for Delphi

Syntax
Delphi

class function ToObjectArray(const AArray: TClrObjectDynArray):


_ObjectArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.23.2 TClrArrayHelper.ToObjectArray Method (TClrVariantDynArray)

Converts a delphi dynamic array of variants to a .net one-dimensional array of Object.

Syntax
Delphi

class function ToObjectArray(const AArray: TClrVariantDynArray):


_ObjectArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.23.3 TClrArrayHelper.ToObjectArray Method (TTClrObjectDynArray)

Converts a delphi dynamic array of TClrBaseObject to a .net one-dimensional array of Object.

Syntax
Delphi

class function ToObjectArray(const AArray: TTClrObjectDynArray):


_ObjectArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.23.4 TClrArrayHelper.ToObjectArray Method (array of const)

Converts a delphi dynamic array of TVarRec to a .net one-dimensional array of Object.

Syntax
Delphi

1185
.Net Runtime Library for Delphi

class function ToObjectArray(const AArray: array of const):


_ObjectArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.24 TClrArrayHelper.ToSByteArray Method


Converts a delphi dynamic array of ShortInt to a .net one-dimensional array of SByte.

Syntax
Delphi

class function ToSByteArray(const AArray: TClrSByteDynArray):


_SByteArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.25 TClrArrayHelper.ToSByteDynArray Method


Converts a .net one-dimensional array of SByte to a delphi dynamic array of ShortInt.

Syntax
Delphi

class function ToSByteDynArray(const AArray: _SByteArray):


TClrSByteDynArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.26 TClrArrayHelper.ToSingleArray Method


Converts a delphi dynamic array of Single to a .net one-dimensional array of Single.

Syntax
Delphi

class function ToSingleArray(const AArray: TClrSingleDynArray):


_SingleArray; overload;

See Also

1186
.Net Runtime Library for Delphi

TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.27 TClrArrayHelper.ToSingleDynArray Method


Converts a .net one-dimensional array of Single to a delphi dynamic array of Single.

Syntax
Delphi

class function ToSingleDynArray(const AArray: _SingleArray):


TClrSingleDynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.28 ToStringArray Method

This is the overview for the ToStringArray method overload.

Overload List

Name Description

TClrArrayHelper.ToStringArray Converts a delphi dynamic array of variants to a .net one-


(TClrVariantDynArray) dimensional array of String.

TClrArrayHelper.ToStringArray Converts a delphi dynamic array of WideString to a .net one-


(TClrWStringDynArray) dimensional array of String.

TClrArrayHelper.ToStringArray Converts a delphi TStrings value to a .net one-dimensional array


(TStrings) of String.

7.1.1.8.2.7.1.28.1 TClrArrayHelper.ToStringArray Method (TClrVariantDynArray)

Converts a delphi dynamic array of variants to a .net one-dimensional array of String.

Syntax
Delphi

class function ToStringArray(const AArray: TClrVariantDynArray):


_StringArray; overload;

See Also

1187
.Net Runtime Library for Delphi

TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.28.2 TClrArrayHelper.ToStringArray Method (TClrWStringDynArray)

Converts a delphi dynamic array of WideString to a .net one-dimensional array of String.

Syntax
Delphi

class function ToStringArray(const AArray: TClrWStringDynArray):


_StringArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.28.3 TClrArrayHelper.ToStringArray Method (TStrings)

Converts a delphi TStrings value to a .net one-dimensional array of String.

Syntax
Delphi

class function ToStringArray(const AList: TStrings): _StringArray;


overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.29 TClrArrayHelper.ToStringDynArray Method


Converts a .net one-dimensional array of string to a delphi dynamic array of string.

Syntax
Delphi

class function ToStringDynArray(const AArray: _StringArray):


TClrStringDynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

1188
.Net Runtime Library for Delphi

7.1.1.8.2.7.1.30 ToTypeArray Method

This is the overview for the ToTypeArray method overload.

Overload List

Name Description

TClrArrayHelper.ToTypeArray Converts a delphi dynamic array of strings as type names to a .net


(TClrStringDynArray) one-dimensional array of Type.

TClrArrayHelper.ToTypeArray Converts a delphi dynamic array of Type to a .net one-


(TClrTypeDynArray) dimensional array of Type.

7.1.1.8.2.7.1.30.1 TClrArrayHelper.ToTypeArray Method (TClrStringDynArray)


Converts a delphi dynamic array of strings as type names to a .net one-dimensional array of Type.

Syntax
Delphi

class function ToTypeArray(const ATypeNames: TClrStringDynArray):


_TypeArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.30.2 TClrArrayHelper.ToTypeArray Method (TClrTypeDynArray)


Converts a delphi dynamic array of Type to a .net one-dimensional array of Type.

Syntax
Delphi

class function ToTypeArray(const AArray: TClrTypeDynArray):


_TypeArray; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.31 TClrArrayHelper.ToUInt16Array Method


Converts a delphi dynamic array of Word to a .net one-dimensional array of UInt16.

1189
.Net Runtime Library for Delphi

Syntax
Delphi

class function ToUInt16Array(const AArray: TClrUInt16DynArray):


_UInt16Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.32 TClrArrayHelper.ToUInt16DynArray Method


Converts a .net one-dimensional array of UInt16 to a delphi dynamic array of Word.

Syntax
Delphi

class function ToUInt16DynArray(const AArray: _UInt16Array):


TClrUInt16DynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.33 TClrArrayHelper.ToUInt32Array Method


Converts a delphi dynamic array of LongWord to a .net one-dimensional array of UInt32.

Syntax
Delphi

class function ToUInt32Array(const AArray: TClrUInt32DynArray):


_UInt32Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.34 TClrArrayHelper.ToUInt32DynArray Method


Converts a .net one-dimensional array of UInt32 to a delphi dynamic array of LongWord.

Syntax
Delphi

1190
.Net Runtime Library for Delphi

class function ToUInt32DynArray(const AArray: _UInt32Array):


TClrUInt32DynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.35 TClrArrayHelper.ToUInt64Array Method


Converts a delphi dynamic array of LargeUInt to a .net one-dimensional array of UInt64.

Syntax
Delphi

class function ToUInt64Array(const AArray: TClrUInt64DynArray):


_UInt64Array; overload;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.36 TClrArrayHelper.ToUInt64DynArray Method


Converts a .net one-dimensional array of UInt64 to a delphi dynamic array of LargeUInt.

Syntax
Delphi

class function ToUInt64DynArray(const AArray: _UInt64Array):


TClrUInt64DynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.37 TClrArrayHelper.ToVariantDynArray Method


Converts a .net one-dimensional array of Object to a delphi dynamic array of variants.

Syntax
Delphi

class function ToVariantDynArray(const AArray: _ObjectArray):


TClrVariantDynArray;

See Also

1191
.Net Runtime Library for Delphi

TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.7.1.38 TClrArrayHelper.ToWideStringDynArray Method


Converts a .net one-dimensional array of string to a delphi dynamic array of WideString/UnicodeString.

Syntax
Delphi

class function ToWideStringDynArray(const AArray: _StringArray):


TClrWStringDynArray;

See Also
TClrArrayHelper Class
CNClrLib.Host Namespace

7.1.1.8.2.8 TClrAssembly Class


Collapse All Expand All

Represents an assembly, which is a reusable, versionable, and self-describing building block of a common language
runtime application. This class cannot be inherited.

Inheritance Hierarchy
CNClrLib.Host.TClrAssembly

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrAssembly = class sealed(TClrBase);

Constructors

Name Description

Create Creates a new instance of the TClrAssembly Class with the specified
Assembly interface.

Destructors

Name Description

1192
.Net Runtime Library for Delphi

Name Description

Destroy Destroys an instance of the TClrAssembly Class.

Methods

Name Description

AddModuleResolve Add a ModuleResolve event handler as function pointer. This event


will be raised when the common language runtime class loader cannot
resolve a reference to an internal module of an assembly through
normal means.

AsClrObject Returns the Assembly object as ClrObject Interface.

AsPointer Returns the Assembly object as managed pointer.

BuildAssemblyFromWSDL Build a .net assembly from Web Services Description


Language.

CreateInstance Locates the specified type from this assembly and creates an instance
of it using the system activator, with optional case-sensitive search
and having the specified binding flags and arguments.

CreateQualifiedName Creates the name of a type qualified by the display name of its
assembly.

Equals(ClrVariant) Determines whether this assembly and the specified variant are equal.

Equals(TClrAssembly) Determines whether this assembly and the specified TClrAssembly


object are equal.

GetAssembly(ClrVariant) Gets the currently loaded assembly in which the specified object has
been created or loaded.

GetAssembly(ClrWString) Gets the currently loaded assembly in which the type from the
specified type name is defined.

GetAssembly(_Type) Gets the currently loaded assembly in which the specified type is
defined.

GetAssemblyName Get the assmbly name from the assembly file path.

GetCallingAssembly Returns the Assembly of the method that invoked the currently
executing method.

GetEntryAssembly Gets the process executable in the default application domain. In


other application domains, this is the first executable that was

1193
.Net Runtime Library for Delphi

Name Description

executed by TClrAppDomain.ExecuteAssembly.

GetEnumObject Converts the specified 32-bit signed integer to an


enumeration member as variant.

GetExecutingAssembly Gets the assembly that contains the code that is currently executing.

GetFile Gets a FileStream for the specified file in the file table of the manifest
of this assembly.

GetFiles Gets the files in the file table of an assembly manifest.

GetGACAssemblyPath Get the Global Assembly Cache (GAC) path of the assembly.

GetManifestResourceNames Returns the names of all the resources in this assembly.

GetManifestResourceStream Loads the specified manifest resource from this assembly.

GetModule Gets the specified module in this assembly.

GetModules Gets all the modules that are part of this assembly, specifying whether
to include resource modules.

GetName Gets an AssemblyName for this assembly.

GetObjectType Gets the Type of the specified object.

GetRegisterAssembly Get the list of registered TClrAssembly objects.

GetType() Gets the Type of the current instance .

GetType(ClrWString, Gets the Type object with the specified name in the assembly instance
ClrBoolean) and optionally throws an exception if the type is not found.

GetType(TTypeCode) Gets the Type of the specified TypeCode.

GetTypes() Gets the types defined in this assembly.

GetTypes(String) Convert type names separated by semicolons to a one-


dimensional array of Type.

Load(ClrWString) Loads an assembly given the long form of its name.

1194
.Net Runtime Library for Delphi

Name Description

Load(TClrByteDynArray, Loads the assembly with a common object file format (COFF)-based
TClrByteDynArray) image containing an emitted assembly, optionally including symbols
for the assembly. The assembly is loaded into the application domain
of the caller.

Load(_AssemblyName) Loads an assembly given its AssemblyName.

Load(_ByteArray, Loads the assembly with a common object file format (COFF)-based
_ByteArray) image containing an emitted assembly, optionally including symbols
for the assembly. The assembly is loaded into the application domain
of the caller.

LoadFile Loads the contents of an assembly file on the specified path.

LoadFrom Loads an assembly given its file name or path.

LoadModule(ClrWString, Loads the module, internal to this assembly, with a common object file
TClrByteDynArray) format (COFF)-based image containing an emitted module, or a
resource file.

LoadModule(ClrWString, Loads the module, internal to this assembly, with a common object file
TClrByteDynArray, format (COFF)-based image containing an emitted module, or a
resource file. The raw bytes representing the symbols for the module
TClrByteDynArray)
are also loaded.

LoadModule(ClrWString, Loads the module, internal to this assembly, with a common object file
_ByteArray) format (COFF)-based image containing an emitted module, or a
resource file.

LoadModule(ClrWString, Loads the module, internal to this assembly, with a common object file
_ByteArray, _ByteArray) format (COFF)-based image containing an emitted module, or a
resource file. The raw bytes representing the symbols for the module
are also loaded.

LoadWithPartialName Loads an assembly from the application directory or from the global
assembly cache using a partial name.

RegisterAssembly Register the initialized and loaded assembly object.

RemoveModuleResolve Remove the ModuleResolve event handler.

ToString Returns the full name of the assembly, also known as the display
name.

Unwrap Returns the .net System.Reflection.Assembly object.

Properties

1195
.Net Runtime Library for Delphi

Name Description

DefaultInterface Returns the default interface of the TClrAssembly.

FullName Gets the display name of the assembly.

GlobalAssemblyCache Gets a value indicating whether the assembly was loaded from the
global assembly cache.

ImageRuntimeVersion Gets a string representing the version of the common language


runtime (CLR) saved in the file containing the manifest.

Location Gets the full path or UNC location of the loaded file that contains the
manifest.

See Also
TClrAssembly Methods
TClrAssembly Properties

7.1.1.8.2.8.1 TClrAssembly.Create Constructor


Creates a new instance of the TClrAssembly Class with the specified Assembly interface.

Syntax
Delphi

constructor Create(AIntf: _Assembly); overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.2 TClrAssembly.Destroy Destructor


Destroys an instance of the TClrAssembly Class.

Syntax
Delphi

destructor Destroy; override;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

1196
.Net Runtime Library for Delphi

7.1.1.8.2.8.3 TClrAssembly Methods


The methods of the TClrAssembly class are listed here.

Methods

Name Description

AddModuleResolve Add a ModuleResolve event handler as function pointer. This event


will be raised when the common language runtime class loader cannot
resolve a reference to an internal module of an assembly through
normal means.

AsClrObject Returns the Assembly object as ClrObject Interface.

AsPointer Returns the Assembly object as managed pointer.

BuildAssemblyFromWSDL Build a .net assembly from Web Services Description Language.

CreateInstance Locates the specified type from this assembly and creates an instance
of it using the system activator, with optional case-sensitive search
and having the specified binding flags and arguments.

CreateQualifiedName Creates the name of a type qualified by the display name of its
assembly.

Equals(ClrVariant) Determines whether this assembly and the specified variant are equal.

Equals(TClrAssembly) Determines whether this assembly and the specified TClrAssembly


object are equal.

GetAssembly(ClrVariant) Gets the currently loaded assembly in which the specified object has
been created or loaded.

GetAssembly(ClrWString) Gets the currently loaded assembly in which the type from the
specified type name is defined.

GetAssembly(_Type) Gets the currently loaded assembly in which the specified type is
defined.

GetAssemblyName Get the assmbly name from the assembly file path.

GetCallingAssembly Returns the Assembly of the method that invoked the currently
executing method.

GetEntryAssembly Gets the process executable in the default application domain. In


other application domains, this is the first executable that was
executed by TClrAppDomain.ExecuteAssembly.

1197
.Net Runtime Library for Delphi

Name Description

GetEnumObject Converts the specified 32-bit signed integer to an enumeration


member as variant.

GetExecutingAssembly Gets the assembly that contains the code that is currently executing.

GetFile Gets a FileStream for the specified file in the file table of the manifest
of this assembly.

GetFiles Gets the files in the file table of an assembly manifest.

GetGACAssemblyPath Get the Global Assembly Cache (GAC) path of the assembly.

GetManifestResourceNames Returns the names of all the resources in this assembly.

GetManifestResourceStream Loads the specified manifest resource from this assembly.

GetModule Gets the specified module in this assembly.

GetModules Gets all the modules that are part of this assembly, specifying whether
to include resource modules.

GetName Gets an AssemblyName for this assembly.

GetObjectType Gets the Type of the specified object.

GetRegisterAssembly Get the list of registered TClrAssembly objects.

GetType() Gets the Type of the current instance .

GetType(ClrWString, Gets the Type object with the specified name in the assembly instance
ClrBoolean) and optionally throws an exception if the type is not found.

GetType(TTypeCode) Gets the Type of the specified TypeCode.

GetTypes() Gets the types defined in this assembly.

GetTypes(String) Convert type names separated by semicolons to a one-


dimensional array of Type.

Load(ClrWString) Loads an assembly given the long form of its name.

Load(TClrByteDynArray, Loads the assembly with a common object file format (COFF)-based
TClrByteDynArray) image containing an emitted assembly, optionally including symbols
for the assembly. The assembly is loaded into the application domain

1198
.Net Runtime Library for Delphi

Name Description

of the caller.

Load(_AssemblyName) Loads an assembly given its AssemblyName.

Load(_ByteArray, Loads the assembly with a common object file format (COFF)-based
_ByteArray) image containing an emitted assembly, optionally including symbols
for the assembly. The assembly is loaded into the application domain
of the caller.

LoadFile Loads the contents of an assembly file on the specified path.

LoadFrom Loads an assembly given its file name or path.

LoadModule(ClrWString, Loads the module, internal to this assembly, with a common object file
TClrByteDynArray) format (COFF)-based image containing an emitted module, or a
resource file.

LoadModule(ClrWString, Loads the module, internal to this assembly, with a common object file
TClrByteDynArray, format (COFF)-based image containing an emitted module, or a
resource file. The raw bytes representing the symbols for the module
TClrByteDynArray)
are also loaded.

LoadModule(ClrWString, Loads the module, internal to this assembly, with a common object file
_ByteArray) format (COFF)-based image containing an emitted module, or a
resource file.

LoadModule(ClrWString, Loads the module, internal to this assembly, with a common object file
_ByteArray, _ByteArray) format (COFF)-based image containing an emitted module, or a
resource file. The raw bytes representing the symbols for the module
are also loaded.

LoadWithPartialName Loads an assembly from the application directory or from the global
assembly cache using a partial name.

RegisterAssembly Register the initialized and loaded assembly object.

RemoveModuleResolve Remove the ModuleResolve event handler.

ToString Returns the full name of the assembly, also known as the display
name.

Unwrap Returns the .net System.Reflection.Assembly object.

1199
.Net Runtime Library for Delphi

7.1.1.8.2.8.3.1 TClrAssembly.AddModuleResolve Method


Add a ModuleResolve event handler as function pointer. This event will be raised when the common language runtime
class loader cannot resolve a reference to an internal module of an assembly through normal means.

Syntax
Delphi

procedure AddModuleResolve(ADelphiObject: TObject; AFunctionPointer:


System.Pointer);

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.2 TClrAssembly.AsClrObject Method


Returns the Assembly object as ClrObject Interface.

Syntax
Delphi

function AsClrObject: _ClrObject;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.3 TClrAssembly.AsPointer Method


Returns the Assembly object as managed pointer.

Syntax
Delphi

function AsPointer: _IntPtr;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.4 TClrAssembly.BuildAssemblyFromWSDL Method


Build a .net assembly from Web Services Description Language.

Syntax

1200
.Net Runtime Library for Delphi

Delphi

class function BuildAssemblyFromWSDL(AWsdlLocation: ClrWString;


AProtocolName: TClrWsdlProtocolName = pnSoap12): TClrAssembly;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.5 TClrAssembly.CreateInstance Method


Locates the specified type from this assembly and creates an instance of it using the system activator, with optional
case-sensitive search and having the specified binding flags and arguments.

Syntax
Delphi

function CreateInstance(ATypeName: ClrWString; AIgnoreCase: ClrBoolean


= True; ABindingAttr: TBindingFlags_Set = [];

AArgs: _ObjectArray = Nil): ClrVariant; overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.6 TClrAssembly.CreateQualifiedName Method


Creates the name of a type qualified by the display name of its assembly.

Syntax
Delphi

class function CreateQualifiedName(AAssemblyName: ClrWString;


ATypeName: ClrWString): ClrWString;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.7 Equals Method

This is the overview for the Equals method overload.

Overload List

1201
.Net Runtime Library for Delphi

Name Description

TClrAssembly.Equals Determines whether this assembly and the specified variant are equal.
(ClrVariant)

TClrAssembly.Equals Determines whether this assembly and the specified TClrAssembly


(TClrAssembly) object are equal.

7.1.1.8.2.8.3.7.1 TClrAssembly.Equals Method (ClrVariant)

Determines whether this assembly and the specified variant are equal.

Syntax
Delphi

function Equals(AValue: ClrVariant): ClrBoolean; overload;


reintroduce;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.7.2 TClrAssembly.Equals Method (TClrAssembly)

Determines whether this assembly and the specified TClrAssembly object are equal.

Syntax
Delphi

function Equals(AValue: TClrAssembly): ClrBoolean; overload;


reintroduce;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.8 GetAssembly Method

This is the overview for the GetAssembly method overload.

Overload List

Name Description

1202
.Net Runtime Library for Delphi

Name Description

TClrAssembly.GetAssembly Gets the currently loaded assembly in which the specified object has
(ClrVariant) been created or loaded.

TClrAssembly.GetAssembly Gets the currently loaded assembly in which the type from the
(ClrWString) specified type name is defined.

TClrAssembly.GetAssembly Gets the currently loaded assembly in which the specified type is
(_Type) defined.

7.1.1.8.2.8.3.8.1 TClrAssembly.GetAssembly Method (ClrVariant)

Gets the currently loaded assembly in which the specified object has been created or loaded.

Syntax
Delphi

class function GetAssembly(AObject: ClrVariant): TClrAssembly;


overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.8.2 TClrAssembly.GetAssembly Method (ClrWString)

Gets the currently loaded assembly in which the type from the specified type name is defined.

Syntax
Delphi

class function GetAssembly(ATypeName: ClrWString): TClrAssembly;


overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.8.3 TClrAssembly.GetAssembly Method (_Type)

Gets the currently loaded assembly in which the specified type is defined.

Syntax

1203
.Net Runtime Library for Delphi

Delphi

class function GetAssembly(AType: _Type): TClrAssembly; overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.9 TClrAssembly.GetAssemblyName Method


Get the assmbly name from the assembly file path.

Syntax
Delphi

class function GetAssemblyName(AAssemblyFile: ClrWString):


_AssemblyName;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.10 TClrAssembly.GetCallingAssembly Method


Returns the Assembly of the method that invoked the currently executing method.

Syntax
Delphi

class function GetCallingAssembly: TClrAssembly;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.11 TClrAssembly.GetEntryAssembly Method


Gets the process executable in the default application domain. In other application domains, this is the first executable
that was executed by TClrAppDomain.ExecuteAssembly.

Syntax
Delphi

class function GetEntryAssembly: TClrAssembly;

See Also

1204
.Net Runtime Library for Delphi

TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.12 TClrAssembly.GetEnumObject Method


Converts the specified 32-bit signed integer to an enumeration member as variant.

Syntax
Delphi

class function GetEnumObject(AEnumType: _Type; AValue: ClrInt32):


ClrVariant;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.13 TClrAssembly.GetExecutingAssembly Method


Gets the assembly that contains the code that is currently executing.

Syntax
Delphi

class function GetExecutingAssembly: TClrAssembly;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.14 TClrAssembly.GetFile Method


Gets a FileStream for the specified file in the file table of the manifest of this assembly.

Syntax
Delphi

function GetFile(AName: ClrWString): _FileStream;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.15 TClrAssembly.GetFiles Method


Gets the files in the file table of an assembly manifest.

1205
.Net Runtime Library for Delphi

Syntax
Delphi

function GetFiles: _FileStreamArray;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.16 TClrAssembly.GetGACAssemblyPath Method


Get the Global Assembly Cache (GAC) path of the assembly.

Syntax
Delphi

class function GetGACAssemblyPath(APartialAssemblyName: ClrWString):


ClrWString;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.17 TClrAssembly.GetManifestResourceNames Method


Returns the names of all the resources in this assembly.

Syntax
Delphi

function GetManifestResourceNames: TStrings;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.18 TClrAssembly.GetManifestResourceStream Method


Loads the specified manifest resource from this assembly.

Syntax
Delphi

function GetManifestResourceStream(AName: ClrWString; AType: _Type =


Nil): _Stream;

1206
.Net Runtime Library for Delphi

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.19 TClrAssembly.GetModule Method


Gets the specified module in this assembly.

Syntax
Delphi

function GetModule(AName: ClrWString): _Module;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.20 TClrAssembly.GetModules Method


Gets all the modules that are part of this assembly, specifying whether to include resource modules.

Syntax
Delphi

function GetModules(AGetResourceModules: ClrBoolean = False):


_ModuleArray;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.21 TClrAssembly.GetName Method


Gets an AssemblyName for this assembly.

Syntax
Delphi

function GetName(ACopiedName: ClrBoolean = False): _AssemblyName;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

1207
.Net Runtime Library for Delphi

7.1.1.8.2.8.3.22 TClrAssembly.GetObjectType Method


Gets the Type of the specified object.

Syntax
Delphi

class function GetObjectType(AObject: ClrVariant; Unwrap: ClrBoolean =


True): _Type; overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.23 TClrAssembly.GetRegisterAssembly Method


Get the list of registered TClrAssembly objects.

Syntax
Delphi

class function GetRegisterAssembly(AAssemblyID: ClrWString):


TClrAssembly;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.24 GetType Method

This is the overview for the GetType method overload.

Overload List

Name Description

TClrAssembly.GetType Gets the Type of the current instance .

TClrAssembly.GetType This is GetType, a member of class TClrAssembly.


(ClrWString, ClrBoolean)

TClrAssembly.GetType This is GetType, a member of class TClrAssembly.


(TTypeCode)

1208
.Net Runtime Library for Delphi

7.1.1.8.2.8.3.24.1 TClrAssembly.GetType Method

Gets the Type of the current instance .

Syntax
Delphi

function GetType: _Type; overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.24.2 TClrAssembly.GetType Method (ClrWString, ClrBoolean)

Gets the Type object with the specified name in the assembly instance and optionally throws an exception if the type is
not found.

Syntax
Delphi

class function GetType(ATypeName: ClrWString; AThrowError: ClrBoolean


= False): _Type; overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.24.3 TClrAssembly.GetType Method (TTypeCode)

Gets the Type of the specified TypeCode .

Syntax
Delphi

class function GetType(ATypeKind: TTypeCode): _Type; overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.25 GetTypes Method

This is the overview for the GetTypes method overload.

Overload List

1209
.Net Runtime Library for Delphi

Name Description

TClrAssembly.GetTypes Gets the types defined in this assembly.

TClrAssembly.GetTypes Convert type names separated by semicolons to a one-


(String) dimensional array if Type.

7.1.1.8.2.8.3.25.1 TClrAssembly.GetTypes Method

Gets the types defined in this assembly.

Syntax
Delphi

function GetTypes: _TypeArray; overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.25.2 TClrAssembly.GetTypes Method (String)

Convert type names separated by semicolons to a one-dimensional array if Type.

Syntax
Delphi

class function GetTypes(ATypeNamesSepBySemiColon: String): _TypeArray;


overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.26 Load Method

This is the overview for the Load method overload.

Overload List

Name Description

TClrAssembly.Load Loads an assembly given the long form of its name.

1210
.Net Runtime Library for Delphi

Name Description

(ClrWString)

TClrAssembly.Load Loads the assembly with a common object file format (COFF)-based
(TClrByteDynArray, image containing an emitted assembly, optionally including symbols
for the assembly. The assembly is loaded into the application domain
TClrByteDynArray)
of the caller.

TClrAssembly.Load Loads an assembly given its AssemblyName.


(_AssemblyName)

TClrAssembly.Load Loads the assembly with a common object file format (COFF)-based
(_ByteArray, _ByteArray) image containing an emitted assembly, optionally including symbols
for the assembly. The assembly is loaded into the application domain
of the caller.

7.1.1.8.2.8.3.26.1 TClrAssembly.Load Method (ClrWString)

Loads an assembly given the long form of its name.

Syntax
Delphi

class function Load(AAssemblyString: ClrWString): TClrAssembly;


overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.26.2 TClrAssembly.Load Method (TClrByteDynArray, TClrByteDynArray)

Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally
including symbols for the assembly. The assembly is loaded into the application domain of the caller.

Syntax
Delphi

class function Load(ARawAssembly: TClrByteDynArray; ARawSymbolStore:


TClrByteDynArray): TClrAssembly; overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

1211
.Net Runtime Library for Delphi

7.1.1.8.2.8.3.26.3 TClrAssembly.Load Method (_AssemblyName)

Loads an assembly given its AssemblyName.

Syntax
Delphi

class function Load(AAssemblyRef: _AssemblyName): TClrAssembly;


overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.26.4 TClrAssembly.Load Method (_ByteArray, _ByteArray)

Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly, optionally
including symbols for the assembly. The assembly is loaded into the application domain of the caller.

Syntax
Delphi

class function Load(ARawAssembly: _ByteArray; ARawSymbolStore:


_ByteArray = Nil): TClrAssembly; overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.27 TClrAssembly.LoadFile Method


Loads the contents of an assembly file on the specified path.

Syntax
Delphi

class function LoadFile(APath: TFileName): TClrAssembly;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.28 TClrAssembly.LoadFrom Method


Loads an assembly given its file name or path.

Syntax

1212
.Net Runtime Library for Delphi

Delphi

class function LoadFrom(AAssemblyFile: TFileName): TClrAssembly;


overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.29 LoadModule Method

This is the overview for the LoadModule method overload.

Overload List

Name Description

TClrAssembly.LoadModule Loads the module, internal to this assembly, with a common object file
(ClrWString, format (COFF)-based image containing an emitted module, or a
resource file.
TClrByteDynArray)

TClrAssembly.LoadModule Loads the module, internal to this assembly, with a common object file
(ClrWString, format (COFF)-based image containing an emitted module, or a
resource file. The raw bytes representing the symbols for the module
TClrByteDynArray,
are also loaded.
TClrByteDynArray)

TClrAssembly.LoadModule Loads the module, internal to this assembly, with a common object file
(ClrWString, _ByteArray) format (COFF)-based image containing an emitted module, or a
resource file.

TClrAssembly.LoadModule Loads the module, internal to this assembly, with a common object file
(ClrWString, _ByteArray, format (COFF)-based image containing an emitted module, or a
resource file. The raw bytes representing the symbols for the module
_ByteArray)
are also loaded.

7.1.1.8.2.8.3.29.1 TClrAssembly.LoadModule Method (ClrWString, TClrByteDynArray)

Loads the module, internal to this assembly, with a common object file format (COFF)-based image containing an
emitted module, or a resource file.

Syntax
Delphi

function LoadModule(AModuleName: ClrWString; ARawModule:


TClrByteDynArray): _Module; overload;

See Also

1213
.Net Runtime Library for Delphi

TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.29.2 TClrAssembly.LoadModule Method (ClrWString, TClrByteDynArray,


TClrByteDynArray)

Loads the module, internal to this assembly, with a common object file format (COFF)-based image containing an
emitted module, or a resource file. The raw bytes representing the symbols for the module are also loaded.

Syntax
Delphi

function LoadModule(AModuleName: ClrWString; ARawModule:


TClrByteDynArray; ARawSymbolStore: TClrByteDynArray): _Module;
overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.29.3 TClrAssembly.LoadModule Method (ClrWString, _ByteArray)

Loads the module, internal to this assembly, with a common object file format (COFF)-based image containing an
emitted module, or a resource file.

Syntax
Delphi

function LoadModule(AModuleName: ClrWString; ARawModule: _ByteArray):


_Module; overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.29.4 TClrAssembly.LoadModule Method (ClrWString, _ByteArray, _ByteArray)

Loads the module, internal to this assembly, with a common object file format (COFF)-based image containing an
emitted module, or a resource file. The raw bytes representing the symbols for the module are also loaded.

Syntax
Delphi

function LoadModule(AModuleName: ClrWString; ARawModule: _ByteArray;


ARawSymbolStore: _ByteArray): _Module; overload;

See Also

1214
.Net Runtime Library for Delphi

TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.30 TClrAssembly.LoadWithPartialName Method


Loads an assembly from the application directory or from the global assembly cache using a partial name.

Syntax
Delphi

class function LoadWithPartialName(APartialName: ClrWString):


TClrAssembly; overload;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.31 TClrAssembly.RegisterAssembly Method


Register the initialized and loaded assembly object.

Syntax
Delphi

class procedure RegisterAssembly(AAssemblyID: ClrWString; ALocation:


ClrWString; ALoadType: TClrAssmLoadType;

AWsdlProtocolName: TClrWsdlProtocolName = pnSoap12);

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.32 TClrAssembly.RemoveModuleResolve Method


Remove the ModuleResolve event handler.

Syntax
Delphi

procedure RemoveModuleResolve(AFunctionPointer: System.Pointer);

See Also
TClrAssembly Class
CNClrLib.Host Namespace

1215
.Net Runtime Library for Delphi

7.1.1.8.2.8.3.33 TClrAssembly.ToString Method


Returns the full name of the assembly, also known as the display name.

Syntax
Delphi

function ToString: string; override;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.3.34 TClrAssembly.Unwrap Method


Returns the .net System.Reflection.Assembly object.

Syntax
Delphi

function Unwrap: ClrVariant;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.4 TClrAssembly Properties


The properties of the TClrAssembly class are listed here.

Properties

Name Description

DefaultInterface Returns the default interface of the TClrAssembly.

FullName Gets the display name of the assembly.

GlobalAssemblyCache Gets a value indicating whether the assembly was loaded from the
global assembly cache.

ImageRuntimeVersion Gets a string representing the version of the common language


runtime (CLR) saved in the file containing the manifest.

Location Gets the full path or UNC location of the loaded file that contains the

1216
.Net Runtime Library for Delphi

Name Description

manifest.

7.1.1.8.2.8.4.1 TClrAssembly.DefaultInterface Property


Returns the default interface of the TClrAssembly.

Syntax
Delphi

property DefaultInterface: _Assembly;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.4.2 TClrAssembly.FullName Property


Gets the display name of the assembly.

Syntax
Delphi

property FullName: ClrWString;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.4.3 TClrAssembly.GlobalAssemblyCache Property


Gets a value indicating whether the assembly was loaded from the global assembly cache.

Syntax
Delphi

property GlobalAssemblyCache: ClrBoolean;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

1217
.Net Runtime Library for Delphi

7.1.1.8.2.8.4.4 TClrAssembly.ImageRuntimeVersion Property


Gets a string representing the version of the common language runtime (CLR) saved in the file containing the manifest.

Syntax
Delphi

property ImageRuntimeVersion: ClrWString;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.8.4.5 TClrAssembly.Location Property


Gets the full path or UNC location of the loaded file that contains the manifest.

Syntax
Delphi

property Location: ClrWString;

See Also
TClrAssembly Class
CNClrLib.Host Namespace

7.1.1.8.2.9 TClrBaseObject Class


Collapse All Expand All

This is the base object that can store different kinds of data types.

Inheritance Hierarchy
CNClrLib.Host.TClrBaseObject

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrBaseObject = class(TClrBase);

Constructors

1218
.Net Runtime Library for Delphi

Show: Protected

No members matching the current filter

Name Description

Create(ClrVariant) Creates an instance of the TClrBaseObject Class from the specified


variant value.

Create(ClrWString) Creates a static TClrBaseObject Class from the specified type name.

Create(_ClrObject) Creates an instance of the TClrBaseObject Class from the specified


ClrObject interface value.

Create(_Type) Creates a static TClrBaseObject Class from the specified type.

Create(_Type, Creates an instance of the TClrBaseObject Class from the specified


TClrVariantDynArray) type using the constructor that best matches the specified parameters.

Create(_Type, Creates an instance of the TClrBaseObject Class from the specified


TClrVariantDynArray, type using the constructor that best matches the specified parameters
and binding flags.
TBindingFlags_Set)

Create(_Type, _ObjectArray) Creates an instance of the TClrBaseObject Class from the specified
type using the constructor that best matches the specified parameters.

Create(_Type, _ObjectArray, Creates an instance of the TClrBaseObject Class from the type using
TBindingFlags_Set) the constructor that best matches the specified parameters and
binding flags.

Destructors

Name Description

Destroy Destroys an instance of the TClrBaseObject Class.

Methods

Show: Protected

No members matching the current filter

Name Description

AsArray Converts the stored value to an Array value.

1219
.Net Runtime Library for Delphi

Name Description

AsDispatch Returns the stored IDispatch interface value.

AsPointer Returns the managed pointer of the stored


value.

AsUnknown Returns the stored IUnknown interface value.

AsVariant Converts the stored value to a Variant value.

Cast(_Type) Casts the currently stored value to another


type.

Clone Create a shallow copy of the instance.

CreateInstance Creates an instance of the TClrBaseObject Class


using the specified variant value.

Dispose Forces the execution of the destructor code in


an object.

Equals(ClrVariant) Determines whether this object and the specified


variant are equal.

Equals(TClrBaseObject) Determines whether this object and the


specified TClrBaseObject object are equal.

GetArrayElement Returns an array element if the stored value is


an array.

GetArrayElementO Returns an array element as ClrObject if the


stored value is an array.

GetArrayLength Returns the array length if the stored value is


an array.

GetDelphiObject Gets delphi object from the specified ClrObject


value if the value is used to raise an event.

GetEvent(ClrWString) Returns the EventInfo object representing the


specified public event.

GetEvent(ClrWString, TBindingFlags_Set) Returns the EventInfo object representing the


specified event, using the specified binding

1220
.Net Runtime Library for Delphi

Name Description

constraints.

GetField(ClrWString) Searches for the public field with the specified name.

GetField(ClrWString, TBindingFlags_Set) Searches for the specified field, using the specified
binding constraints.

GetFieldValue(ClrWString) Searches for the public field with the specified name
and returns the value of a field supported by a given
object.

GetFieldValue(ClrWString, Searches for the specified field, using the specified


TBindingFlags_Set) binding constraints and returns the value of a field
supported by a given object.

GetFieldValueO(ClrWString) Searches for the public field with the specified name
and returns the value of a field as ClrObject supported
by a given object.

GetFieldValueO(ClrWString, Searches for the specified field, using the specified


TBindingFlags_Set) binding constraints and returns the value of a field as
ClrObject supported by a given object.

GetGenericMethod(ClrWString, Searches for the specified public generic method


ClrWString, ClrWString) whose parameters match the specified generic and
argument types. The generic and argument paramters
accepts type names as string separated with
semicolon.

GetGenericMethod(ClrWString, Searches for the specified public generic method


TClrTypeDynArray, TClrTypeDynArray) whose parameters match the specified generic and
argument types.

GetGenericMethod(ClrWString, Searches for the specified public generic method


_TypeArray) whose parameters match the specified generic types.

GetGenericMethod(ClrWString, Searches for the specified public generic method


_TypeArray, ClrWString) whose parameters match the specified generic and
argument types. The argument paramter accepts type
names as string separated with semicolon.

GetGenericMethod(ClrWString, Searches for the specified public generic method


_TypeArray, _TypeArray) whose parameters match the specified generic and
argument types.

GetHashCode Returns the hash code for this instance.

1221
.Net Runtime Library for Delphi

Name Description

GetMethod(ClrWString) Searches for the public method with the specified


name.

GetMethod(ClrWString, ClrWString) Searches for the specified public method whose


parameters match the specified argument types. The
argument paramter accepts type names as string
separated with semicolon.

GetMethod(ClrWString, Searches for the specified public method whose


TClrTypeDynArray) parameters match the specified argument types.

GetMethod(ClrWString, _TypeArray) Searches for the specified public method whose


parameters match the specified argument types.

GetProperty(ClrWString) Searches for the public property with the specified


name.

GetProperty(ClrWString, ClrWString) Searches for the specified public property whose


parameters match the specified argument types. The
argument paramter accepts type names as string
separated with semicolon.

GetProperty(ClrWString, _TypeArray) Searches for the specified public property whose


parameters match the specified argument types.

GetPropertyValue(ClrWString) Searches for the public property with the specified


name and returns the property value of a specified
object.

GetPropertyValue(ClrWString, ClrInt32) Searches for the public property with the specified
name and returns the property index value of a
specified indexer object.

GetPropertyValue(ClrWString, ClrWString, Searches for the public property with the specified
ClrInt32) name and returns the property index value of a
specified indexer object.

GetPropertyValue(ClrWString, Searches for the public property with the specified


TClrWStringDynArray, name and returns the property index value of a
specified indexer object.
TClrVariantDynArray)

GetPropertyValue(ClrWString, Searches for the public property with the specified


_ObjectArray) name and returns the property index value of a
specified indexer object.

GetPropertyValue(ClrWString, Searches for the public property with the specified


TClrVariantDynArray) name and returns the property index value of a

1222
.Net Runtime Library for Delphi

Name Description

specified indexer object.

GetPropertyValueO(ClrWString) Searches for the public property with the specified


name and returns the property clrobject value of a
specified object.

GetPropertyValueO(ClrWString, ClrInt32) Searches for the public property with the specified
name and returns the property index clrobject value of
a specified indexer object.

GetPropertyValueO(ClrWString, Searches for the public property with the specified


ClrWString, ClrInt32) name and returns the property index clrobject value of
a specified indexer object.

GetPropertyValueO(ClrWString, Searches for the public property with the specified


TClrWStringDynArray, name and returns the property index clrobject value of
a specified indexer object.
TClrVariantDynArray)

GetPropertyValueO(ClrWString, Searches for the public property with the specified


_ObjectArray) name and returns the property index clrobject value of
a specified indexer object.

GetPropertyValueO(ClrWString, Searches for the public property with the specified


TClrVariantDynArray) name and returns the property index clrobject value of
a specified indexer object.

GetType Gets the Type of the current instance.

GetUnManagedObject Gets delphi object from the specified ClrObject


value if the value is used to raise an event.

GetUnManagedPointer Gets unmanaged pointer from the specified


ClrObject value if the value is used to raise an
event.

InvokeGenericMethod(ClrWString, Searches for the specified public generic method


ClrWString, ClrWString, whose parameters match the specified generic and
argument types and invokes the method using the
TClrVariantDynArray)
specified parameters.

InvokeGenericMethod(ClrWString, Searches for the specified public generic method


TClrTypeDynArray, TClrTypeDynArray, whose parameters match the specified generic and
argument types and invokes the method using the
TClrVariantDynArray)
specified parameters.

InvokeGenericMethod(ClrWString, Searches for the specified public generic method


whose parameters match the specified generic types

1223
.Net Runtime Library for Delphi

Name Description

_TypeArray) and invokes the method.

InvokeGenericMethod(ClrWString, Searches for the specified public generic method


_TypeArray, ClrWString, _ObjectArray) whose parameters match the specified generic and
argument types and invokes the method using the
specified parameters.

InvokeGenericMethod(ClrWString, Searches for the specified public generic method


_TypeArray, TClrWStringDynArray, whose parameters match the specified generic and
argument types and invokes the method using the
TClrVariantDynArray)
specified parameters.

InvokeGenericMethod(ClrWString, Searches for the specified public generic method


_TypeArray, _TypeArray, whose parameters match the specified generic and
argument types and invokes the method using the
TClrVariantDynArray)
specified parameters.

InvokeGenericMethod(ClrWString, Searches for the specified public generic method


_TypeArray, _TypeArray, _ObjectArray) whose parameters match the specified generic and
argument types and invokes the method using the
specified parameters.

InvokeGenericMethodO(ClrWString, Searches for the specified public generic method


ClrWString, ClrWString, whose parameters match the specified generic and
argument types and invokes the method using the
TClrVariantDynArray)
specified parameters which returns a ClrObject.

InvokeGenericMethodO(ClrWString, Searches for the specified public generic method


TClrTypeDynArray, TClrTypeDynArray, whose parameters match the specified generic and
argument types and invokes the method using the
TClrVariantDynArray)
specified parameters which returns a ClrObject.

InvokeGenericMethodO(ClrWString, Searches for the specified public generic method


_TypeArray) whose parameters match the specified generic types
and invokes the method which returns a ClrObject.

InvokeGenericMethodO(ClrWString, Searches for the specified public generic method


_TypeArray, ClrWString, _ObjectArray) whose parameters match the specified generic and
argument types and invokes the method using the
specified parameters which returns a ClrObject.

InvokeGenericMethodO(ClrWString, Searches for the specified public generic method


_TypeArray, TClrWStringDynArray, whose parameters match the specified generic and
argument types and invokes the method using the
TClrVariantDynArray)
specified parameters which returns a ClrObject.

InvokeGenericMethodO(ClrWString, Searches for the specified public generic method


_TypeArray, _TypeArray, whose parameters match the specified generic and
argument types and invokes the method using the

1224
.Net Runtime Library for Delphi

Name Description

TClrVariantDynArray) specified parameters which returns a ClrObject.

InvokeGenericMethodO(ClrWString, Searches for the specified public generic method


_TypeArray, _TypeArray, _ObjectArray) whose parameters match the specified generic and
argument types and invokes the method using the
specified parameters which returns a ClrObject.

InvokeMethod(ClrWString) Searches for the public method with the specified


name invokes the method using the specified
parameters.

InvokeMethod(ClrWString, ClrWString, Searches for the specified public method whose


TClrVariantDynArray) parameters match the specified argument types and
invokes the method using the specified parameters.
The argument paramter accepts type names as string
separated by semicolon.

InvokeMethod(ClrWString, ClrWString, Searches for the specified public method whose


TClrVariantDynArray, _ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters.
The argument paramter accepts type names as string
separated by semicolon. If the method has Ref/Out
paramater, after the invoke the values will be stored in
the object array.

InvokeMethod(ClrWString, ClrWString, Searches for the specified public method whose


_ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters.
The argument paramter accepts type names as string
separated by semicolon. If the method has Ref/Out
paramater, after the invoke the values will be stored in
the object array.

InvokeMethod(ClrWString, Searches for the specified public method whose


TClrTypeDynArray, TClrVariantDynArray) parameters match the specified argument types and
invokes the method using the specified parameters.
The argument paramter accepts type names as
dynamic array of string.

InvokeMethod(ClrWString, Searches for the specified public method whose


TClrTypeDynArray, TClrVariantDynArray, parameters match the specified argument types
andinvokes the method using the specified
_ObjectArray)
parameters. If the method has Ref/Out paramater,
after the invoke the values will be stored in the object
array.

InvokeMethod(ClrWString, Searches for the specified public method whose


TClrWStringDynArray, parameters match the specified argument types and
invokes the method using the specified parameters.
TClrVariantDynArray)
The argument paramter accepts type names as

1225
.Net Runtime Library for Delphi

Name Description

dynamic array of string.

InvokeMethod(ClrWString, Searches for the specified public method whose


TClrWStringDynArray, parameters match the specified argument types and
invokes the method using the specified parameters.
TClrVariantDynArray, _ObjectArray)
The argument paramter accepts type names as
dynamic array of string. If the method has Ref/Out
paramater, after the invoke the values will be stored in
the object array.

InvokeMethod(ClrWString, Searches for the specified public method whose


TClrWStringDynArray, _ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters.
The argument paramter accepts type names as
dynamic array of string. If the method has Ref/Out
paramater, after the invoke the values will be stored in
the object array.

InvokeMethod(ClrWString, _TypeArray, Searches for the specified public method whose


TClrVariantDynArray) parameters match the specified argument types and
invokes the method using the specified parameters.

InvokeMethod(ClrWString, _TypeArray, Searches for the specified public method whose


TClrVariantDynArray, _ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters. If
the method has Ref/Out paramater, after the invoke
the values will be stored in the object array.

InvokeMethod(ClrWString, _TypeArray, Searches for the specified public method whose


_ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters. If
the method has Ref/Out paramater, after the invoke
the values will be stored in the object array.

InvokeMethodO(ClrWString) Searches for the public method with the specified


name invokes the method using the specified
parameters which returns ClrObject value.

InvokeMethodO(ClrWString, ClrWString, Searches for the specified public method whose


TClrVariantDynArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value. The argument paramter
accepts type names as string separated by semicolon.

InvokeMethodO(ClrWString, ClrWString, Searches for the specified public method whose


TClrVariantDynArray, _ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value. The argument paramter
accepts type names as string separated by semicolon.
If the method has Ref/Out paramater, after the invoke

1226
.Net Runtime Library for Delphi

Name Description

the values will be stored in the object array.

InvokeMethodO(ClrWString, ClrWString, Searches for the specified public method whose


_ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value. The argument paramter
accepts type names as string separated by semicolon.
If the method has Ref/Out paramater, after the invoke
the values will be stored in the object array.

InvokeMethodO(ClrWString, Searches for the specified public method whose


TClrTypeDynArray, TClrVariantDynArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value. The argument paramter
accepts type names as dynamic array of string.

InvokeMethodO(ClrWString, Searches for the specified public method whose


TClrTypeDynArray, TClrVariantDynArray, parameters match the specified argument types
andinvokes the method using the specified
_ObjectArray)
parameters which returns ClrObject value. If the
method has Ref/Out paramater, after the invoke the
values will be stored in the object array.

InvokeMethodO(ClrWString, Searches for the specified public method whose


TClrWStringDynArray, parameters match the specified argument types and
invokes the method using the specified parameters.
TClrVariantDynArray)
The argument paramter accepts type names as
dynamic array of string.

InvokeMethodO(ClrWString, Searches for the specified public method whose


TClrWStringDynArray, parameters match the specified argument types and
invokes the method using the specified parameters
TClrVariantDynArray, _ObjectArray)
which returns ClrObject value. The argument paramter
accepts type names as dynamic array of string. If the
method has Ref/Out paramater, after the invoke the
values will be stored in the object array.

InvokeMethodO(ClrWString, Searches for the specified public method whose


TClrWStringDynArray, _ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value. The argument paramter
accepts type names as dynamic array of string. If the
method has Ref/Out paramater, after the invoke the
values will be stored in the object array.

InvokeMethodO(ClrWString, _TypeArray, Searches for the specified public method whose


TClrVariantDynArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value.

1227
.Net Runtime Library for Delphi

Name Description

InvokeMethodO(ClrWString, _TypeArray, Searches for the specified public method whose


TClrVariantDynArray, _ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value. If the method has
Ref/Out paramater, after the invoke the values will be
stored in the object array.

InvokeMethodO(ClrWString, _TypeArray, Searches for the specified public method whose


_ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value. If the method has
Ref/Out paramater, after the invoke the values will be
stored in the object array.

IsEnum Gets a value indicating whether the current Type


represents an enumeration.

IsInstanceOfType Determines whether the specified object is an instance


of the current Type.

IsObject Checks whether the stored value is an object


reference.

IsType(_Type) Checks whether the currently stored value can


be casted to a given type.

IsValueType Gets a value indicating whether the Type is a


value type.

RegisterEvent Registers the TClrBaseObject if a .net event is


added to the instance.

RegisterEventCallBack(ClrWString, Add an event to the instance using the


System.Pointer) specified event name and function pointer
which is the event handler. The
RegisterEventCallBack method does not
directly add the event handler to the event. A
hooking mechanism is used such that if the
event is fired, the hook event is also fired
which in turn calls the function pointer.

RegisterEventCallBack(ClrWString, Add an event to the instance using the


_Delegate) specified event name and delegate.

RegisterEventCallBackDirect(ClrWString, Add an event directly to the instance using the


System.Pointer) specified event name and function pointer
which is the event handler. The

1228
.Net Runtime Library for Delphi

Name Description

RegisterEventCallBackDirect methoddirectly
add the event handler to the event.

RegisterEventCallBackDirect(ClrWString, Add an event directly to the instance using the


_Delegate) specified event name and delegate.

SetArrayElement Sets an element in the array stored in the


TClrBaseObject instance.

SetFieldValue(ClrWString, ClrVariant) Searches for the public field with the specified name
and sets the value of a field supported by a given
object.

SetFieldValue(ClrWString, Searches for the specified field, using the specified


TBindingFlags_Set, ClrVariant) binding constraints and sets the value of a field
supported by a given object.

SetFieldValue(ClrWString, Searches for the specified field, using the specified


TBindingFlags_Set, _ClrObject) binding constraints and sets the clrobject value of a
field supported by a given object.

SetFieldValue(ClrWString, _ClrObject) Searches for the public field with the specified name
and sets the clrobject value of a field supported by a
given object.

SetPropertyValue(ClrWString, ClrInt32, Searches for the public property with the specified
ClrVariant) name and sets the property index value of a specified
indexer object.

SetPropertyValue(ClrWString, ClrInt32, Searches for the public property with the specified
_ClrObject) name and sets the property index clrobject value of a
specified indexer object.

SetPropertyValue(ClrWString, ClrVariant) Searches for the public property with the specified
name and sets the property value of a specified object.

SetPropertyValue(ClrWString, ClrWString, Searches for the public property with the specified
ClrInt32, ClrVariant) name and sets the property index value of a specified
indexer object.

SetPropertyValue(ClrWString, ClrWString, Searches for the public property with the specified
ClrInt32, _ClrObject) name and sets the property index clrobject value of a
specified indexer object.

SetPropertyValue(ClrWString, Searches for the public property with the specified


TClrVariantDynArray, ClrVariant) name and sets the property index value of a specified
indexer object.

1229
.Net Runtime Library for Delphi

Name Description

SetPropertyValue(ClrWString, Searches for the public property with the specified


TClrVariantDynArray, _ClrObject) name and sets the property index clrobject value of a
specified indexer object.

SetPropertyValue(ClrWString, Searches for the public property with the specified


TClrWStringDynArray, name and sets the property index value of a specified
indexer object.
TClrVariantDynArray, ClrVariant)

SetPropertyValue(ClrWString, Searches for the public property with the specified


TClrWStringDynArray, name and sets the property index clrobject value of a
specified indexer object.
TClrVariantDynArray, _ClrObject)

SetPropertyValue(ClrWString, Searches for the public property with the specified


TClrWStringDynArray, _ObjectArray, name and sets the property index value of a specified
indexer object.
ClrVariant)

SetPropertyValue(ClrWString, Searches for the public property with the specified


TClrWStringDynArray, _ObjectArray, name and sets the property index clrobject value of a
specified indexer object.
_ClrObject)

SetPropertyValue(ClrWString, _ClrObject) Searches for the public property with the specified
name and sets the property clrobject value of a
specified object.

SetPropertyValue(ClrWString, Searches for the public property with the specified


_ObjectArray, ClrVariant) name and sets the property index value of a specified
indexer object.

SetPropertyValue(ClrWString, Searches for the public property with the specified


_ObjectArray, _ClrObject) name and sets the property index clrobject value of a
specified indexer object.

ToString Returns a string that represents the current object.

TryCast(_Type, ClrVariant) Tries to cast the currently stored value to


another type.

UnRegisterEvent UnRegisters the TClrBaseObject if a event is


removed from the instance.

UnRegisterEventCallBack(ClrWString, Remove an event from the instance using the


System.Pointer) specified event name and function pointer which is
the event handler.

UnRegisterEventCallBack(ClrWString, Remove an event from the instance using the

1230
.Net Runtime Library for Delphi

Name Description

_Delegate) specified event name and delegate.

UnRegisterEventCallBackDirect(ClrWString, Remove an event directly from the instance using


System.Pointer) the specified event name and function pointer
which is the event handler.

UnRegisterEventCallBackDirect(ClrWString, Remove an event directly from the instance using


_Delegate) the specified event name and delegate.

Unwrap Returns the stored .net unwrapped object.

Properties

Name Description

DefaultInterface Returns the default interface of the TClrBaseObject.

Fields Gets a public field with the specified name.

IsArray Gets a value that indicates whether the type is an array.

IsGeneric Gets a value indicating whether the current type is a generic type.

IsStatic Gets a value indicating whether the current type is a static type.

Methods Gets a public method with the specified name.

Properties Gets a public property with the specified name.

TypeCode Gets the underlying type code of the instance.

See Also
Create Constructor
TClrBaseObject Methods
TClrBaseObject Properties

7.1.1.8.2.9.1 Create Constructor


This is the overview for the Create constructor overload.

Overload List

1231
.Net Runtime Library for Delphi

Show: Protected

No members matching the current filter

Name Description

TClrBaseObject.Create Creates an instance of the TClrBaseObject Class from the specified


(ClrVariant) variant value.

TClrBaseObject.Create Creates a static TClrBaseObject Class from the specified type name.
(ClrWString)

TClrBaseObject.Create Creates an instance of the TClrBaseObject Class from the specified


(_ClrObject) ClrObject interface value.

TClrBaseObject.Create Creates a static TClrBaseObject Class from the specified type.


(_Type)

TClrBaseObject.Create Creates an instance of the TClrBaseObject Class from the specified


(_Type, type using the constructor that best matches the specified parameters.

TClrVariantDynArray)

TClrBaseObject.Create Creates an instance of the TClrBaseObject Class from the specified


(_Type, type using the constructor that best matches the specified parameters
and binding flags.
TClrVariantDynArray,
TBindingFlags_Set)

TClrBaseObject.Create Creates an instance of the TClrBaseObject Class from the specified


(_Type, _ObjectArray) type using the constructor that best matches the specified parameters.

TClrBaseObject.Create Creates an instance of the TClrBaseObject Class from the type using
(_Type, _ObjectArray, the constructor that best matches the specified parameters and
binding flags.
TBindingFlags_Set)

7.1.1.8.2.9.1.1 TClrBaseObject.Create Constructor (ClrVariant)


Creates an instance of the TClrBaseObject Class from the specified variant value.

Syntax
Delphi

constructor Create(AValue: ClrVariant); overload;

See Also

1232
.Net Runtime Library for Delphi

TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.1.2 TClrBaseObject.Create Constructor (ClrWString)


Creates a static TClrBaseObject Class from the specified type name.

Syntax
Delphi

constructor Create(AStaticTypeName: ClrWString); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.1.3 TClrBaseObject.Create Constructor (_ClrObject)


Creates an instance of the TClrBaseObject Class from the specified ClrObject interface value.

Syntax
Delphi

constructor Create(AIntf: _ClrObject); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.1.4 TClrBaseObject.Create Constructor (_Type)


Creates an instance of the TClrBaseObject Class from the specified type using that type's default constructor.

Syntax
Delphi

constructor Create(AStaticType: _Type); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.1.5 TClrBaseObject.Create Constructor (_Type, TClrVariantDynArray)


Creates an instance of the TClrBaseObject Class from the specified type using the constructor that best matches the
specified parameters.

1233
.Net Runtime Library for Delphi

Syntax
Delphi

constructor Create(AType: _Type; AArguments: TClrVariantDynArray);


overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.1.6 TClrBaseObject.Create Constructor (_Type, TClrVariantDynArray,


TBindingFlags_Set)
Creates an instance of the TClrBaseObject Class from the specified type using the constructor that best matches the
specified parameters and binding flags.

Syntax
Delphi

constructor Create(AType: _Type; AArguments: TClrVariantDynArray;


ABindingAttr: TBindingFlags_Set); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.1.7 TClrBaseObject.Create Constructor (_Type, _ObjectArray)


Creates an instance of the TClrBaseObject Class from the specified type using the constructor that best matches the
specified parameters.

Syntax
Delphi

constructor Create(AType: _Type; AArguments: _ObjectArray); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.1.8 TClrBaseObject.Create Constructor (_Type, _ObjectArray,


TBindingFlags_Set)
Creates an instance of the TClrBaseObject Class from the type using the constructor that best matches the specified
parameters and binding flags.

1234
.Net Runtime Library for Delphi

Syntax
Delphi

constructor Create(AType: _Type; AArguments: _ObjectArray;


ABindingAttr: TBindingFlags_Set); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.1.9 TClrBaseObject.Create Constructor (ClrWString,


TClrVariantDynArray)
Creates an instance of the TClrBaseObject Class from the specified type name using the constructor that best matches
the specified parameters.

Syntax
Delphi

constructor Create(ATypeName: ClrWString; AArguments:


TClrVariantDynArray); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.2 TClrBaseObject.Destroy Destructor


Destroys an instance of the TClrBaseObject Class.

Syntax
Delphi

destructor Destroy; override;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3 TClrBaseObject Methods


The methods of the TClrBaseObject class are listed here.

Methods

1235
.Net Runtime Library for Delphi

Show: Protected

No members matching the current filter

Name Description

AsArray Converts the stored value to an Array value.

AsDispatch Returns the stored IDispatch interface value.

AsPointer Returns the managed pointer of the stored


value.

AsUnknown Returns the stored IUnknown interface value.

AsVariant Converts the stored value to a Variant value.

Cast(_Type) Casts the currently stored value to another


type.

Clone Create a shallow copy of the instance.

CreateInstance Creates an instance of the TClrBaseObject Class


using the specified variant value.

Dispose Forces the execution of the destructor code in


an object.

Equals(ClrVariant) Determines whether this object and the specified


variant are equal.

Equals(TClrBaseObject) Determines whether this object and the


specified TClrBaseObject object are equal.

GetArrayElement Returns an array element if the stored value is an


array.

GetArrayElementO Returns an array element as ClrObject if the stored


value is an array.

GetArrayLength Returns the array length if the stored value is an


array.

GetDelphiObject Gets delphi object from the specified ClrObject


value if the value is used to raise an event.

1236
.Net Runtime Library for Delphi

Name Description

GetEvent(ClrWString) Returns theEventInfo object representing the


specified public event.

GetEvent(ClrWString, TBindingFlags_Set) Returns the EventInfo object representing the


specified event, using the specified binding
constraints.

GetField(ClrWString) Searches for the public field with the specified name.

GetField(ClrWString, TBindingFlags_Set) Searches for the specified field, using the


specified binding constraints.

GetFieldValue(ClrWString) Searches for the public field with the specified name
and returns the value of a field supported by a given
object.

GetFieldValue(ClrWString, Searches for the specified field, using the


TBindingFlags_Set) specified binding constraints and returns the
value of a field supported by a given object.

GetFieldValueO(ClrWString) Searches for the public field with the specified name
and returns the value of a field as ClrObject supported
by a given object.

GetFieldValueO(ClrWString, Searches for the specified field, using the specified


TBindingFlags_Set) binding constraints and returns the value of a field as
ClrObject supported by a given object.

GetGenericMethod(ClrWString, Searches for the specified public generic method


ClrWString, ClrWString) whose parameters match the specified generic and
argument types. The generic and argument paramters
accepts type names as string separated with
semicolon.

GetGenericMethod(ClrWString, Searches for the specified public generic method


TClrTypeDynArray, TClrTypeDynArray) whose parameters match the specified generic and
argument types.

GetGenericMethod(ClrWString, Searches for the specified public generic method


_TypeArray) whose parameters match the specified generic types.

GetGenericMethod(ClrWString, Searches for the specified public generic method


_TypeArray, ClrWString) whose parameters match the specified generic and
argument types. The argument paramter accepts type
names as string separated with semicolon.

GetGenericMethod(ClrWString, Searches for the specified public generic method

1237
.Net Runtime Library for Delphi

Name Description

_TypeArray, _TypeArray) whose parameters match the specified generic and


argument types.

GetHashCode Returns the hash code for this instance.

GetMethod(ClrWString) Searches for the public method with the specified


name.

GetMethod(ClrWString, ClrWString) Searches for the specified public method


whose parameters match the specified
argument types. The argument paramter
accepts type names as string separated with
semicolon.

GetMethod(ClrWString, Searches for the specified public method whose


TClrTypeDynArray) parameters match the specified argument types.

GetMethod(ClrWString, _TypeArray) Searches for the specified public method whose


parameters match the specified argument types.

GetProperty(ClrWString) Searches for the public property with the specified


name.

GetProperty(ClrWString, ClrWString) Searches for the specified public property whose


parameters match the specified argument types. The
argument paramter accepts type names as string
separated with semicolon.

GetProperty(ClrWString, _TypeArray) Searches for the specified public property whose


parameters match the specified argument types.

GetPropertyValue(ClrWString) Searches for the public property with the specified


name and returns the property value of a specified
object.

GetPropertyValue(ClrWString, ClrInt32) Searches for the public property with the specified
name and returns the property index value of a
specified indexer object.

GetPropertyValue(ClrWString, ClrWString, Searches for the public property with the specified
ClrInt32) name and returns the property index value of a
specified indexer object.

GetPropertyValue(ClrWString, Searches for the public property with the specified


TClrWStringDynArray, name and returns the property index value of a
specified indexer object.
TClrVariantDynArray)

1238
.Net Runtime Library for Delphi

Name Description

GetPropertyValue(ClrWString, Searches for the public property with the specified


_ObjectArray) name and r eturns the property index value of a
specified indexer object.

GetPropertyValue(ClrWString, Searches for the public property with the


TClrVariantDynArray) specified name and r eturns the property index
value of a specified indexer object.

GetPropertyValueO(ClrWString) Searches for the public property with the specified


name and returns the property clrobject value of a
specified object.

GetPropertyValueO(ClrWString, ClrInt32) Searches for the public property with the specified
name and returns the property index clrobject value of
a specified indexer object.

GetPropertyValueO(ClrWString, Searches for the public property with the specified


ClrWString, ClrInt32) name and r eturns the property index clrobject value
of a specified indexer object.

GetPropertyValueO(ClrWString, Searches for the public property with the specified


TClrWStringDynArray, name and returns the property index clrobject value of
a specified indexer object.
TClrVariantDynArray)

GetPropertyValueO(ClrWString, Searches for the public property with the specified


_ObjectArray) name and returns the property index clrobject value of
a specified indexer object.

GetPropertyValueO(ClrWString, Searches for the public property with the specified


TClrVariantDynArray) name and r eturns the property index clrobject value
of a specified indexer object.

GetType Gets the Type of the current instance.

GetUnManagedObject Gets delphi object from the specified ClrObject


value if the value is used to raise an event.

GetUnManagedPointer Gets unmanaged pointer from the specified


ClrObject value if the value is used to raise an
event.

InvokeGenericMethod(ClrWString, Searches for the specified public generic method


ClrWString, ClrWString, whose parameters match the specified generic and
argument types and i nvokes the method using the
TClrVariantDynArray)
specified parameters.

1239
.Net Runtime Library for Delphi

Name Description

InvokeGenericMethod(ClrWString, Searches for the specified public generic method


TClrTypeDynArray, TClrTypeDynArray, whose parameters match the specified generic and
argument types and i nvokes the method using the
TClrVariantDynArray)
specified parameters.

InvokeGenericMethod(ClrWString, Searches for the specified public generic method


_TypeArray) whose parameters match the specified generic types
and i nvokes the method.

InvokeGenericMethod(ClrWString, Searches for the specified public generic method


_TypeArray, ClrWString, _ObjectArray) whose parameters match the specified generic and
argument types and i nvokes the method using the
specified parameters.

InvokeGenericMethod(ClrWString, Searches for the specified public generic method


_TypeArray, TClrWStringDynArray, whose parameters match the specified generic and
argument types and i nvokes the method using the
TClrVariantDynArray)
specified parameters.

InvokeGenericMethod(ClrWString, Searches for the specified public generic method


_TypeArray, _TypeArray, whose parameters match the specified generic and
argument types and i nvokes the method using the
TClrVariantDynArray)
specified parameters.

InvokeGenericMethod(ClrWString, Searches for the specified public generic method


_TypeArray, _TypeArray, _ObjectArray) whose parameters match the specified generic and
argument types and i nvokes the method using the
specified parameters.

InvokeGenericMethodO(ClrWString, Searches for the specified public generic method


ClrWString, ClrWString, whose parameters match the specified generic and
argument types and i nvokes the method using the
TClrVariantDynArray)
specified parameters which returns a ClrObject.

InvokeGenericMethodO(ClrWString, Searches for the specified public generic


TClrTypeDynArray, TClrTypeDynArray, method whose parameters match the specified
TClrVariantDynArray) generic and argument types and i nvokes the
method using the specified parameters which returns
a ClrObject.

InvokeGenericMethodO(ClrWString, Searches for the specified public generic method


_TypeArray) whose parameters match the specified generic types
and invokes the method which returns a ClrObject.

InvokeGenericMethodO(ClrWString, Searches for the specified public generic method


_TypeArray, ClrWString, _ObjectArray) whose parameters match the specified generic and
argument types and invokes the method using the
specified parameters which returns a ClrObject.

1240
.Net Runtime Library for Delphi

Name Description

InvokeGenericMethodO(ClrWString, Searches for the specified public generic method


_TypeArray, TClrWStringDynArray, whose parameters match the specified generic and
argument types and invokes the method using the
TClrVariantDynArray)
specified parameters which returns a ClrObject.

InvokeGenericMethodO(ClrWString, Searches for the specified public generic method


_TypeArray, _TypeArray, whose parameters match the specified generic and
argument types and invokes the method using the
TClrVariantDynArray)
specified parameters which returns a ClrObject.

InvokeGenericMethodO(ClrWString, Searches for the specified public generic method


_TypeArray, _TypeArray, _ObjectArray) whose parameters match the specified generic and
argument types and invokes the method using the
specified parameters which returns a ClrObject.

InvokeMethod(ClrWString) Searches for the public method with the specified


name invokes the method using the specified
parameters.

InvokeMethod(ClrWString, ClrWString, Searches for the specified public method whose


TClrVariantDynArray) parameters match the specified argument types and
invokes the method using the specified parameters.
The argument paramter accepts type names as string
separated by semicolon.

InvokeMethod(ClrWString, ClrWString, Searches for the specified public method whose


TClrVariantDynArray, _ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters.
The argument paramter accepts type names as string
separated by semicolon. If the method has Ref/Out
paramater, after the invoke the values will be stored in
the object array.

InvokeMethod(ClrWString, ClrWString, Searches for the specified public method whose


_ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters.
The argument paramter accepts type names as string
separated by semicolon. If the method has Ref/Out
paramater, after the invoke the values will be stored in
the object array.

InvokeMethod(ClrWString, Searches for the specified public method whose


TClrTypeDynArray, TClrVariantDynArray) parameters match the specified argument types and
invokes the method using the specified parameters.
The argument paramter accepts type names as
dynamic array of string.

InvokeMethod(ClrWString, Searches for the specified public method whose


TClrTypeDynArray, TClrVariantDynArray, parameters match the specified argument types
andinvokes the method using the specified

1241
.Net Runtime Library for Delphi

Name Description

_ObjectArray) parameters. If the method has Ref/Out paramater,


after the invoke the values will be stored in the object
array.

InvokeMethod(ClrWString, Searches for the specified public method whose


TClrWStringDynArray, parameters match the specified argument types and
invokes the method using the specified parameters.
TClrVariantDynArray)
The argument paramter accepts type names as
dynamic array of string.

InvokeMethod(ClrWString, Searches for the specified public method whose


TClrWStringDynArray, parameters match the specified argument types and
invokes the method using the specified parameters.
TClrVariantDynArray, _ObjectArray)
The argument paramter accepts type names as
dynamic array of string. If the method has Ref/Out
paramater, after the invoke the values will be stored in
the object array.

InvokeMethod(ClrWString, Searches for the specified public method whose


TClrWStringDynArray, _ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters.
The argument paramter accepts type names as
dynamic array of string. If the method has Ref/Out
paramater, after the invoke the values will be stored in
the object array.

InvokeMethod(ClrWString, _TypeArray, Searches for the specified public method whose


TClrVariantDynArray) parameters match the specified argument types and
invokes the method using the specified parameters.

InvokeMethod(ClrWString, _TypeArray, Searches for the specified public method whose


TClrVariantDynArray, _ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters. If
the method has Ref/Out paramater, after the invoke
the values will be stored in the object array.

InvokeMethod(ClrWString, _TypeArray, Searches for the specified public method whose


_ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters. If
the method has Ref/Out paramater, after the invoke
the values will be stored in the object array.

InvokeMethodO(ClrWString) Searches for the public method with the specified


name invokes the method using the specified
parameters which returns ClrObject value.

InvokeMethodO(ClrWString, ClrWString, Searches for the specified public method whose


TClrVariantDynArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value. The argument paramter

1242
.Net Runtime Library for Delphi

Name Description

accepts type names as string separated by semicolon.

InvokeMethodO(ClrWString, ClrWString, Searches for the specified public method whose


TClrVariantDynArray, _ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value. The argument paramter
accepts type names as string separated by semicolon.
If the method has Ref/Out paramater, after the invoke
the values will be stored in the object array.

InvokeMethodO(ClrWString, ClrWString, Searches for the specified public method whose


_ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value. The argument paramter
accepts type names as string separated by semicolon.
If the method has Ref/Out paramater, after the invoke
the values will be stored in the object array.

InvokeMethodO(ClrWString, Searches for the specified public method whose


TClrTypeDynArray, TClrVariantDynArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value. The argument paramter
accepts type names as dynamic array of string.

InvokeMethodO(ClrWString, Searches for the specified public method whose


TClrTypeDynArray, TClrVariantDynArray, parameters match the specified argument types
andinvokes the method using the specified
_ObjectArray)
parameters which returns ClrObject value. If the
method has Ref/Out paramater, after the invoke the
values will be stored in the object array.

InvokeMethodO(ClrWString, Searches for the specified public method whose


TClrWStringDynArray, parameters match the specified argument types and
invokes the method using the specified parameters.
TClrVariantDynArray)
The argument paramter accepts type names as
dynamic array of string.

InvokeMethodO(ClrWString, Searches for the specified public method whose


TClrWStringDynArray, parameters match the specified argument types and
invokes the method using the specified parameters
TClrVariantDynArray, _ObjectArray)
which returns ClrObject value. The argument paramter
accepts type names as dynamic array of string. If the
method has Ref/Out paramater, after the invoke the
values will be stored in the object array.

InvokeMethodO(ClrWString, Searches for the specified public method whose


TClrWStringDynArray, _ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value. The argument paramter
accepts type names as dynamic array of string. If the
method has Ref/Out paramater, after the invoke the

1243
.Net Runtime Library for Delphi

Name Description

values will be stored in the object array.

InvokeMethodO(ClrWString, _TypeArray, Searches for the specified public method whose


TClrVariantDynArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value.

InvokeMethodO(ClrWString, _TypeArray, Searches for the specified public method whose


TClrVariantDynArray, _ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value. If the method has
Ref/Out paramater, after the invoke the values will be
stored in the object array.

InvokeMethodO(ClrWString, _TypeArray, Searches for the specified public method whose


_ObjectArray) parameters match the specified argument types and
invokes the method using the specified parameters
which returns ClrObject value. If the method has
Ref/Out paramater, after the invoke the values will be
stored in the object array.

IsEnum Gets a value indicating whether the current Type


represents an enumeration.

IsInstanceOfType Determines whether the specified object is an instance


of the current Type.

IsObject Checks whether the stored value is an object


reference.

IsType(_Type) Checks whether the currently stored value can


be casted to a given type.

IsValueType Gets a value indicating whether the Type is a


value type.

RegisterEvent Registers the TClrBaseObject if a .net event is


added to the instance.

RegisterEventCallBack(ClrWString, Add a .net event to the instance using the


System.Pointer) specified event name and function pointer
which is the event handler. The
RegisterEventCallBack method does not
directly add the event handler to the event. A
hooking mechanism is used such that if the
event is fired, the hook event is also fired

1244
.Net Runtime Library for Delphi

Name Description

which in turn calls the function pointer.

RegisterEventCallBack(ClrWString, Add a .net event to the instance using the


_Delegate) specified event name and delegate.

RegisterEventCallBackDirect(ClrWString, Add a .net event directly to the instance using


System.Pointer) the specified event name and function pointer
which is the event handler. The
RegisterEventCallBackDirect methoddirectly
add the event handler to the event.

RegisterEventCallBackDirect(ClrWString, Add a .net event directly to the instance using


_Delegate) the specified event name and delegate.

SetArrayElement Sets an element in the array stored in the


TClrBaseObject instance.

SetFieldValue(ClrWString, ClrVariant) Searches for the public field with the specified name
and sets the value of a field supported by a given
object.

SetFieldValue(ClrWString, Searches for the specified field, using the specified


TBindingFlags_Set, ClrVariant) binding constraints and sets the value of a field
supported by a given object.

SetFieldValue(ClrWString, Searches for the specified field, using the specified


TBindingFlags_Set, _ClrObject) binding constraints and sets the clrobject value of a
field supported by a given object.

SetFieldValue(ClrWString, _ClrObject) Searches for the public field with the specified name
and sets the clrobject value of a field supported by a
given object.

SetPropertyValue(ClrWString, ClrInt32, Searches for the public property with the specified
ClrVariant) name and sets the property index value of a specified
indexer object.

SetPropertyValue(ClrWString, ClrInt32, Searches for the public property with the specified
_ClrObject) name and sets the property index clrobject value of a
specified indexer object.

SetPropertyValue(ClrWString, ClrVariant) Searches for the public property with the specified
name and sets the property value of a specified object.

SetPropertyValue(ClrWString, ClrWString, Searches for the public property with the specified
ClrInt32, ClrVariant) name and sets the property index value of a specified

1245
.Net Runtime Library for Delphi

Name Description

indexer object.

SetPropertyValue(ClrWString, ClrWString, Searches for the public property with the specified
ClrInt32, _ClrObject) name and sets the property index clrobject value of a
specified indexer object.

SetPropertyValue(ClrWString, Searches for the public property with the specified


TClrVariantDynArray, ClrVariant) name and sets the property index value of a specified
indexer object.

SetPropertyValue(ClrWString, Searches for the public property with the specified


TClrVariantDynArray, _ClrObject) name and sets the property index clrobject value of a
specified indexer object.

SetPropertyValue(ClrWString, Searches for the public property with the specified


TClrWStringDynArray, name and sets the property index value of a specified
indexer object.
TClrVariantDynArray, ClrVariant)

SetPropertyValue(ClrWString, Searches for the public property with the specified


TClrWStringDynArray, name and sets the property index clrobject value of a
specified indexer object.
TClrVariantDynArray, _ClrObject)

SetPropertyValue(ClrWString, Searches for the public property with the specified


TClrWStringDynArray, _ObjectArray, name and sets the property index value of a specified
indexer object.
ClrVariant)

SetPropertyValue(ClrWString, Searches for the public property with the specified


TClrWStringDynArray, _ObjectArray, name and sets the property index clrobject value of a
specified indexer object.
_ClrObject)

SetPropertyValue(ClrWString, _ClrObject) Searches for the public property with the specified
name and sets the property clrobject value of a
specified object.

SetPropertyValue(ClrWString, Searches for the public property with the specified


_ObjectArray, ClrVariant) name and sets the property index value of a specified
indexer object.

SetPropertyValue(ClrWString, Searches for the public property with the specified


_ObjectArray, _ClrObject) name and sets the property index clrobject value of a
specified indexer object.

ToString Returns a string that represents the current object.

TryCast(_Type, ClrVariant) Tries to cast the currently stored value to


another type.

1246
.Net Runtime Library for Delphi

Name Description

UnRegisterEvent UnRegisters the TClrBaseObject if a .net event is


removed from the instance.

UnRegisterEventCallBack(ClrWString, Remove a .net event from the instance using the


System.Pointer) specified event name and function pointer which is
the event handler.

UnRegisterEventCallBack(ClrWString, Remove a .net event from the instance using the


_Delegate) specified event name and delegate.

UnRegisterEventCallBackDirect(ClrWString, Remove a .net event directly from the instance


System.Pointer) using the specified event name and function
pointer which is the event handler.

UnRegisterEventCallBackDirect(ClrWString, Remove a .net event directly from the instance


_Delegate) using the specified event name and delegate.

Unwrap Returns the stored .net unwrapped object.

7.1.1.8.2.9.3.1 TClrBaseObject.AsArray Method


Converts the stored value to an Array value.

Syntax
Delphi

function AsArray: _Array;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.2 TClrBaseObject.AsDispatch Method


Returns the stored IDispatch interface value.

Syntax
Delphi

function AsDispatch: IDispatch;

See Also

1247
.Net Runtime Library for Delphi

TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.3 TClrBaseObject.AsPointer Method


Returns the managed pointer of the stored value.

Syntax
Delphi

function AsPointer: _IntPtr;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.4 TClrBaseObject.AsUnknown Method


Returns the stored IUnknown interface value.

Syntax
Delphi

function AsUnknown: IUnknown;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.5 TClrBaseObject.AsVariant Method


Converts the stored value to a Variant value.

Syntax
Delphi

function AsVariant: ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.6 TClrBaseObject.Cast Method (_Type)


Casts the currently stored value to another type.

1248
.Net Runtime Library for Delphi

Syntax
Delphi

function Cast(AType: _Type): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.7 TClrBaseObject.Clone Method


Create a shallow copy of the instance.

Syntax
Delphi

function Clone: TClrBaseObject;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.8 TClrBaseObject.CreateInstance Method


Creates an instance of the TClrBaseObject Class using the specified variant value.

Syntax
Delphi

class function CreateInstance(AIntf: OleVariant): TClrBaseObject;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.9 TClrBaseObject.Dispose Method


Forces the execution of the destructor code in an object.

Syntax
Delphi

procedure Dispose;

See Also

1249
.Net Runtime Library for Delphi

TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.10 Equals Method

This is the overview for the Equals method overload.

Overload List

Name Description

TClrBaseObject.Equals Determines whether this object and the specified variant are equal.
(ClrVariant)

TClrBaseObject.Equals Determines whether this object and the specified TClrBaseObject


(TClrBaseObject) object are equal.

7.1.1.8.2.9.3.10.1 TClrBaseObject.Equals Method (ClrVariant)

Determines whether this object and the specified variant are equal.

Syntax
Delphi

function Equals(AValue: ClrVariant): ClrBoolean; overload;


reintroduce;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.10.2 TClrBaseObject.Equals Method (TClrBaseObject)

Determines whether this object and the specified TClrBaseObject object are equal.

Syntax
Delphi

function Equals(AValue: TClrBaseObject): ClrBoolean; overload;


reintroduce;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1250
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.11 TClrBaseObject.GetArrayElement Method


Returns an array element if the stored value is an array.

Syntax
Delphi

function GetArrayElement(AIndex: ClrInt32): ClrVariant;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.12 TClrBaseObject.GetArrayElementO Method


Returns an array element as ClrObject if the stored value is an array.

Syntax
Delphi

function GetArrayElementO(AIndex: ClrInt32): _ClrObject;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.13 TClrBaseObject.GetArrayLength Method


Returns the array length if the stored value is an array.

Syntax
Delphi

function GetArrayLength: ClrInt32;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.14 TClrBaseObject.GetDelphiObject Method


Gets delphi object from the specified ClrObject value if the value is used to raise an event.

Syntax
Delphi

class function GetDelphiObject(AIntf: _ClrObject): TObject;

1251
.Net Runtime Library for Delphi

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.15 GetEvent Method

This is the overview for the GetEvent method overload.

Overload List

Name Description

TClrBaseObject.GetEvent Returns the EventInfo object representing the specified public event.
(ClrWString)

TClrBaseObject.GetEvent Returns the EventInfo object representing the specified event, using
(ClrWString, the specified binding constraints.
TBindingFlags_Set)

7.1.1.8.2.9.3.15.1 TClrBaseObject.GetEvent Method (ClrWString)

Returns the EventInfo object representing the specified public event.

Syntax
Delphi

function GetEvent(AName: ClrWString): _EventInfo; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.15.2 TClrBaseObject.GetEvent Method (ClrWString, TBindingFlags_Set)

Returns the EventInfo object representing the specified event, using the specified binding constraints.

Syntax
Delphi

function GetEvent(AName: ClrWString; ABindingAttr: TBindingFlags_Set):


_EventInfo; overload;

See Also

1252
.Net Runtime Library for Delphi

TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.16 GetField Method

This is the overview for the GetField method overload.

Overload List

Name Description

TClrBaseObject.GetField Searches for the public field with the specified name.
(ClrWString)

TClrBaseObject.GetField Searches for the specified field, using the specified binding
(ClrWString, constraints.

TBindingFlags_Set)

7.1.1.8.2.9.3.16.1 TClrBaseObject.GetField Method (ClrWString)

Searches for the public field with the specified name.

Syntax
Delphi

function GetField(AName: ClrWString): _FieldInfo; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.16.2 TClrBaseObject.GetField Method (ClrWString, TBindingFlags_Set)

Searches for the specified field, using the specified binding constraints.

Syntax
Delphi

function GetField(AName: ClrWString; ABindingAttr: TBindingFlags_Set):


_FieldInfo; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1253
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.17 GetFieldValue Method

This is the overview for the GetFieldValue method overload.

Overload List

Name Description

TClrBaseObject.GetFieldValue Searches for the public field with the specified name and returns the
(ClrWString) value of a field supported by a given object.

TClrBaseObject.GetFieldValue Searches for the specified field, using the specified binding
(ClrWString, constraints and returns the value of a field supported by a given
object.
TBindingFlags_Set)

7.1.1.8.2.9.3.17.1 TClrBaseObject.GetFieldValue Method (ClrWString)

Searches for the public field with the specified name and returns the value of a field supported by a given object.

Syntax
Delphi

function GetFieldValue(AName: ClrWString): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.17.2 TClrBaseObject.GetFieldValue Method (ClrWString, TBindingFlags_Set)

Searches for the specified field, using the specified binding constraints and returns the value of a field supported by a
given object.

Syntax
Delphi

function GetFieldValue(AName: ClrWString; ABindingAttr:


TBindingFlags_Set): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1254
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.18 GetFieldValueO Method

This is the overview for the GetFieldValueO method overload.

Overload List

Name Description

TClrBaseObject.GetFieldValueO Searches for the public field with the specified name and returns the
(ClrWString) value of a field as ClrObject supported by a given object.

TClrBaseObject.GetFieldValueO Searches for the specified field, using the specified binding
(ClrWString, TBindingFlags_Set) constraints and returns the value of a field as ClrObject supported by
a given object.

7.1.1.8.2.9.3.18.1 TClrBaseObject.GetFieldValueO Method (ClrWString)

Searches for the public field with the specified name and returns the value of a field as ClrObject supported by a given
object.

Syntax
Delphi

function GetFieldValueO(AName: ClrWString): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.18.2 TClrBaseObject.GetFieldValueO Method (ClrWString, TBindingFlags_Set)

Searches for the specified field, using the specified binding constraints and returns the value of a field as ClrObject
supported by a given object.

Syntax
Delphi

function GetFieldValueO(AName: ClrWString; ABindingAttr:


TBindingFlags_Set): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1255
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.19 GetGenericMethod Method

This is the overview for the GetGenericMethod method overload.

Overload List

Name Description

TClrBaseObject.GetGenericMethod Searches for the specified public generic method whose


(ClrWString, ClrWString, parameters match the specified generic and argument types. The
generic and argument paramters accepts type names as string
ClrWString)
separated with semicolon.

TClrBaseObject.GetGenericMethod Searches for the specified public generic method whose


(ClrWString, TClrTypeDynArray, parameters match the specified generic and argument types.

TClrTypeDynArray)

TClrBaseObject.GetGenericMethod Searches for the specified public generic method whose


(ClrWString, _TypeArray) parameters match the specified generic types.

TClrBaseObject.GetGenericMethod Searches for the specified public generic method whose


(ClrWString, _TypeArray, parameters match the specified generic and argument types. The
argument paramter accepts type names as string separated with
ClrWString)
semicolon.

TClrBaseObject.GetGenericMethod Searches for the specified public generic method whose


(ClrWString, _TypeArray, parameters match the specified generic and argument types.

_TypeArray)

7.1.1.8.2.9.3.19.1 TClrBaseObject.GetGenericMethod Method (ClrWString, ClrWString,


ClrWString)

Searches for the specified public generic method whose parameters match the specified generic and argument types.
The generic and argument paramters accepts type names as string separated with semicolon.

Syntax
Delphi

function GetGenericMethod(AMethodName: ClrWString; AGenericTypeNames:


ClrWString; AParameterTypeNames: ClrWString): _MethodInfo; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1256
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.19.2 TClrBaseObject.GetGenericMethod Method (ClrWString, TClrTypeDynArray,


TClrTypeDynArray)

Searches for the specified public generic method whose parameters match the specified generic and argument types.

Syntax
Delphi

function GetGenericMethod(AMethodName: ClrWString; AGenericTypes:


TClrTypeDynArray; AParameterTypes: TClrTypeDynArray): _MethodInfo;
overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.19.3 TClrBaseObject.GetGenericMethod Method (ClrWString, _TypeArray)

Searches for the specified public generic method whose parameters match the specified generic types.

Syntax
Delphi

function GetGenericMethod(AMethodName: ClrWString; AGenericTypes:


_TypeArray): _MethodInfo; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.19.4 TClrBaseObject.GetGenericMethod Method (ClrWString, _TypeArray,


ClrWString)

Searches for the specified public generic method whose parameters match the specified generic and argument types.
The argument paramter accepts type names as string separated with semicolon.

Syntax
Delphi

function GetGenericMethod(AMethodName: ClrWString; AGenericTypes:


_TypeArray; AParameterTypeNames: ClrWString): _MethodInfo; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1257
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.19.5 TClrBaseObject.GetGenericMethod Method (ClrWString, _TypeArray,


_TypeArray)

Searches for the specified public generic method whose parameters match the specified generic and argument types.

Syntax
Delphi

function GetGenericMethod(AMethodName: ClrWString; AGenericTypes:


_TypeArray; AParameterTypes: _TypeArray): _MethodInfo; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.20 TClrBaseObject.GetHashCode Method


Returns the hash code for this instance.

Syntax
Delphi

function GetHashCode: ClrInt32; override;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.21 GetMethod Method

This is the overview for the GetMethod method overload.

Overload List

Name Description

TClrBaseObject.GetMethod Searches for the public method with the specified name.
(ClrWString)

TClrBaseObject.GetMethod Searches for the specified public method whose parameters match the
(ClrWString, ClrWString) specified argument types. The argument paramter accepts type names
as string separated with semicolon.

TClrBaseObject.GetMethod Searches for the specified public method whose parameters match the
(ClrWString, specified argument types.

TClrTypeDynArray)

1258
.Net Runtime Library for Delphi

Name Description

TClrBaseObject.GetMethod Searches for the specified public method whose parameters match the
(ClrWString, _TypeArray) specified argument types.

7.1.1.8.2.9.3.21.1 TClrBaseObject.GetMethod Method (ClrWString)

Searches for the public method with the specified name.

Syntax
Delphi

function GetMethod(AName: ClrWString): _MethodInfo; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.21.2 TClrBaseObject.GetMethod Method (ClrWString, ClrWString)

Searches for the specified public method whose parameters match the specified argument types. The argument
paramter accepts type names as string separated with semicolon.

Syntax
Delphi

function GetMethod(AName: ClrWString; ATypeNames: ClrWString):


_MethodInfo; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.21.3 TClrBaseObject.GetMethod Method (ClrWString, TClrTypeDynArray)

Searches for the specified public method whose parameters match the specified argument types.

Syntax
Delphi

function GetMethod(AName: ClrWString; ATypes: TClrTypeDynArray):


_MethodInfo; overload;

See Also

1259
.Net Runtime Library for Delphi

TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.21.4 TClrBaseObject.GetMethod Method (ClrWString, _TypeArray)

Searches for the specified public method whose parameters match the specified argument types.

Syntax
Delphi

function GetMethod(AName: ClrWString; ATypes: _TypeArray):


_MethodInfo; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.22 GetProperty Method

This is the overview for the GetProperty method overload.

Overload List

Name Description

TClrBaseObject.GetProperty Searches for the public property with the specified name.
(ClrWString)

TClrBaseObject.GetProperty Searches for the specified public property whose parameters match
(ClrWString, ClrWString) the specified argument types. The argument paramter accepts type
names as string separated with semicolon.

TClrBaseObject.GetProperty Searches for the specified public property whose parameters match
(ClrWString, _TypeArray) the specified argument types.

7.1.1.8.2.9.3.22.1 TClrBaseObject.GetProperty Method (ClrWString)

Searches for the public property with the specified name.

Syntax
Delphi

function GetProperty(AName: ClrWString): _PropertyInfo; overload;

See Also

1260
.Net Runtime Library for Delphi

TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.22.2 TClrBaseObject.GetProperty Method (ClrWString, ClrWString)

Searches for the specified public property whose parameters match the specified argument types. The argument
paramter accepts type names as string separated with semicolon.

Syntax
Delphi

function GetProperty(AName: ClrWString; ATypeNames: ClrWString):


_PropertyInfo; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.22.3 TClrBaseObject.GetProperty Method (ClrWString, _TypeArray)

Searches for the specified public property whose parameters match the specified argument types.

Syntax
Delphi

function GetProperty(AName: ClrWString; ATypes: _TypeArray):


_PropertyInfo; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.23 GetPropertyValue Method

This is the overview for the GetPropertyValue method overload.

Overload List

Name Description

TClrBaseObject.GetPropertyValue Searches for the public property with the specified name and
(ClrWString) returns the property value of a specified object.

TClrBaseObject.GetPropertyValue Searches for the public property with the specified name and
(ClrWString, ClrInt32) returns the property index value of a specified indexer object.

1261
.Net Runtime Library for Delphi

Name Description

TClrBaseObject.GetPropertyValue Searches for the public property with the specified name and
(ClrWString, ClrWString, ClrInt32) returns the property index value of a specified indexer object.

TClrBaseObject.GetPropertyValue Searches for the public property with the specified name and
(ClrWString, returns the property index value of a specified indexer object.

TClrWStringDynArray,
TClrVariantDynArray)

TClrBaseObject.GetPropertyValue Searches for the public property with the specified name and
(ClrWString, _ObjectArray) returns the property index value of a specified indexer object.

TClrBaseObject.GetPropertyValue Searches for the public property with the specified name and
(ClrWString, returns the property index value of a specified indexer object.

TClrVariantDynArray)

7.1.1.8.2.9.3.23.1 TClrBaseObject.GetPropertyValue Method (ClrWString)

Searches for the public property with the specified name and returns the property value of a specified object.

Syntax
Delphi

function GetPropertyValue(AName: ClrWString): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.23.2 TClrBaseObject.GetPropertyValue Method (ClrWString, ClrInt32)

Searches for the public property with the specified name and returns the property index value of a specified indexer
object.

Syntax
Delphi

function GetPropertyValue(AName: ClrWString; AIndex: ClrInt32):


ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1262
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.23.3 TClrBaseObject.GetPropertyValue Method (ClrWString, ClrWString, ClrInt32)

Searches for the public property with the specified name and returns the property index value of a specified indexer
object.

Syntax
Delphi

function GetPropertyValue(AName: ClrWString; AIndexTypeName:


ClrWString; AIndex: ClrInt32): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.23.4 TClrBaseObject.GetPropertyValue Method (ClrWString,


TClrWStringDynArray, TClrVariantDynArray)

Searches for the public property with the specified name and returns the property index value of a specified indexer
object.

Syntax
Delphi

function GetPropertyValue(AName: ClrWString; AIndexTypes:


TClrWStringDynArray; AIndex: TClrVariantDynArray): ClrVariant;
overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.23.5 TClrBaseObject.GetPropertyValue Method (ClrWString, _ObjectArray)

Searches for the public property with the specified name and returns the property index value of a specified indexer
object.

Syntax
Delphi

function GetPropertyValue(AName: ClrWString; AIndex: _ObjectArray):


ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1263
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.23.6 TClrBaseObject.GetPropertyValue Method (ClrWString,


TClrVariantDynArray)

Searches for the public property with the specified name and returns the property index value of a specified indexer
object.

Syntax
Delphi

function GetPropertyValue(AName: String; AIndex: TClrVariantDynArray):


ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.24 GetPropertyValueO Method

This is the overview for the GetPropertyValueO method overload.

Overload List

Name Description

TClrBaseObject.GetPropertyValueO Searches for the public property with the specified name and
(ClrWString) returns the property clrobject value of a specified object.

TClrBaseObject.GetPropertyValueO Searches for the public property with the specified name and
(ClrWString, ClrInt32) returns the property index clrobject value of a specified indexer
object.

TClrBaseObject.GetPropertyValueO Searches for the public property with the specified name and
(ClrWString, ClrWString, ClrInt32) returns the property index clrobject value of a specified indexer
object.

TClrBaseObject.GetPropertyValueO Searches for the public property with the specified name and
(ClrWString, TClrWStringDynArray, returns the property index clrobject value of a specified indexer
object.
TClrVariantDynArray)

TClrBaseObject.GetPropertyValueO Searches for the public property with the specified name and
(ClrWString, _ObjectArray) returns the property index clrobject value of a specified indexer
object.

TClrBaseObject.GetPropertyValueO Searches for the public property with the specified name and
(String, TClrVariantDynArray) returns the property index clrobject value of a specified indexer
object.

1264
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.24.1 TClrBaseObject.GetPropertyValueO Method (ClrWString)

Searches for the public property with the specified name and returns the property clrobject value of a specified object.

Syntax
Delphi

function GetPropertyValueO(AName: ClrWString): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.24.2 TClrBaseObject.GetPropertyValueO Method (ClrWString, ClrInt32)

Searches for the public property with the specified name and returns the property index clrobject value of a specified
indexer object.

Syntax
Delphi

function GetPropertyValueO(AName: ClrWString; AIndex: ClrInt32):


_ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.24.3 TClrBaseObject.GetPropertyValueO Method (ClrWString, ClrWString,


ClrInt32)

Searches for the public property with the specified name and returns the property index clrobject value of a specified
indexer object.

Syntax
Delphi

function GetPropertyValueO(AName: ClrWString; AIndexTypeName:


ClrWString; AIndex: ClrInt32): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1265
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.24.4 TClrBaseObject.GetPropertyValueO Method (ClrWString,


TClrWStringDynArray, TClrVariantDynArray)

Searches for the public property with the specified name and returns the property index clrobject value of a specified
indexer object.

Syntax
Delphi

function GetPropertyValueO(AName: ClrWString; AIndexTypes:


TClrWStringDynArray; AIndex: TClrVariantDynArray): _ClrObject;
overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.24.5 TClrBaseObject.GetPropertyValueO Method (ClrWString, _ObjectArray)

Searches for the public property with the specified name and returns the property index clrobject value of a specified
indexer object.

Syntax
Delphi

function GetPropertyValueO(AName: ClrWString; AIndex: _ObjectArray):


_ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.24.6 TClrBaseObject.GetPropertyValueO Method (String, TClrVariantDynArray)

Searches for the public property with the specified name and returns the property index clrobject value of a specified
indexer object.

Syntax
Delphi

function GetPropertyValueO(AName: String; AIndex:


TClrVariantDynArray): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1266
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.25 TClrBaseObject.GetType Method


Gets the Type of the current instance.

Syntax
Delphi

function GetType: _Type;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.26 TClrBaseObject.GetUnManagedObject Method


Gets delphi object from the specified ClrObject value if the value is used to raise an event.

Syntax
Delphi

function GetUnManagedObject: TObject;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.27 TClrBaseObject.GetUnManagedPointer Method


Gets unmanaged pointer from the specified ClrObject value if the value is used to raise an event.

Syntax
Delphi

function GetUnManagedPointer: System;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.28 InvokeGenericMethod Method

This is the overview for the InvokeGenericMethod method overload.

Overload List

1267
.Net Runtime Library for Delphi

Name Description

TClrBaseObject.InvokeGenericMethod Searches for the specified public generic method whose


(ClrWString, ClrWString, ClrWString, parameters match the specified generic and argument types and
invokes the method using the specified parameters.
TClrVariantDynArray)

TClrBaseObject.InvokeGenericMethod Searches for the specified public generic method whose


(ClrWString, TClrTypeDynArray, parameters match the specified generic and argument types and
invokes the method using the specified parameters.
TClrTypeDynArray,
TClrVariantDynArray)

TClrBaseObject.InvokeGenericMethod Searches for the specified public generic method whose


(ClrWString, _TypeArray) parameters match the specified generic types and invokes the
method.

TClrBaseObject.InvokeGenericMethod Searches for the specified public generic method whose


(ClrWString, _TypeArray, ClrWString, parameters match the specified generic and argument types and
invokes the method using the specified parameters.
_ObjectArray)

TClrBaseObject.InvokeGenericMethod Searches for the specified public generic method whose


(ClrWString, _TypeArray, parameters match the specified generic and argument types and
invokes the method using the specified parameters.
TClrWStringDynArray,
TClrVariantDynArray)

TClrBaseObject.InvokeGenericMethod Searches for the specified public generic method whose


(ClrWString, _TypeArray, _TypeArray, parameters match the specified generic and argument types and
invokes the method using the specified parameters.
TClrVariantDynArray)

TClrBaseObject.InvokeGenericMethod Searches for the specified public generic method whose


(ClrWString, _TypeArray, _TypeArray, parameters match the specified generic and argument types and
invokes the method using the specified parameters.
_ObjectArray)

7.1.1.8.2.9.3.28.1 TClrBaseObject.InvokeGenericMethod Method (ClrWString, ClrWString,


ClrWString, TClrVariantDynArray)

Searches for the specified public generic method whose parameters match the specified generic and argument types
and invokes the method using the specified parameters.

Syntax
Delphi

function InvokeGenericMethod(AMethodName: ClrWString;


AGenericTypeNames: ClrWString; AParameterTypeNames: ClrWString;

AParameters: TClrVariantDynArray): ClrVariant; overload;

See Also

1268
.Net Runtime Library for Delphi

TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.28.2 TClrBaseObject.InvokeGenericMethod Method (ClrWString,


TClrTypeDynArray, TClrTypeDynArray, TClrVariantDynArray)

Searches for the specified public generic method whose parameters match the specified generic and argument types
and invokes the method using the specified parameters.

Syntax
Delphi

function InvokeGenericMethod(AMethodName: ClrWString; AGenericTypes:


TClrTypeDynArray; AParameterTypes: TClrTypeDynArray;

AParameters: TClrVariantDynArray): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.28.3 TClrBaseObject.InvokeGenericMethod Method (ClrWString, _TypeArray)

Searches for the specified public generic method whose parameters match the specified generic types and invokes the
method.

Syntax
Delphi

function InvokeGenericMethod(AMethodName: ClrWString; AGenericTypes:


_TypeArray): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.28.4 TClrBaseObject.InvokeGenericMethod Method (ClrWString, _TypeArray,


ClrWString, _ObjectArray)

Searches for the specified public generic method whose parameters match the specified generic and argument types
and invokes the method using the specified parameters.

Syntax
Delphi

function InvokeGenericMethod(AMethodName: ClrWString; AGenericTypes:


_TypeArray; AParameterTypeNames: ClrWString; AParameters:
_ObjectArray): ClrVariant; overload;

1269
.Net Runtime Library for Delphi

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.28.5 TClrBaseObject.InvokeGenericMethod Method (ClrWString, _TypeArray,


TClrWStringDynArray, TClrVariantDynArray)

Searches for the specified public generic method whose parameters match the specified generic and argument types
and invokes the method using the specified parameters.

Syntax
Delphi

function InvokeGenericMethod(AMethodName: ClrWString; AGenericTypes:


_TypeArray; AParameterTypeNames: TClrWStringDynArray;

AParameters: TClrVariantDynArray): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.28.6 TClrBaseObject.InvokeGenericMethod Method (ClrWString, _TypeArray,


_TypeArray, TClrVariantDynArray)

Searches for the specified public generic method whose parameters match the specified generic and argument types
and invokes the method using the specified parameters.

Syntax
Delphi

function InvokeGenericMethod(AMethodName: ClrWString; AGenericTypes:


_TypeArray; AParameterTypes: _TypeArray;

AParameters: TClrVariantDynArray): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.28.7 TClrBaseObject.InvokeGenericMethod Method (ClrWString, _TypeArray,


_TypeArray, _ObjectArray)

Searches for the specified public generic method whose parameters match the specified generic and argument types
and invokes the method using the specified parameters.

Syntax

1270
.Net Runtime Library for Delphi

Delphi

function InvokeGenericMethod(AMethodName: ClrWString; AGenericTypes:


_TypeArray; AParameterTypes: _TypeArray; AParameters: _ObjectArray):
ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.29 InvokeGenericMethodO Method

This is the overview for the InvokeGenericMethodO method overload.

Overload List

Name Description

TClrBaseObject.InvokeGenericMethodO Searches for the specified public generic method whose


(ClrWString, ClrWString, ClrWString, parameters match the specified generic and argument types
and invokes the method using the specified parameters which
TClrVariantDynArray)
returns a ClrObject.

TClrBaseObject.InvokeGenericMethodO Searches for the specified public generic method whose


(ClrWString, TClrTypeDynArray, parameters match the specified generic and argument types
and invokes the method using the specified parameters which
TClrTypeDynArray,
returns a ClrObject.
TClrVariantDynArray)

TClrBaseObject.InvokeGenericMethodO Searches for the specified public generic method whose


(ClrWString, _TypeArray) parameters match the specified generic types and invokes the
method which returns a ClrObject.

TClrBaseObject.InvokeGenericMethodO Searches for the specified public generic method whose


(ClrWString, _TypeArray, ClrWString, parameters match the specified generic and argument types
and invokes the method using the specified parameters which
_ObjectArray)
returns a ClrObject.

TClrBaseObject.InvokeGenericMethodO Searches for the specified public generic method whose


(ClrWString, _TypeArray, parameters match the specified generic and argument types
and invokes the method using the specified parameters which
TClrWStringDynArray,
returns a ClrObject.
TClrVariantDynArray)

TClrBaseObject.InvokeGenericMethodO Searches for the specified public generic method whose


(ClrWString, _TypeArray, _TypeArray, parameters match the specified generic and argument types
and invokes the method using the specified parameters which
TClrVariantDynArray)
returns a ClrObject.

TClrBaseObject.InvokeGenericMethodO Searches for the specified public generic method whose


(ClrWString, _TypeArray, _TypeArray, parameters match the specified generic and argument types

1271
.Net Runtime Library for Delphi

Name Description

_ObjectArray) and invokes the method using the specified parameters which
returns a ClrObject.

7.1.1.8.2.9.3.29.1 TClrBaseObject.InvokeGenericMethodO Method (ClrWString, ClrWString,


ClrWString, TClrVariantDynArray)

Searches for the specified public generic method whose parameters match the specified generic and argument types
and invokes the method using the specified parameters which returns a ClrObject.

Syntax
Delphi

function InvokeGenericMethodO(AMethodName: ClrWString;


AGenericTypeNames: ClrWString; AParameterTypeNames: ClrWString;

AParameters: TClrVariantDynArray): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.29.2 TClrBaseObject.InvokeGenericMethodO Method (ClrWString,


TClrTypeDynArray, TClrTypeDynArray, TClrVariantDynArray)

Searches for the specified public generic method whose parameters match the specified generic and argument types
and invokes the method using the specified parameters which returns a ClrObject.

Syntax
Delphi

function InvokeGenericMethodO(AMethodName: ClrWString; AGenericTypes:


TClrTypeDynArray; AParameterTypes: TClrTypeDynArray;

AParameters: TClrVariantDynArray): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.29.3 TClrBaseObject.InvokeGenericMethodO Method (ClrWString, _TypeArray)

Searches for the specified public generic method whose parameters match the specified generic types and invokes the
method which returns a ClrObject.

Syntax

1272
.Net Runtime Library for Delphi

Delphi

function InvokeGenericMethodO(AMethodName: ClrWString; AGenericTypes:


_TypeArray): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.29.4 TClrBaseObject.InvokeGenericMethodO Method (ClrWString, _TypeArray,


ClrWString, _ObjectArray)

Searches for the specified public generic method whose parameters match the specified generic and argument types
and invokes the method using the specified parameters which returns a ClrObject.

Syntax
Delphi

function InvokeGenericMethodO(AMethodName: ClrWString; AGenericTypes:


_TypeArray; AParameterTypeNames: ClrWString; AParameters:
_ObjectArray): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.29.5 TClrBaseObject.InvokeGenericMethodO Method (ClrWString, _TypeArray,


TClrWStringDynArray, TClrVariantDynArray)

Searches for the specified public generic method whose parameters match the specified generic and argument types
and invokes the method using the specified parameters which returns a ClrObject.

Syntax
Delphi

function InvokeGenericMethodO(AMethodName: ClrWString; AGenericTypes:


_TypeArray; AParameterTypeNames: TClrWStringDynArray;

AParameters: TClrVariantDynArray): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1273
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.29.6 TClrBaseObject.InvokeGenericMethodO Method (ClrWString, _TypeArray,


_TypeArray, TClrVariantDynArray)

Searches for the specified public generic method whose parameters match the specified generic and argument types
and invokes the method using the specified parameters which returns a ClrObject.

Syntax
Delphi

function InvokeGenericMethodO(AMethodName: ClrWString; AGenericTypes:


_TypeArray; AParameterTypes: _TypeArray;

AParameters: TClrVariantDynArray): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.29.7 TClrBaseObject.InvokeGenericMethodO Method (ClrWString, _TypeArray,


_TypeArray, _ObjectArray)

Searches for the specified public generic method whose parameters match the specified generic and argument types
and invokes the method using the specified parameters which returns a ClrObject.

Syntax
Delphi

function InvokeGenericMethodO(AMethodName: ClrWString; AGenericTypes:


_TypeArray; AParameterTypes: _TypeArray; AParameters: _ObjectArray):
_ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.30 InvokeMethod Method

This is the overview for the InvokeMethod method overload.

Overload List

Name Description

TClrBaseObject.InvokeMethod Searches for the public method with the specified name invokes the
(ClrWString) method using the specified parameters.

TClrBaseObject.InvokeMethod Searches for the specified public method whose parameters match
the specified argument types and invokes the method using the

1274
.Net Runtime Library for Delphi

Name Description

(ClrWString, ClrWString, specified parameters. The argument paramter accepts type names as
TClrVariantDynArray) string separated by semicolon.

TClrBaseObject.InvokeMethod Searches for the specified public method whose parameters match
(ClrWString, ClrWString, the specified argument types and invokes the method using the
specified parameters. The argument paramter accepts type names as
TClrVariantDynArray,
string separated by semicolon. If the method has Ref/Out paramater,
_ObjectArray)
after the invoke the values will be stored in the object array.

TClrBaseObject.InvokeMethod Searches for the specified public method whose parameters match
(ClrWString, ClrWString, the specified argument types and invokes the method using the
specified parameters. The argument paramter accepts type names as
_ObjectArray)
string separated by semicolon. If the method has Ref/Out paramater,
after the invoke the values will be stored in the object array.

TClrBaseObject.InvokeMethod Searches for the specified public method whose parameters match
(ClrWString, the specified argument types and invokes the method using the
specified parameters. The argument paramter accepts type names as
TClrTypeDynArray,
dynamic array of string.
TClrVariantDynArray)

TClrBaseObject.InvokeMethod Searches for the specified public method whose parameters match
(ClrWString, the specified argument types andinvokes the method using the
specified parameters. If the method has Ref/Out paramater, after the
TClrTypeDynArray,
invoke the values will be stored in the object array.
TClrVariantDynArray,
_ObjectArray)

TClrBaseObject.InvokeMethod Searches for the specified public method whose parameters match
(ClrWString, the specified argument types and invokes the method using the
specified parameters. The argument paramter accepts type names as
TClrWStringDynArray,
dynamic array of string.
TClrVariantDynArray)

TClrBaseObject.InvokeMethod Searches for the specified public method whose parameters match
(ClrWString, the specified argument types and invokes the method using the
specified parameters. The argument paramter accepts type names as
TClrWStringDynArray,
dynamic array of string. If the method has Ref/Out paramater, after
TClrVariantDynArray,
the invoke the values will be stored in the object array.
_ObjectArray)

TClrBaseObject.InvokeMethod Searches for the specified public method whose parameters match
(ClrWString, the specified argument types and invokes the method using the
specified parameters. The argument paramter accepts type names as
TClrWStringDynArray,
dynamic array of string. If the method has Ref/Out paramater, after
_ObjectArray)
the invoke the values will be stored in the object array.

TClrBaseObject.InvokeMethod Searches for the specified public method whose parameters match
(ClrWString, _TypeArray, the specified argument types and invokes the method using the
specified parameters.
TClrVariantDynArray)

1275
.Net Runtime Library for Delphi

Name Description

TClrBaseObject.InvokeMethod Searches for the specified public method whose parameters match
(ClrWString, _TypeArray, the specified argument types and invokes the method using the
specified parameters. If the method has Ref/Out paramater, after the
TClrVariantDynArray,
invoke the values will be stored in the object array.
_ObjectArray)

TClrBaseObject.InvokeMethod Searches for the specified public method whose parameters match
(ClrWString, _TypeArray, the specified argument types and invokes the method using the
specified parameters. If the method has Ref/Out paramater, after the
_ObjectArray)
invoke the values will be stored in the object array.

7.1.1.8.2.9.3.30.1 TClrBaseObject.InvokeMethod Method (ClrWString)

Searches for the public method with the specified name invokes the method using the specified parameters.

Syntax
Delphi

function InvokeMethod(AName: ClrWString): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.30.2 TClrBaseObject.InvokeMethod Method (ClrWString, ClrWString,


TClrVariantDynArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters. The argument paramter accepts type names as string separated by semicolon.

Syntax
Delphi

function InvokeMethod(AName: ClrWString; ATypeNames: ClrWString;


AParameters: TClrVariantDynArray): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1276
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.30.3 TClrBaseObject.InvokeMethod Method (ClrWString, ClrWString,


TClrVariantDynArray, _ObjectArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters. The argument paramter accepts type names as string separated by semicolon.
If the method has Ref/Out paramater, after the invoke the values will be stored in the object array.

Syntax
Delphi

function InvokeMethod(AName: ClrWString; ATypeNames: ClrWString;


AParameters: TClrVariantDynArray; var AVarParams: _ObjectArray):
ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.30.4 TClrBaseObject.InvokeMethod Method (ClrWString, ClrWString,


_ObjectArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters. The argument paramter accepts type names as string separated by semicolon.
If the method has Ref/Out paramater, after the invoke the values will be stored in the object array.

Syntax
Delphi

function InvokeMethod(AName: ClrWString; ATypeNames: ClrWString; var


AParameters: _ObjectArray): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.30.5 TClrBaseObject.InvokeMethod Method (ClrWString, TClrTypeDynArray,


TClrVariantDynArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters. The argument paramter accepts type names as dynamic array of string.

Syntax
Delphi

function InvokeMethod(AName: ClrWString; ATypes: TClrTypeDynArray;


AParameters: TClrVariantDynArray): ClrVariant; overload;

See Also

1277
.Net Runtime Library for Delphi

TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.30.6 TClrBaseObject.InvokeMethod Method (ClrWString, TClrTypeDynArray,


TClrVariantDynArray, _ObjectArray)

Searches for the specified public method whose parameters match the specified argument types andinvokes the
method using the specified parameters. If the method has Ref/Out paramater, after the invoke the values will be stored
in the object array.

Syntax
Delphi

function InvokeMethod(AName: ClrWString; ATypes: TClrTypeDynArray;


AParameters: TClrVariantDynArray; var AVarParams: _ObjectArray):
ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.30.7 TClrBaseObject.InvokeMethod Method (ClrWString, TClrWStringDynArray,


TClrVariantDynArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters. The argument paramter accepts type names as dynamic array of string.

Syntax
Delphi

function InvokeMethod(AName: ClrWString; ATypeNames:


TClrWStringDynArray; AParameters: TClrVariantDynArray): ClrVariant;
overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.30.8 TClrBaseObject.InvokeMethod Method (ClrWString, TClrWStringDynArray,


TClrVariantDynArray, _ObjectArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters. The argument paramter accepts type names as dynamic array of string. If the
method has Ref/Out paramater, after the invoke the values will be stored in the object array.

Syntax
Delphi

1278
.Net Runtime Library for Delphi

function InvokeMethod(AName: ClrWString; ATypeNames:


TClrWStringDynArray; AParameters: TClrVariantDynArray; var AVarParams:
_ObjectArray): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.30.9 TClrBaseObject.InvokeMethod Method (ClrWString, TClrWStringDynArray,


_ObjectArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters. The argument paramter accepts type names as dynamic array of string. If the
method has Ref/Out paramater, after the invoke the values will be stored in the object array.

Syntax
Delphi

function InvokeMethod(AName: ClrWString; ATypeNames:


TClrWStringDynArray; var AParameters: _ObjectArray): ClrVariant;
overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.30.10 TClrBaseObject.InvokeMethod Method (ClrWString, _TypeArray,


TClrVariantDynArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters.

Syntax
Delphi

function InvokeMethod(AName: ClrWString; ATypes: _TypeArray;


AParameters: TClrVariantDynArray): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.30.11 TClrBaseObject.InvokeMethod Method (ClrWString, _TypeArray,


TClrVariantDynArray, _ObjectArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters. If the method has Ref/Out paramater, after the invoke the values will be stored
in the object array.

1279
.Net Runtime Library for Delphi

Syntax
Delphi

function InvokeMethod(AName: ClrWString; ATypes: _TypeArray;


AParameters: TClrVariantDynArray; var AVarParams: _ObjectArray):
ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.30.12 TClrBaseObject.InvokeMethod Method (ClrWString, _TypeArray,


_ObjectArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters. If the method has Ref/Out paramater, after the invoke the values will be stored
in the object array.

Syntax
Delphi

function InvokeMethod(AName: ClrWString; ATypes: _TypeArray; var


AParameters: _ObjectArray): ClrVariant; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.31 InvokeMethodO Method

This is the overview for the InvokeMethodO method overload.

Overload List

Name Description

TClrBaseObject.InvokeMethodO Searches for the public method with the specified name invokes the
(ClrWString) method using the specified parameterswhich returns ClrObject
value.

TClrBaseObject.InvokeMethodO Searches for the specified public method whose parameters match
(ClrWString, ClrWString, the specified argument types and invokes the method using the
specified parameters which returns ClrObject value. The argument
TClrVariantDynArray)
paramter accepts type names as string separated by semicolon.

TClrBaseObject.InvokeMethodO Searches for the specified public method whose parameters match
(ClrWString, ClrWString, the specified argument types and invokes the method using the

1280
.Net Runtime Library for Delphi

Name Description

TClrVariantDynArray, specified parameters which returns ClrObject value. The argument


_ObjectArray) paramter accepts type names as string separated by semicolon. If
the method has Ref/Out paramater, after the invoke the values will
be stored in the object array.

TClrBaseObject.InvokeMethodO Searches for the specified public method whose parameters match
(ClrWString, ClrWString, the specified argument types and invokes the method using the
specified parameters which returns ClrObject value. The argument
_ObjectArray)
paramter accepts type names as string separated by semicolon. If
the method has Ref/Out paramater, after the invoke the values will
be stored in the object array.

TClrBaseObject.InvokeMethodO Searches for the specified public method whose parameters match
(ClrWString, TClrTypeDynArray, the specified argument types and invokes the method using the
specified parameters which returns ClrObject value. The argument
TClrVariantDynArray)
paramter accepts type names as dynamic array of string.

TClrBaseObject.InvokeMethodO Searches for the specified public method whose parameters match
(ClrWString, TClrTypeDynArray, the specified argument types andinvokes the method using the
specified parameters which returns ClrObject value. If the method
TClrVariantDynArray,
has Ref/Out paramater, after the invoke the values will be stored in
_ObjectArray)
the object array.

TClrBaseObject.InvokeMethodO Searches for the specified public method whose parameters match
(ClrWString, the specified argument types and invokes the method using the
specified parameters. The argument paramter accepts type names as
TClrWStringDynArray,
dynamic array of string.
TClrVariantDynArray)

TClrBaseObject.InvokeMethodO Searches for the specified public method whose parameters match
(ClrWString, the specified argument types and invokes the method using the
specified parameters which returns ClrObject value. The argument
TClrWStringDynArray,
paramter accepts type names as dynamic array of string. If the
TClrVariantDynArray,
method has Ref/Out paramater, after the invoke the values will be
_ObjectArray) stored in the object array.

TClrBaseObject.InvokeMethodO Searches for the specified public method whose parameters match
(ClrWString, the specified argument types and invokes the method using the
specified parameters which returns ClrObject value. The argument
TClrWStringDynArray,
paramter accepts type names as dynamic array of string. If the
_ObjectArray)
method has Ref/Out paramater, after the invoke the values will be
stored in the object array.

TClrBaseObject.InvokeMethodO Searches for the specified public method whose parameters match
(ClrWString, _TypeArray, the specified argument types and invokes the method using the
specified parameters which returns ClrObject value.
TClrVariantDynArray)

TClrBaseObject.InvokeMethodO Searches for the specified public method whose parameters match
(ClrWString, _TypeArray, the specified argument types and invokes the method using the
specified parameters which returns ClrObject value. If the method
TClrVariantDynArray,

1281
.Net Runtime Library for Delphi

Name Description

_ObjectArray) has Ref/Out paramater, after the invoke the values will be stored in
the object array.

TClrBaseObject.InvokeMethodO Searches for the specified public method whose parameters match
(ClrWString, _TypeArray, the specified argument types and invokes the method using the
specified parameters which returns ClrObject value. If the method
_ObjectArray)
has Ref/Out paramater, after the invoke the values will be stored in
the object array.

7.1.1.8.2.9.3.31.1 TClrBaseObject.InvokeMethodO Method (ClrWString)

Searches for the public method with the specified name invokes the method using the specified parameterswhich
returns ClrObject value.

Syntax
Delphi

function InvokeMethodO(AName: ClrWString): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.31.2 TClrBaseObject.InvokeMethodO Method (ClrWString, ClrWString,


TClrVariantDynArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters which returns ClrObject value. The argument paramter accepts type names as
string separated by semicolon.

Syntax
Delphi

function InvokeMethodO(AName: ClrWString; ATypeNames: ClrWString;


AParameters: TClrVariantDynArray): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.31.3 TClrBaseObject.InvokeMethodO Method (ClrWString, ClrWString,


TClrVariantDynArray, _ObjectArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters which returns ClrObject value. The argument paramter accepts type names as

1282
.Net Runtime Library for Delphi

string separated by semicolon. If the method has Ref/Out paramater, after the invoke the values will be stored in the
object array.

Syntax
Delphi

function InvokeMethodO(AName: ClrWString; ATypeNames: ClrWString;


AParameters: TClrVariantDynArray; var AVarParams: _ObjectArray):
_ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.31.4 TClrBaseObject.InvokeMethodO Method (ClrWString, ClrWString,


_ObjectArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters which returns ClrObject value. The argument paramter accepts type names as
string separated by semicolon. If the method has Ref/Out paramater, after the invoke the values will be stored in the
object array.

Syntax
Delphi

function InvokeMethodO(AName: ClrWString; ATypeNames: ClrWString; var


AParameters: _ObjectArray): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.31.5 TClrBaseObject.InvokeMethodO Method (ClrWString, TClrTypeDynArray,


TClrVariantDynArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters which returns ClrObject value. The argument paramter accepts type names as
dynamic array of string.

Syntax
Delphi

function InvokeMethodO(AName: ClrWString; ATypes: TClrTypeDynArray;


AParameters: TClrVariantDynArray): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1283
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.31.6 TClrBaseObject.InvokeMethodO Method (ClrWString, TClrTypeDynArray,


TClrVariantDynArray, _ObjectArray)

Searches for the specified public method whose parameters match the specified argument types andinvokes the
method using the specified parameters which returns ClrObject value. If the method has Ref/Out paramater, after the
invoke the values will be stored in the object array.

Syntax
Delphi

function InvokeMethodO(AName: ClrWString; ATypes: TClrTypeDynArray;


AParameters: TClrVariantDynArray; var AVarParams: _ObjectArray):
_ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.31.7 TClrBaseObject.InvokeMethodO Method (ClrWString, TClrWStringDynArray,


TClrVariantDynArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters. The argument paramter accepts type names as dynamic array of string.

Syntax
Delphi

function InvokeMethodO(AName: ClrWString; ATypeNames:


TClrWStringDynArray; AParameters: TClrVariantDynArray): _ClrObject;
overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.31.8 TClrBaseObject.InvokeMethodO Method (ClrWString, TClrWStringDynArray,


TClrVariantDynArray, _ObjectArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters which returns ClrObject value. The argument paramter accepts type names as
dynamic array of string. If the method has Ref/Out paramater, after the invoke the values will be stored in the object
array.

Syntax
Delphi

function InvokeMethodO(AName: ClrWString; ATypeNames:


TClrWStringDynArray; AParameters: TClrVariantDynArray; var AVarParams:
_ObjectArray): _ClrObject; overload;

1284
.Net Runtime Library for Delphi

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.31.9 TClrBaseObject.InvokeMethodO Method (ClrWString, TClrWStringDynArray,


_ObjectArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters which returns ClrObject value. The argument paramter accepts type names as
dynamic array of string. If the method has Ref/Out paramater, after the invoke the values will be stored in the object
array.

Syntax
Delphi

function InvokeMethodO(AName: ClrWString; ATypeNames:


TClrWStringDynArray; var AParameters: _ObjectArray): _ClrObject;
overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.31.10 TClrBaseObject.InvokeMethodO Method (ClrWString, _TypeArray,


TClrVariantDynArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters which returns ClrObject value.

Syntax
Delphi

function InvokeMethodO(AName: ClrWString; ATypes: _TypeArray;


AParameters: TClrVariantDynArray): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.31.11 TClrBaseObject.InvokeMethodO Method (ClrWString, _TypeArray,


TClrVariantDynArray, _ObjectArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters which returns ClrObject value. If the method has Ref/Out paramater, after the
invoke the values will be stored in the object array.

Syntax

1285
.Net Runtime Library for Delphi

Delphi

function InvokeMethodO(AName: ClrWString; ATypes: _TypeArray;


AParameters: TClrVariantDynArray; var AVarParams: _ObjectArray):
_ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.31.12 TClrBaseObject.InvokeMethodO Method (ClrWString, _TypeArray,


_ObjectArray)

Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters which returns ClrObject value. If the method has Ref/Out paramater, after the
invoke the values will be stored in the object array.

Syntax
Delphi

function InvokeMethodO(AName: ClrWString; ATypes: _TypeArray; var


AParameters: _ObjectArray): _ClrObject; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.32 TClrBaseObject.IsEnum Method


Gets a value indicating whether the current Type represents an enumeration.

Syntax
Delphi

function IsEnum: ClrBoolean;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.33 TClrBaseObject.IsInstanceOfType Method


Determines whether the specified object is an instance of the current Type.

Syntax
Delphi

1286
.Net Runtime Library for Delphi

function IsInstanceOfType(AObject: ClrVariant): ClrBoolean;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.34 TClrBaseObject.IsObject Method


Checks whether the stored value is an object reference.

Syntax
Delphi

function IsObject: ClrBoolean;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.35 TClrBaseObject.IsType Method (_Type)


Checks whether the currently stored value can be casted to a given type.

Syntax
Delphi

function IsType(AType: _Type): ClrBoolean; overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.36 TClrBaseObject.IsValueType Method


Gets a value indicating whether the Type is a value type.

Syntax
Delphi

function IsValueType: ClrBoolean;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1287
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.37 TClrBaseObject.RegisterEvent Method


Registers the TClrBaseObject if a .net event is added to the instance.

Syntax
Delphi

procedure RegisterEvent;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.38 RegisterEventCallBack Method

This is the overview for the RegisterEventCallBack method overload.

Overload List

Name Description

TClrBaseObject.RegisterEventCallBack Add an event to the instance using the specified event name
(ClrWString, System.Pointer) and function pointer which is the event handler. The
RegisterEventCallBack method does not directly add the
event handler to the event. A hooking mechanism is used
such that if the event is fired, the hook event is also fired
which in turn calls the function pointer.

TClrBaseObject.RegisterEventCallBack Add an event to the instance using the specified event name
(ClrWString, _Delegate) and delegate.

7.1.1.8.2.9.3.38.1 TClrBaseObject.RegisterEventCallBack Method (ClrWString, System.Pointer)

Add an event to the instance using the specified event name and function pointer which is the event handler.
The RegisterEventCallBack method does not directly add the event handler to the event. A hooking mechanism is
used such that if the event is fired, the hook event is also fired which in turn calls the function pointer.

Syntax
Delphi

procedure RegisterEventCallBack(AEventName: ClrWString;


AFunctionPointer: System.Pointer); overload;

See Also

1288
.Net Runtime Library for Delphi

TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.38.2 TClrBaseObject.RegisterEventCallBack Method (ClrWString, _Delegate)

Add an event to the instance using the specified event name and delegate.

Syntax
Delphi

procedure RegisterEventCallBack(AEventName: ClrWString; AEventHandler:


_Delegate); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.39 RegisterEventCallBackDirect Method

This is the overview for the RegisterEventCallBackDirect method overload.

Overload List

Name Description

TClrBaseObject.RegisterEventCallBackDirect Add an event directly to the instance using the


(ClrWString, System.Pointer) specified event name and function pointer which is
the event handler. The RegisterEventCallBackDirect
methoddirectly add the event handler to the event.

TClrBaseObject.RegisterEventCallBackDirect Add an event directly to the instance using the


(ClrWString, _Delegate) specified event name and delegate.

7.1.1.8.2.9.3.39.1 TClrBaseObject.RegisterEventCallBackDirect Method (ClrWString,


System.Pointer)

Add an event directly to the instance using the specified event name and function pointer which is the event
handler. The RegisterEventCallBackDirect methoddirectly add the event handler to the event.

Syntax
Delphi

procedure RegisterEventCallBackDirect(AEventName: ClrWString;


AFunctionPointer: System.Pointer); overload;

See Also

1289
.Net Runtime Library for Delphi

TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.39.2 TClrBaseObject.RegisterEventCallBackDirect Method (ClrWString, _Delegate)

Add an event directly to the instance using the specified event name and delegate.

Syntax
Delphi

procedure RegisterEventCallBackDirect(AEventName: ClrWString;


AEventHandler: _Delegate); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.40 TClrBaseObject.SetArrayElement Method


Sets an element in the array stored in the TClrBaseObject instance.

Syntax
Delphi

procedure SetArrayElement(AIndex: ClrInt32; AValue: ClrVariant);

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.41 SetFieldValue Method

This is the overview for the SetFieldValue method overload.

Overload List

Name Description

TClrBaseObject.SetFieldValue Searches for the public field with the specified name and sets the
(ClrWString, ClrVariant) value of a field supported by a given object.

TClrBaseObject.SetFieldValue Searches for the specified field, using the specified binding constraints
(ClrWString, and sets the value of a field supported by a given object.

TBindingFlags_Set,
ClrVariant)

1290
.Net Runtime Library for Delphi

Name Description

TClrBaseObject.SetFieldValue Searches for the specified field, using the specified binding constraints
(ClrWString, and sets the clrobject value of a field supported by a given object.

TBindingFlags_Set,
_ClrObject)

TClrBaseObject.SetFieldValue Searches for the public field with the specified name and sets the
(ClrWString, _ClrObject) clrobject value of a field supported by a given object.

7.1.1.8.2.9.3.41.1 TClrBaseObject.SetFieldValue Method (ClrWString, ClrVariant)

Searches for the public field with the specified name and sets the value of a field supported by a given object.

Syntax
Delphi

procedure SetFieldValue(AName: ClrWString; AValue: ClrVariant);


overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.41.2 TClrBaseObject.SetFieldValue Method (ClrWString, TBindingFlags_Set,


ClrVariant)

Searches for the specified field, using the specified binding constraints and sets the value of a field supported by a
given object.

Syntax
Delphi

procedure SetFieldValue(AName: ClrWString; ABindingAttr:


TBindingFlags_Set; AValue: ClrVariant); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.41.3 TClrBaseObject.SetFieldValue Method (ClrWString, TBindingFlags_Set,


_ClrObject)

Searches for the specified field, using the specified binding constraints and sets the clrobject value of a field supported
by a given object.

1291
.Net Runtime Library for Delphi

Syntax
Delphi

procedure SetFieldValue(AName: ClrWString; ABindingAttr:


TBindingFlags_Set; AValue: _ClrObject); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.41.4 TClrBaseObject.SetFieldValue Method (ClrWString, _ClrObject)

Searches for the public field with the specified name and sets the clrobject value of a field supported by a given object.

Syntax
Delphi

procedure SetFieldValue(AName: ClrWString; AValue: _ClrObject);


overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.42 SetPropertyValue Method

This is the overview for the SetPropertyValue method overload.

Overload List

Name Description

TClrBaseObject.SetPropertyValue Searches for the public property with the specified name and sets
(ClrWString, ClrInt32, ClrVariant) the property index value of a specified indexer object.

TClrBaseObject.SetPropertyValue Searches for the public property with the specified name and sets
(ClrWString, ClrInt32, _ClrObject) the property index clrobject value of a specified indexer object.

TClrBaseObject.SetPropertyValue Searches for the public property with the specified name and sets
(ClrWString, ClrVariant) the property value of a specified object.

TClrBaseObject.SetPropertyValue Searches for the public property with the specified name and sets
(ClrWString, ClrWString, ClrInt32, the property index value of a specified indexer object.

ClrVariant)

1292
.Net Runtime Library for Delphi

Name Description

TClrBaseObject.SetPropertyValue Searches for the public property with the specified name and sets
(ClrWString, ClrWString, ClrInt32, the property index clrobject value of a specified indexer object.

_ClrObject)

TClrBaseObject.SetPropertyValue Searches for the public property with the specified name and sets
(ClrWString, the property index value of a specified indexer object.

TClrVariantDynArray, ClrVariant)

TClrBaseObject.SetPropertyValue Searches for the public property with the specified name and sets
(ClrWString, the property index clrobject value of a specified indexer object.

TClrVariantDynArray, _ClrObject)

TClrBaseObject.SetPropertyValue Searches for the public property with the specified name and sets
(ClrWString, the property index value of a specified indexer object.

TClrWStringDynArray,
TClrVariantDynArray, ClrVariant)

TClrBaseObject.SetPropertyValue Searches for the public property with the specified name and sets
(ClrWString, the property index clrobject value of a specified indexer object.

TClrWStringDynArray,
TClrVariantDynArray, _ClrObject)

TClrBaseObject.SetPropertyValue Searches for the public property with the specified name and sets
(ClrWString, the property index value of a specified indexer object.

TClrWStringDynArray,
_ObjectArray, ClrVariant)

TClrBaseObject.SetPropertyValue Searches for the public property with the specified name and sets
(ClrWString, the property index clrobject value of a specified indexer object.

TClrWStringDynArray,
_ObjectArray, _ClrObject)

TClrBaseObject.SetPropertyValue Searches for the public property with the specified name and sets
(ClrWString, _ClrObject) the property clrobject value of a specified object.

TClrBaseObject.SetPropertyValue Searches for the public property with the specified name and sets
(ClrWString, _ObjectArray, the property index value of a specified indexer object.

ClrVariant)

TClrBaseObject.SetPropertyValue Searches for the public property with the specified name and sets
(ClrWString, _ObjectArray, the property index clrobject value of a specified indexer object.

_ClrObject)

1293
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.42.1 TClrBaseObject.SetPropertyValue Method (ClrWString, ClrInt32, ClrVariant)

Searches for the public property with the specified name and sets the property index value of a specified indexer object.

Syntax
Delphi

procedure SetPropertyValue(AName: ClrWString; AIndex: ClrInt32;


AValue: ClrVariant); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.42.2 TClrBaseObject.SetPropertyValue Method (ClrWString, ClrInt32, _ClrObject)

Searches for the public property with the specified name and sets the property index clrobject value of a specified
indexer object.

Syntax
Delphi

procedure SetPropertyValue(AName: ClrWString; AIndex: ClrInt32;


AValue: _ClrObject); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.42.3 TClrBaseObject.SetPropertyValue Method (ClrWString, ClrVariant)

Searches for the public property with the specified name and sets the property value of a specified object.

Syntax
Delphi

procedure SetPropertyValue(AName: ClrWString; AValue: ClrVariant);


overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.42.4 TClrBaseObject.SetPropertyValue Method (ClrWString, ClrWString, ClrInt32,


ClrVariant)

Searches for the public property with the specified name and sets the property index value of a specified indexer object.

1294
.Net Runtime Library for Delphi

Syntax
Delphi

procedure SetPropertyValue(AName: ClrWString; AIndexTypeName:


ClrWString; AIndex: ClrInt32; AValue: ClrVariant); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.42.5 TClrBaseObject.SetPropertyValue Method (ClrWString, ClrWString, ClrInt32,


_ClrObject)

Searches for the public property with the specified name and sets the property index clrobject value of a specified
indexer object.

Syntax
Delphi

procedure SetPropertyValue(AName: ClrWString; AIndexTypeName:


ClrWString; AIndex: ClrInt32; AValue: _ClrObject); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.42.6 TClrBaseObject.SetPropertyValue Method (ClrWString, TClrVariantDynArray,


ClrVariant)

Searches for the public property with the specified name and sets the property index value of a specified indexer object.

Syntax
Delphi

procedure SetPropertyValue(AName: ClrWString; AIndex:


TClrVariantDynArray; AValue: ClrVariant); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.42.7 TClrBaseObject.SetPropertyValue Method (ClrWString, TClrVariantDynArray,


_ClrObject)

Searches for the public property with the specified name and sets the property index clrobject value of a specified
indexer object.

1295
.Net Runtime Library for Delphi

Syntax
Delphi

procedure SetPropertyValue(AName: ClrWString; AIndex:


TClrVariantDynArray; AValue: _ClrObject); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.42.8 TClrBaseObject.SetPropertyValue Method (ClrWString,


TClrWStringDynArray, TClrVariantDynArray, ClrVariant)

Searches for the public property with the specified name and sets the property index value of a specified indexer object.

Syntax
Delphi

procedure SetPropertyValue(AName: ClrWString; AIndexTypes:


TClrWStringDynArray; AIndex: TClrVariantDynArray; AValue: ClrVariant);
overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.42.9 TClrBaseObject.SetPropertyValue Method (ClrWString,


TClrWStringDynArray, TClrVariantDynArray, _ClrObject)

Searches for the public property with the specified name and sets the property index clrobject value of a specified
indexer object.

Syntax
Delphi

procedure SetPropertyValue(AName: ClrWString; AIndexTypes:


TClrWStringDynArray; AIndex: TClrVariantDynArray; AValue: _ClrObject);
overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1296
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.42.10 TClrBaseObject.SetPropertyValue Method (ClrWString,


TClrWStringDynArray, _ObjectArray, ClrVariant)

Searches for the public property with the specified name and sets the property index value of a specified indexer object.

Syntax
Delphi

procedure SetPropertyValue(AName: ClrWString; AIndexTypes:


TClrWStringDynArray; AIndex: _ObjectArray; AValue: ClrVariant);
overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.42.11 TClrBaseObject.SetPropertyValue Method (ClrWString,


TClrWStringDynArray, _ObjectArray, _ClrObject)

Searches for the public property with the specified name and sets the property index clrobject value of a specified
indexer object.

Syntax
Delphi

procedure SetPropertyValue(AName: ClrWString; AIndexTypes:


TClrWStringDynArray; AIndex: _ObjectArray; AValue: _ClrObject);
overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.42.12 TClrBaseObject.SetPropertyValue Method (ClrWString, _ClrObject)

Searches for the public property with the specified name and sets the property clrobject value of a specified object.

Syntax
Delphi

procedure SetPropertyValue(AName: ClrWString; AValue: _ClrObject);


overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1297
.Net Runtime Library for Delphi

7.1.1.8.2.9.3.42.13 TClrBaseObject.SetPropertyValue Method (ClrWString, _ObjectArray,


ClrVariant)

Searches for the public property with the specified name and sets the property index value of a specified indexer object.

Syntax
Delphi

procedure SetPropertyValue(AName: ClrWString; AIndex: _ObjectArray;


AValue: ClrVariant); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.42.14 TClrBaseObject.SetPropertyValue Method (ClrWString, _ObjectArray,


_ClrObject)

Searches for the public property with the specified name and sets the property index clrobject value of a specified
indexer object.

Syntax
Delphi

procedure SetPropertyValue(AName: ClrWString; AIndex: _ObjectArray;


AValue: _ClrObject); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.43 TClrBaseObject.ToString Method


Returns a string that represents the current object.

Syntax
Delphi

function ToString: String; override;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.44 TClrBaseObject.TryCast Method (_Type, ClrVariant)


Tries to cast the currently stored value to another type.

1298
.Net Runtime Library for Delphi

Syntax
Delphi

function TryCast(AType: _Type; var AResult: ClrVariant): ClrBoolean;


overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.45 TClrBaseObject.UnRegisterEvent Method


Unregisters the TClrBaseObject if a .net event is removed from the instance.

Syntax
Delphi

procedure UnRegisterEvent;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.46 UnRegisterEventCallBack Method

This is the overview for the UnRegisterEventCallBack method overload.

Overload List

Name Description

TClrBaseObject.UnRegisterEventCallBack Remove an event from the instance using the specified


(ClrWString, System.Pointer) event name and function pointer which is the event
handler.

TClrBaseObject.UnRegisterEventCallBack Remove an event from the instance using the specified


(ClrWString, _Delegate) event name and delegate.

7.1.1.8.2.9.3.46.1 TClrBaseObject.UnRegisterEventCallBack Method (ClrWString,


System.Pointer)

Remove an event from the instance using the specified event name and function pointer which is the event
handler.

Syntax

1299
.Net Runtime Library for Delphi

Delphi

procedure UnRegisterEventCallBack(AEventName: ClrWString;


AFunctionPointer: System.Pointer); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.46.2 TClrBaseObject.UnRegisterEventCallBack Method (ClrWString, _Delegate)

Remove an event from the instance using the specified event name and delegate.

Syntax
Delphi

procedure UnRegisterEventCallBack(AEventName: ClrWString;


AEventHandler: _Delegate); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.47 UnRegisterEventCallBackDirect Method

This is the overview for the UnRegisterEventCallBackDirect method overload.

Overload List

Name Description

TClrBaseObject.UnRegisterEventCallBackDirect Remove an event directly from the instance using


(ClrWString, System.Pointer) the specified event name and function pointer
which is the event handler.

TClrBaseObject.UnRegisterEventCallBackDirect Remove an event directly from the instance using


(ClrWString, _Delegate) the specified event name and delegate.

7.1.1.8.2.9.3.47.1 TClrBaseObject.UnRegisterEventCallBackDirect Method (ClrWString,


System.Pointer)

Remove an event directly from the instance using the specified event name and function pointer which is the
event handler.

Syntax

1300
.Net Runtime Library for Delphi

Delphi

procedure UnRegisterEventCallBackDirect(AEventName: ClrWString;


AFunctionPointer: System.Pointer); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.47.2 TClrBaseObject.UnRegisterEventCallBackDirect Method (ClrWString,


_Delegate)

Remove an event directly from the instance using the specified event name and delegate.

Syntax
Delphi

procedure UnRegisterEventCallBackDirect(AEventName: ClrWString;


AEventHandler: _Delegate); overload;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.3.48 TClrBaseObject.Unwrap Method


Returns the stored .net unwrapped object.

Syntax
Delphi

function Unwrap: ClrVariant;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.4 TClrBaseObject Properties


The properties of the TClrBaseObject class are listed here.

Properties

Name Description

1301
.Net Runtime Library for Delphi

Name Description

DefaultInterface Returns the default interface of the TClrBaseObject.

Fields Gets a public field with the specified name.

IsArray Gets a value that indicates whether the type is an array.

IsGeneric Gets a value indicating whether the current type is a generic type.

IsStatic Gets a value indicating whether the current type is a static type.

Methods Gets a public method with the specified name.

Properties Gets a public property with the specified name.

TypeCode Gets the underlying type code of the instance.

7.1.1.8.2.9.4.1 TClrBaseObject.DefaultInterface Property


Returns the default interface of the TClrBaseObject.

Syntax
Delphi

property DefaultInterface: _ClrObject;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.4.2 TClrBaseObject.Fields Property


Gets a public field with the specified name.

Syntax
Delphi

property Fields [AName: ClrWString]: _FieldInfo;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

1302
.Net Runtime Library for Delphi

7.1.1.8.2.9.4.3 TClrBaseObject.IsArray Property


Gets a value that indicates whether the type is an array.

Syntax
Delphi

property IsArray: ClrBoolean;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.4.4 TClrBaseObject.IsGeneric Property


Gets a value indicating whether the current type is a generic type.

Syntax
Delphi

property IsGeneric: ClrBoolean;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.4.5 TClrBaseObject.IsStatic Property


Gets a value indicating whether the current type is a static type.

Syntax
Delphi

property IsStatic: ClrBoolean;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.4.6 TClrBaseObject.Methods Property


Gets a public method with the specified name.

Syntax
Delphi

1303
.Net Runtime Library for Delphi

property Methods [AName: ClrWString]: _MethodInfo;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.4.7 TClrBaseObject.Properties Property

This is Properties, a member of class TClrBaseObject.

Syntax
Delphi

property Properties [AName: ClrWString]: _PropertyInfo;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.9.4.8 TClrBaseObject.TypeCode Property


Gets the underlying type code of the instance.

Syntax
Delphi

property TypeCode: TTypeCode;

See Also
TClrBaseObject Class
CNClrLib.Host Namespace

7.1.1.8.2.10 TClrHost Class


Collapse All Expand All

Contains methods for starting and hosting the .Net Framework Common Language Runtime. This class
cannot be inherited.

Inheritance Hierarchy
CNClrLib.Host.TClrHost

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

1304
.Net Runtime Library for Delphi

Syntax
Delphi

TClrHost = class sealed(TClrBase);

Constructors

Name Description

Create Creates a new instance of the TClrHost class.

Destructors

Name Description

Destroy Destroys an instance of the TClrHost Class.

Methods

Show: Protected

No members matching the current filter

Name Description

GetDefault Returns the default instance of the TClrHost class.

GetRegisteredEventObject Returns the base object from the specified value whose
event has been registered.

RegisterEvent Register the object whose event has been hooked up.

UnRegisterEvent Unregister the object whose event has been hooked up.

Properties

Name Description

AppDomainHelper Returns the static members of the AppDomain Class in .Net.

AssemblyHelper Returns the static members of the Assembly Class in .Net.

CurrentDomain Gets the current application domain for the current Thread.

1305
.Net Runtime Library for Delphi

Name Description

DefaultInterface Returns the underlying interface of the TClrHost.

GarbageCollector Returns the system garbage collector, a service that


automatically reclaims unused memory.

Marshal Returns the marshal interface which p rovides a collection of


methods for allocating unmanaged memory, copying unmanaged
memory blocks, and converting managed to unmanaged types, as well
as other miscellaneous methods used when interacting with
unmanaged code.

See Also
TClrHost Methods
TClrHost Properties

7.1.1.8.2.10.1 TClrHost.Create Constructor


Creates a new instance of the TClrHost class.

Syntax
Delphi

constructor Create;

See Also
TClrHost Class
CNClrLib.Host Namespace

7.1.1.8.2.10.2 TClrHost.Destroy Destructor


Destroys an instance of the TClrHost Class.

Syntax
Delphi

destructor Destroy; override;

See Also
TClrHost Class
CNClrLib.Host Namespace

1306
.Net Runtime Library for Delphi

7.1.1.8.2.10.3 TClrHost Methods


The methods of the TClrHost class are listed here.

Methods

Show: Protected

No members matching the current filter

Name Description

GetDefault Returns the default instance of the TClrHost class.

GetRegisteredEventObject Returns the base object from the specified value whose event has
been registered.

RegisterEvent Register the object whose event has been hooked up.

UnRegisterEvent Unregister the object whose event has been hooked up.

7.1.1.8.2.10.3.1 TClrHost.GetDefault Method


Returns the default instance of the TClrHost class.

Syntax
Delphi

class function GetDefault: TClrHost;

See Also
TClrHost Class
CNClrLib.Host Namespace

7.1.1.8.2.10.3.2 TClrHost.GetRegisteredEventObject Method


Returns the base object from the specified value whose event has been registered.

Syntax
Delphi

function GetRegisteredEventObject(AIntf: _ClrObject): TClrBaseObject;

See Also

1307
.Net Runtime Library for Delphi

TClrHost Class
CNClrLib.Host Namespace

7.1.1.8.2.10.3.3 TClrHost.RegisterEvent Method


Register the object whose event has been hooked up.

Syntax
Delphi

procedure RegisterEvent(AClrObject: TClrBaseObject);

See Also
TClrHost Class
CNClrLib.Host Namespace

7.1.1.8.2.10.3.4 TClrHost.UnRegisterEvent Method


Unregister the object whose event has been hooked up.

Syntax
Delphi

procedure UnRegisterEvent(AClrObject: TClrBaseObject);

See Also
TClrHost Class
CNClrLib.Host Namespace

7.1.1.8.2.10.4 TClrHost Properties


The properties of the TClrHost class are listed here.

Properties

Name Description

AppDomainHelper Returns the static members of the AppDomain Class in .Net.

AssemblyHelper Returns the static members of the Assembly Class in .Net.

CurrentDomain Gets the current application domain for the current Thread.

DefaultInterface Returns the underlying interface of the TClrHost.

1308
.Net Runtime Library for Delphi

Name Description

GarbageCollector Returns the system garbage collector, a service that automatically


reclaims unused memory.

Marshal Returns the marshal interface which p rovides a collection of


methods for allocating unmanaged memory, copying unmanaged
memory blocks, and converting managed to unmanaged types, as well
as other miscellaneous methods used when interacting with
unmanaged code.

7.1.1.8.2.10.4.1 TClrHost.AppDomainHelper Property


Returns the static members of the AppDomain Class in .Net.

Syntax
Delphi

property AppDomainHelper: _AppDomainHelper;

See Also
TClrHost Class
CNClrLib.Host Namespace

7.1.1.8.2.10.4.2 TClrHost.AssemblyHelper Property


Returns the static members of the Assembly Class in .Net.

Syntax
Delphi

property AssemblyHelper: _AssemblyHelper;

See Also
TClrHost Class
CNClrLib.Host Namespace

7.1.1.8.2.10.4.3 TClrHost.CurrentDomain Property


Gets the current application domain for the current Thread.

Syntax
Delphi

property CurrentDomain: TClrAppDomain;

1309
.Net Runtime Library for Delphi

See Also
TClrHost Class
CNClrLib.Host Namespace

7.1.1.8.2.10.4.4 TClrHost.DefaultInterface Property


Returns the underlying interface of the TClrHost.

Syntax
Delphi

property DefaultInterface: _ClrHost;

See Also
TClrHost Class
CNClrLib.Host Namespace

7.1.1.8.2.10.4.5 TClrHost.GarbageCollector Property


Returns the system garbage collector, a service that automatically reclaims unused memory.

Syntax
Delphi

property GarbageCollector: _GC;

See Also
TClrHost Class
CNClrLib.Host Namespace

7.1.1.8.2.10.4.6 TClrHost.Marshal Property


Returns the marshal interface which p rovides a collection of methods for allocating unmanaged memory, copying
unmanaged memory blocks, and converting managed to unmanaged types, as well as other miscellaneous methods
used when interacting with unmanaged code.

Syntax
Delphi

property Marshal: _Marshal;

See Also
TClrHost Class
CNClrLib.Host Namespace

1310
.Net Runtime Library for Delphi

7.1.1.8.2.11 TClrObject Class


Collapse All Expand All

This Class is a wrapper of a .Net object. This class inherit from the TClrBaseObject class.

Inheritance Hierarchy
CNClrLib.Host.TClrBaseObject

CNClrLib.Host.TClrObject

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrObject = class(TClrBaseObject);

Constructors

Show: Inherited Protected

No members matching the current filter

Name Description

Create Creates a new instance of the TClrObject class.

Create(ClrVariant) This is Create, a member of class TClrBaseObject.

Create(ClrWString) This is Create, a member of class TClrBaseObject.

Create(ClrWString, This is Create, a member of class TClrBaseObject.


TClrVariantDynArray)

Create(ClrWString, This is Create, a member of class TClrBaseObject.


TClrVariantDynArray,
TBindingFlags_Set)

Create(ClrWString, This is Create, a member of class TClrBaseObject.


_ObjectArray)

Create(ClrWString, This is Create, a member of class TClrBaseObject.


_ObjectArray,

1311
.Net Runtime Library for Delphi

Name Description

TBindingFlags_Set)

Create(_ClrObject) This is Create, a member of class TClrBaseObject.

Create(_Type) This is Create, a member of class TClrBaseObject.

Create(_Type, This is Create, a member of class TClrBaseObject.


TClrVariantDynArray)

Create(_Type, This is Create, a member of class TClrBaseObject.


TClrVariantDynArray,
TBindingFlags_Set)

Create(_Type, _ObjectArray) This is Create, a member of class TClrBaseObject.

Create(_Type, _ObjectArray, This is Create, a member of class TClrBaseObject.


TBindingFlags_Set)

Destructors

Show: Inherited

No members matching the current filter

Name Description

Destroy Destroys an instance of the TClrObject Class.

Methods

Show: Inherited Protected

No members matching the current filter

Name Description

AsAnsiChar Converts the stored value to an ansi character


value.

AsAnsiString Converts the stored value to an ansi string value.

AsArray This is AsArray, a member of class


TClrBaseObject.

1312
.Net Runtime Library for Delphi

Name Description

AsBCD Converts the stored value to a TBcd value.

AsBoolean Converts the stored value to a boolean value.

AsByte Converts the stored value to a byte value.

AsChar Converts the stored value to a unicode character


value.

AsCurrency Converts the stored value to a currency value.

AsDecimal Converts the stored value to a decimal value.

AsDispatch This is AsDispatch, a member of class


TClrBaseObject.

AsExtended Converts the stored value to a extended value.

AsFloat Converts the stored value to a double value.

AsInteger Converts the stored value to an integer value.

AsLargeInt Converts the stored value to a Int64 value.

AsLargeUInt Converts the stored value to a largeUnit value.

AsLongWord Converts the stored value to a longword value.

AsPointer This is AsPointer, a member of class


TClrBaseObject.

AsShortInt Converts the stored value to a shortint value.

AsSingle Converts the stored value to a single value.

AsSmallInt Converts the stored value to a smallint value.

AsString Converts the stored value to a string value.

AsUInt16 Converts the stored value to a word value.

AsUnknown This is AsUnknown, a member of class

1313
.Net Runtime Library for Delphi

Name Description

TClrBaseObject.

AsVariant This is AsVariant, a member of class


TClrBaseObject.

AsWideString Converts the stored value to a widestring value.

Cast(_Type) This is Cast, a member of class TClrBaseObject.

Clone This is Clone, a member of class


TClrBaseObject.

CreateInstance This is CreateInstance, a member of class


TClrBaseObject.

Dispose This is Dispose, a member of class


TClrBaseObject.

Equals(ClrVariant) This is Equals, a member of class


TClrBaseObject.

Equals(TClrBaseObject) This is Equals, a member of class


TClrBaseObject.

Equals(TClrObject) Determines whether this object and the specified


TClrObject object are equal.

GetArrayElement This is GetArrayElement, a member of class


TClrBaseObject.

GetArrayElementO This is GetArrayElementO, a member of class


TClrBaseObject.

GetArrayLength This is GetArrayLength, a member of class


TClrBaseObject.

GetDelphiObject This is GetDelphiObject, a member of class


TClrBaseObject.

GetEvent(ClrWString) This is GetEvent, a member of class


TClrBaseObject.

GetEvent(ClrWString, TBindingFlags_Set) This is GetEvent, a member of class

1314
.Net Runtime Library for Delphi

Name Description

TClrBaseObject.

GetField(ClrWString) This is GetField, a member of class


TClrBaseObject.

GetField(ClrWString, TBindingFlags_Set) This is GetField, a member of class


TClrBaseObject.

GetFieldValue(ClrWString) This is GetFieldValue, a member of class


TClrBaseObject.

GetFieldValue(ClrWString, This is GetFieldValue, a member of class


TBindingFlags_Set) TClrBaseObject.

GetFieldValueO(ClrWString) This is GetFieldValueO, a member of class


TClrBaseObject.

GetFieldValueO(ClrWString, This is GetFieldValueO, a member of class


TBindingFlags_Set) TClrBaseObject.

GetGenericMethod(ClrWString, This is GetGenericMethod, a member of class


ClrWString, ClrWString) TClrBaseObject.

GetGenericMethod(ClrWString, This is GetGenericMethod, a member of class


TClrTypeDynArray, TClrTypeDynArray) TClrBaseObject.

GetGenericMethod(ClrWString, This is GetGenericMethod, a member of class


_TypeArray) TClrBaseObject.

GetGenericMethod(ClrWString, This is GetGenericMethod, a member of class


_TypeArray, ClrWString) TClrBaseObject.

GetGenericMethod(ClrWString, This is GetGenericMethod, a member of class


_TypeArray, _TypeArray) TClrBaseObject.

GetHashCode This is GetHashCode, a member of class


TClrBaseObject.

GetMethod(ClrWString) This is GetMethod, a member of class


TClrBaseObject.

GetMethod(ClrWString, ClrWString) This is GetMethod, a member of class


TClrBaseObject.

1315
.Net Runtime Library for Delphi

Name Description

GetMethod(ClrWString, This is GetMethod, a member of class


TClrTypeDynArray) TClrBaseObject.

GetMethod(ClrWString, _TypeArray) This is GetMethod, a member of class


TClrBaseObject.

GetProperty(ClrWString) This is GetProperty, a member of class


TClrBaseObject.

GetProperty(ClrWString, ClrWString) This is GetProperty, a member of class


TClrBaseObject.

GetProperty(ClrWString, _TypeArray) This is GetProperty, a member of class


TClrBaseObject.

GetPropertyValue(ClrWString) This is GetPropertyValue, a member of class


TClrBaseObject.

GetPropertyValue(ClrWString, ClrInt32) This is GetPropertyValue, a member of class


TClrBaseObject.

GetPropertyValue(ClrWString, ClrWString, This is GetPropertyValue, a member of class


ClrInt32) TClrBaseObject.

GetPropertyValue(ClrWString, This is GetPropertyValue, a member of class


TClrWStringDynArray, TClrBaseObject.
TClrVariantDynArray)

GetPropertyValue(ClrWString, This is GetPropertyValue, a member of class


_ObjectArray) TClrBaseObject.

GetPropertyValue(String, This is GetPropertyValue, a member of class


TClrVariantDynArray) TClrBaseObject.

GetPropertyValueO(ClrWString) This is GetPropertyValueO, a member of class


TClrBaseObject.

GetPropertyValueO(ClrWString, ClrInt32) This is GetPropertyValueO, a member of class


TClrBaseObject.

GetPropertyValueO(ClrWString, This is GetPropertyValueO, a member of class


ClrWString, ClrInt32) TClrBaseObject.

1316
.Net Runtime Library for Delphi

Name Description

GetPropertyValueO(ClrWString, This is GetPropertyValueO, a member of class


TClrWStringDynArray, TClrBaseObject.
TClrVariantDynArray)

GetPropertyValueO(ClrWString, This is GetPropertyValueO, a member of class


_ObjectArray) TClrBaseObject.

GetPropertyValueO(String, This is GetPropertyValueO, a member of class


TClrVariantDynArray) TClrBaseObject.

GetType This is GetType, a member of class


TClrBaseObject.

GetUnManagedObject This is GetUnManagedObject, a member of


class TClrBaseObject.

GetUnManagedPointer This is GetUnManagedPointer, a member of


class TClrBaseObject.

GetValue Converts the stored value to a TValue record value.

InvokeGenericMethod(ClrWString, This is InvokeGenericMethod, a member of


ClrWString, ClrWString, class TClrBaseObject.
TClrVariantDynArray)

InvokeGenericMethod(ClrWString, This is InvokeGenericMethod, a member of


TClrTypeDynArray, TClrTypeDynArray, class TClrBaseObject.
TClrVariantDynArray)

InvokeGenericMethod(ClrWString, This is InvokeGenericMethod, a member of


_TypeArray) class TClrBaseObject.

InvokeGenericMethod(ClrWString, This is InvokeGenericMethod, a member of


_TypeArray, ClrWString, _ObjectArray) class TClrBaseObject.

InvokeGenericMethod(ClrWString, This is InvokeGenericMethod, a member of


_TypeArray, TClrWStringDynArray, class TClrBaseObject.
TClrVariantDynArray)

InvokeGenericMethod(ClrWString, This is InvokeGenericMethod, a member of


_TypeArray, _TypeArray, class TClrBaseObject.
TClrVariantDynArray)

1317
.Net Runtime Library for Delphi

Name Description

InvokeGenericMethod(ClrWString, This is InvokeGenericMethod, a member of


_TypeArray, _TypeArray, _ObjectArray) class TClrBaseObject.

InvokeGenericMethodO(ClrWString, This is InvokeGenericMethodO, a member of


ClrWString, ClrWString, class TClrBaseObject.
TClrVariantDynArray)

InvokeGenericMethodO(ClrWString, This is InvokeGenericMethodO, a member of


TClrTypeDynArray, TClrTypeDynArray, class TClrBaseObject.
TClrVariantDynArray)

InvokeGenericMethodO(ClrWString, This is InvokeGenericMethodO, a member of


_TypeArray) class TClrBaseObject.

InvokeGenericMethodO(ClrWString, This is InvokeGenericMethodO, a member of


_TypeArray, ClrWString, _ObjectArray) class TClrBaseObject.

InvokeGenericMethodO(ClrWString, This is InvokeGenericMethodO, a member of


_TypeArray, TClrWStringDynArray, class TClrBaseObject.
TClrVariantDynArray)

InvokeGenericMethodO(ClrWString, This is InvokeGenericMethodO, a member of


_TypeArray, _TypeArray, class TClrBaseObject.
TClrVariantDynArray)

InvokeGenericMethodO(ClrWString, This is InvokeGenericMethodO, a member of


_TypeArray, _TypeArray, _ObjectArray) class TClrBaseObject.

InvokeMethod(ClrWString) This is InvokeMethod, a member of class


TClrBaseObject.

InvokeMethod(ClrWString, ClrWString, This is InvokeMethod, a member of class


TClrVariantDynArray) TClrBaseObject.

InvokeMethod(ClrWString, ClrWString, This is InvokeMethod, a member of class


TClrVariantDynArray, _ObjectArray) TClrBaseObject.

InvokeMethod(ClrWString, ClrWString, This is InvokeMethod, a member of class


_ObjectArray) TClrBaseObject.

InvokeMethod(ClrWString, This is InvokeMethod, a member of class


TClrTypeDynArray, TClrVariantDynArray) TClrBaseObject.

1318
.Net Runtime Library for Delphi

Name Description

InvokeMethod(ClrWString, This is InvokeMethod, a member of class


TClrTypeDynArray, TClrVariantDynArray, TClrBaseObject.
_ObjectArray)

InvokeMethod(ClrWString, This is InvokeMethod, a member of class


TClrWStringDynArray, TClrBaseObject.
TClrVariantDynArray)

InvokeMethod(ClrWString, This is InvokeMethod, a member of class


TClrWStringDynArray, TClrBaseObject.
TClrVariantDynArray, _ObjectArray)

InvokeMethod(ClrWString, This is InvokeMethod, a member of class


TClrWStringDynArray, _ObjectArray) TClrBaseObject.

InvokeMethod(ClrWString, _TypeArray, This is InvokeMethod, a member of class


TClrVariantDynArray) TClrBaseObject.

InvokeMethod(ClrWString, _TypeArray, This is InvokeMethod, a member of class


TClrVariantDynArray, _ObjectArray) TClrBaseObject.

InvokeMethod(ClrWString, _TypeArray, This is InvokeMethod, a member of class


_ObjectArray) TClrBaseObject.

InvokeMethodO(ClrWString) This is InvokeMethodO, a member of class


TClrBaseObject.

InvokeMethodO(ClrWString, ClrWString, This is InvokeMethodO, a member of class


TClrVariantDynArray) TClrBaseObject.

InvokeMethodO(ClrWString, ClrWString, This is InvokeMethodO, a member of class


TClrVariantDynArray, _ObjectArray) TClrBaseObject.

InvokeMethodO(ClrWString, ClrWString, This is InvokeMethodO, a member of class


_ObjectArray) TClrBaseObject.

InvokeMethodO(ClrWString, This is InvokeMethodO, a member of class


TClrTypeDynArray, TClrVariantDynArray) TClrBaseObject.

InvokeMethodO(ClrWString, This is InvokeMethodO, a member of class


TClrTypeDynArray, TClrVariantDynArray, TClrBaseObject.
_ObjectArray)

1319
.Net Runtime Library for Delphi

Name Description

InvokeMethodO(ClrWString, This is InvokeMethodO, a member of class


TClrWStringDynArray, TClrBaseObject.
TClrVariantDynArray)

InvokeMethodO(ClrWString, This is InvokeMethodO, a member of class


TClrWStringDynArray, TClrBaseObject.
TClrVariantDynArray, _ObjectArray)

InvokeMethodO(ClrWString, This is InvokeMethodO, a member of class


TClrWStringDynArray, _ObjectArray) TClrBaseObject.

InvokeMethodO(ClrWString, _TypeArray, This is InvokeMethodO, a member of class


TClrVariantDynArray) TClrBaseObject.

InvokeMethodO(ClrWString, _TypeArray, This is InvokeMethodO, a member of class


TClrVariantDynArray, _ObjectArray) TClrBaseObject.

InvokeMethodO(ClrWString, _TypeArray, This is InvokeMethodO, a member of class


_ObjectArray) TClrBaseObject.

IsEnum This is IsEnum, a member of class


TClrBaseObject.

IsInstanceOfType This is IsInstanceOfType, a member of class


TClrBaseObject.

IsObject This is IsObject, a member of class


TClrBaseObject.

IsType(_Type) This is IsType, a member of class


TClrBaseObject.

IsValueType This is IsValueType, a member of class


TClrBaseObject.

RegisterEvent This is RegisterEvent, a member of class


TClrBaseObject.

RegisterEventCallBack(ClrWString, This is RegisterEventCallBack, a member of


System.Pointer) class TClrBaseObject.

RegisterEventCallBack(ClrWString, This is RegisterEventCallBack, a member of


_Delegate) class TClrBaseObject.

1320
.Net Runtime Library for Delphi

Name Description

RegisterEventCallBackDirect(ClrWString, This is RegisterEventCallBackDirect, a member


System.Pointer) of class TClrBaseObject. (Inherited from
TClrBaseObject.

RegisterEventCallBackDirect(ClrWString, This is RegisterEventCallBackDirect, a member


_Delegate) of class TClrBaseObject. (Inherited from
TClrBaseObject.

SetArrayElement This is SetArrayElement, a member of class


TClrBaseObject.

SetFieldValue(ClrWString, ClrVariant) This is SetFieldValue, a member of class


TClrBaseObject.

SetFieldValue(ClrWString, This is SetFieldValue, a member of class


TBindingFlags_Set, ClrVariant) TClrBaseObject.

SetFieldValue(ClrWString, This is SetFieldValue, a member of class


TBindingFlags_Set, _ClrObject) TClrBaseObject.

SetFieldValue(ClrWString, _ClrObject) This is SetFieldValue, a member of class


TClrBaseObject.

SetPropertyValue(ClrWString, ClrInt32, This is SetPropertyValue, a member of class


ClrVariant) TClrBaseObject.

SetPropertyValue(ClrWString, ClrInt32, This is SetPropertyValue, a member of class


_ClrObject) TClrBaseObject.

SetPropertyValue(ClrWString, ClrVariant) This is SetPropertyValue, a member of class


TClrBaseObject.

SetPropertyValue(ClrWString, ClrWString, This is SetPropertyValue, a member of class


ClrInt32, ClrVariant) TClrBaseObject.

SetPropertyValue(ClrWString, ClrWString, This is SetPropertyValue, a member of class


ClrInt32, _ClrObject) TClrBaseObject.

SetPropertyValue(ClrWString, This is SetPropertyValue, a member of class


TClrVariantDynArray, ClrVariant) TClrBaseObject.

SetPropertyValue(ClrWString, This is SetPropertyValue, a member of class


TClrVariantDynArray, _ClrObject) TClrBaseObject.

1321
.Net Runtime Library for Delphi

Name Description

SetPropertyValue(ClrWString, This is SetPropertyValue, a member of class


TClrWStringDynArray, TClrBaseObject.
TClrVariantDynArray, ClrVariant)

SetPropertyValue(ClrWString, This is SetPropertyValue, a member of class


TClrWStringDynArray, TClrBaseObject.
TClrVariantDynArray, _ClrObject)

SetPropertyValue(ClrWString, This is SetPropertyValue, a member of class


TClrWStringDynArray, _ObjectArray, TClrBaseObject.
ClrVariant)

SetPropertyValue(ClrWString, This is SetPropertyValue, a member of class


TClrWStringDynArray, _ObjectArray, TClrBaseObject.
_ClrObject)

SetPropertyValue(ClrWString, _ClrObject) This is SetPropertyValue, a member of class


TClrBaseObject.

SetPropertyValue(ClrWString, This is SetPropertyValue, a member of class


_ObjectArray, ClrVariant) TClrBaseObject.

SetPropertyValue(ClrWString, This is SetPropertyValue, a member of class


_ObjectArray, _ClrObject) TClrBaseObject.

ToString This is ToString, a member of class


TClrBaseObject.

TryCast(_Type, ClrVariant) This is TryCast, a member of class


TClrBaseObject.

UnRegisterEvent This is UnRegisterEvent, a member of class


TClrBaseObject.

UnRegisterEventCallBack(ClrWString, This is UnRegisterEventCallBack, a member of


System.Pointer) class TClrBaseObject.

UnRegisterEventCallBack(ClrWString, This is UnRegisterEventCallBack, a member of


_Delegate) class TClrBaseObject.

UnRegisterEventCallBackDirect(ClrWString, This is UnRegisterEventCallBackDirect, a


System.Pointer) member of class TClrBaseObject. (Inherited
from TClrBaseObject.

1322
.Net Runtime Library for Delphi

Name Description

UnRegisterEventCallBackDirect(ClrWString, This is UnRegisterEventCallBackDirect, a


_Delegate) member of class TClrBaseObject. (Inherited
from TClrBaseObject.

Unwrap This is Unwrap, a member of class


TClrBaseObject.

Properties

Show: Inherited

No members matching the current filter

Name Description

DefaultInterface This is DefaultInterface, a member of class TClrBaseObject.

Fields This is Fields, a member of class TClrBaseObject.

IsArray This is IsArray, a member of class TClrBaseObject.

IsGeneric This is IsGeneric, a member of class TClrBaseObject.

IsStatic This is IsStatic, a member of class TClrBaseObject.

Methods This is Methods, a member of class TClrBaseObject.

Properties This is Properties, a member of class TClrBaseObject.

TypeCode This is TypeCode, a member of class TClrBaseObject.

See Also
Create Constructor
TClrObject Methods

7.1.1.8.2.11.1 TClrObject.Create Constructor


Initializes a new instance of the Object class.

Syntax
Delphi

constructor Create; overload;

1323
.Net Runtime Library for Delphi

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.2 TClrObject.Destroy Destructor


This is Destroy, a member of class TClrObject.

Syntax
Delphi

destructor Destroy; override;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3 TClrObject Methods


The methods of the TClrObject class are listed here.

Methods

Name Description

AsAnsiChar Converts the stored value to an ansi character value.

AsAnsiString Converts the stored value to an ansi string value.

AsBCD Converts the stored value to a TBcd value.

AsBoolean Converts the stored value to a boolean value.

AsByte Converts the stored value to a byte value.

AsChar Converts the stored value to a unicode character value.

AsCurrency Converts the stored value to a currency value.

AsDecimal Converts the stored value to a decimal value.

AsExtended Converts the stored value to a extended value.

1324
.Net Runtime Library for Delphi

Name Description

AsFloat Converts the stored value to a double value.

AsInteger Converts the stored value to an integer value.

AsLargeInt Converts the stored value to a Int64 value.

AsLargeUInt Converts the stored value to a largeUnit value.

AsLongWord Converts the stored value to a longword value.

AsShortInt Converts the stored value to a shortint value.

AsSingle Converts the stored value to a single value.

AsSmallInt Converts the stored value to a smallint value.

AsString Converts the stored value to a string value.

AsUInt16 Converts the stored value to a word value.

AsWideString Converts the stored value to a widestring value.

Equals(TClrObject) Determines whether this object and the specified TClrObject


object are equal.

GetValue Converts the stored value to a TValue record value.

7.1.1.8.2.11.3.1 TClrObject.AsAnsiChar Method


Converts the stored value to an ansi character value.

Syntax
Delphi

function AsAnsiChar: ClrAChar;

See Also
TClrObject Class
CNClrLib.Host Namespace

1325
.Net Runtime Library for Delphi

7.1.1.8.2.11.3.2 TClrObject.AsAnsiString Method


Converts the stored value to an ansi string value.

Syntax
Delphi

function AsAnsiString: ClrAString;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.3 TClrObject.AsBCD Method


Converts the stored value to a TBcd value.

Syntax
Delphi

function AsBCD: TBcd;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.4 TClrObject.AsBoolean Method


Converts the stored value to a boolean value.

Syntax
Delphi

function AsBoolean: ClrBoolean;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.5 TClrObject.AsByte Method


Converts the stored value to a byte value.

Syntax
Delphi

1326
.Net Runtime Library for Delphi

function AsByte: Byte;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.6 TClrObject.AsChar Method


Converts the stored value to a unicode character value.

Syntax
Delphi

function AsChar: ClrWChar;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.7 TClrObject.AsCurrency Method


Converts the stored value to a currency value.

Syntax
Delphi

function AsCurrency: Currency;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.8 TClrObject.AsDecimal Method


Converts the stored value to a decimal value.

Syntax
Delphi

function AsDecimal: ClrDecimal;

See Also
TClrObject Class
CNClrLib.Host Namespace

1327
.Net Runtime Library for Delphi

7.1.1.8.2.11.3.9 TClrObject.AsExtended Method


Converts the stored value to a extended value.

Syntax
Delphi

function AsExtended: Extended;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.10 TClrObject.AsFloat Method


Converts the stored value to a double value.

Syntax
Delphi

function AsFloat: ClrDouble;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.11 TClrObject.AsInteger Method


Converts the stored value to an integer value.

Syntax
Delphi

function AsInteger: ClrInt32;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.12 TClrObject.AsLargeInt Method


Converts the stored value to a Int64 value.

Syntax
Delphi

1328
.Net Runtime Library for Delphi

function AsLargeInt: ClrInt64;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.13 TClrObject.AsLargeUInt Method


Converts the stored value to a largeUnit value.

Syntax
Delphi

function AsLargeUInt: ClrUInt64;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.14 TClrObject.AsLongWord Method


Converts the stored value to a longword value.

Syntax
Delphi

function AsLongWord: ClrUInt32;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.15 TClrObject.AsShortInt Method


Converts the stored value to a shortint value.

Syntax
Delphi

function AsShortInt: ClrSByte;

See Also
TClrObject Class
CNClrLib.Host Namespace

1329
.Net Runtime Library for Delphi

7.1.1.8.2.11.3.16 TClrObject.AsSingle Method


Converts the stored value to a single value.

Syntax
Delphi

function AsSingle: ClrSingle;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.17 TClrObject.AsSmallInt Method


Converts the stored value to a smallint value.

Syntax
Delphi

function AsSmallInt: ClrInt16;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.18 TClrObject.AsString Method


Converts the stored value to a string value.

Syntax
Delphi

function AsString: ClrString;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.19 TClrObject.AsUInt16 Method


Converts the stored value to a word value.

Syntax
Delphi

1330
.Net Runtime Library for Delphi

function AsUInt16: ClrUInt16;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.20 TClrObject.AsWideString Method


Converts the stored value to a widestring value.

Syntax
Delphi

function AsWideString: ClrWString;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.21 TClrObject.Equals Method (TClrObject)


Determines whether this object and the specified TClrObject object are equal.

Syntax
Delphi

function Equals(AValue: TClrObject): ClrBoolean; overload;

See Also
TClrObject Class
CNClrLib.Host Namespace

7.1.1.8.2.11.3.22 TClrObject.GetValue Method


Converts the stored value to a TValue record value.

Syntax
Delphi

function GetValue: TValue;

See Also
TClrObject Class
CNClrLib.Host Namespace

1331
.Net Runtime Library for Delphi

7.1.1.8.2.12 TClrObjectArray Class


Collapse All Expand All

Represents an array of the ClrObject interface.

Inheritance Hierarchy
CNClrLib.Host.TClrObjectArray

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrObjectArray = class(TClrBase);

Constructors

Name Description

Create(ClrWString, ClrInt32) Creates a one-dimensional object array of the specified type name
and length, with zero-based indexing.

Create(TTClrObjectDynArray) Creates a new Array of the specified dynamic array of variant.

Create(_Type, ClrInt32) Creates a one-dimensional object array of the specified type name
and length, with zero-based indexing.

Destructors

Name Description

Destroy Destroys an instance of the TClrObjectArray Class.

Methods

Name Description

BinarySearch Search a sorted list for an element using binary search.

Clear Removes all elements from the array.

Contains Determine whether the specified value exist in the array.

1332
.Net Runtime Library for Delphi

Name Description

Delete Remove the value at the specified position in the array.

First Returns the first element in the array.

GetValue Gets the value at the specified position in the array.

IndexOf Searches for the specified value and returns the index of its first
occurrence in the array.

Last Returns the last element in the array.

LastIndexOf Searches for the specified value and returns the index of the last
occurrence within the array.

Remove Remove the specified value from the array.

Reverse Reverses the sequence of the elements in the array.

SetValue Sets a value to the element at the specified position in the array .

Sort Sorts the elements in an entire one-dimensional Array.

Unwrap Returns the .net System.Object[] object.

Properties

Name Description

Item Gets or Sets a value to the element at the specified position in the
array.

Length Gets the total number of elements in all the dimensions of the array.

LongLength Gets a 64-bit integer that represents the total number of elements in
the array.

Rank Gets the rank (number of dimensions) of the array.

See Also
Create Constructor
TClrObjectArray Methods
TClrObjectArray Properties

1333
.Net Runtime Library for Delphi

7.1.1.8.2.12.1 Create Constructor


This is the overview for the Create constructor overload.

Overload List

Name Description

TClrObjectArray.Create Creates a one-dimensional object array of the specified type name


(ClrWString, ClrInt32) and length, with zero-based indexing.

TClrObjectArray.Create Creates a new Array of the specified dynamic array of variant.


(TTClrObjectDynArray)

TClrObjectArray.Create Creates a one-dimensional object array of the specified type name


(_Type, ClrInt32) and length, with zero-based indexing.

7.1.1.8.2.12.1.1 TClrObjectArray.Create Constructor (ClrWString, ClrInt32)


Creates a one-dimensional object array of the specified type name and length, with zero-based indexing.

Syntax
Delphi

constructor Create(AElementTypeName: ClrWString; ALength: ClrInt32);


overload;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.1.2 TClrObjectArray.Create Constructor (TTClrObjectDynArray)


Creates a new Array of the specified dynamic array of variant.

Syntax
Delphi

constructor Create(AArray: TTClrObjectDynArray); overload;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

1334
.Net Runtime Library for Delphi

7.1.1.8.2.12.1.3 TClrObjectArray.Create Constructor (_Type, ClrInt32)


Creates a one-dimensional object array of the specified type name and length, with zero-based indexing.

Syntax
Delphi

constructor Create(AElementType: _Type; ALength: ClrInt32); overload;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.2 TClrObjectArray.Destroy Destructor


Destroys an instance of the TClrObjectArray Class.

Syntax
Delphi

destructor Destroy; override;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.3 TClrObjectArray Methods


Methods

Name Description

BinarySearch Search a sorted list for an element using binary search.

Clear Removes all elements from the array.

Contains Determine whether the specified value exist in the array.

Delete Remove the value at the specified position in the array.

First Returns the first element in the array.

GetValue Gets the value at the specified position in the array.

1335
.Net Runtime Library for Delphi

Name Description

IndexOf Searches for the specified value and returns the index of its first
occurrence in the array.

Last Returns the last element in the array.

LastIndexOf Searches for the specified value and returns the index of the last
occurrence within the array.

Remove Remove the specified value from the array.

Reverse Reverses the sequence of the elements in the array.

SetValue Sets a value to the element at the specified position in the array .

Sort Sorts the elements in an entire one-dimensional Array.

Unwrap Returns the .net System.Object[] object.

7.1.1.8.2.12.3.1 TClrObjectArray.BinarySearch Method


Search a sorted list for an element using binary search.

Syntax
Delphi

function BinarySearch(const AItem: TClrBaseObject; out AIndex:


ClrInt32): ClrBoolean;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.3.2 TClrObjectArray.Clear Method


Removes all elements from the array.

Syntax
Delphi

procedure Clear;

See Also

1336
.Net Runtime Library for Delphi

TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.3.3 TClrObjectArray.Contains Method


Determine whether the specified value exist in the array.

Syntax
Delphi

function Contains(const AValue: TClrBaseObject): ClrBoolean;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.3.4 TClrObjectArray.Delete Method


Remove the value at the specified position in the array.

Syntax
Delphi

procedure Delete(Index: ClrInt32);

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.3.5 TClrObjectArray.First Method


Returns the first element in the array.

Syntax
Delphi

function First: TClrBaseObject;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.3.6 TClrObjectArray.GetValue Method


Gets the value at the specified position in the array.

1337
.Net Runtime Library for Delphi

Syntax
Delphi

function GetValue(AIndex: ClrInt32): TClrBaseObject;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.3.7 TClrObjectArray.IndexOf Method


Searches for the specified value and returns the index of its first occurrence in the array.

Syntax
Delphi

function IndexOf(const AValue: TClrBaseObject): ClrInt32;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.3.8 TClrObjectArray.Last Method


Returns the last element in the array.

Syntax
Delphi

function Last: TClrBaseObject;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.3.9 TClrObjectArray.LastIndexOf Method


Searches for the specified value and returns the index of the last occurrence within the array.

Syntax
Delphi

function LastIndexOf(const AValue: TClrBaseObject): ClrInt32;

See Also

1338
.Net Runtime Library for Delphi

TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.3.10 TClrObjectArray.Remove Method


Remove the specified value from the array.

Syntax
Delphi

function Remove(const AValue: TClrBaseObject): ClrInt32;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.3.11 TClrObjectArray.Reverse Method


Reverses the sequence of the elements in the array.

Syntax
Delphi

procedure Reverse;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.3.12 TClrObjectArray.SetValue Method


Sets a value to the element at the specified position in the array .

Syntax
Delphi

procedure SetValue(const AValue: TClrBaseObject; AIndex: ClrInt32);

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.3.13 TClrObjectArray.Sort Method


Sorts the elements in an entire one-dimensional Array.

1339
.Net Runtime Library for Delphi

Syntax
Delphi

procedure Sort;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.3.14 TClrObjectArray.Unwrap Method


Returns the .net System.Object[] object.

Syntax
Delphi

function Unwrap: ClrVariant;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.4 TClrObjectArray Properties


The properties of the TClrObjectArray class are listed here.

Properties

Name Description

Item Gets or Sets a value to the element at the specified position in the
array.

Length Gets the total number of elements in all the dimensions of the array.

LongLength Gets a 64-bit integer that represents the total number of elements in
the array.

Rank Gets the rank (number of dimensions) of the array.

7.1.1.8.2.12.4.1 TClrObjectArray.Item Property


Gets or Sets a value to the element at the specified position in the array.

1340
.Net Runtime Library for Delphi

Syntax
Delphi

property Item [index: ClrInt32]: TClrBaseObject;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.4.2 TClrObjectArray.Length Property


Gets the total number of elements in all the dimensions of the array.

Syntax
Delphi

property Length: ClrInt32;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.4.3 TClrObjectArray.LongLength Property


Gets a 64-bit integer that represents the total number of elements in the array.

Syntax
Delphi

property LongLength: ClrInt64;

See Also
TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.12.4.4 TClrObjectArray.Rank Property


Gets the rank (number of dimensions) of the array.

Syntax
Delphi

property Rank: ClrInt32;

See Also

1341
.Net Runtime Library for Delphi

TClrObjectArray Class
CNClrLib.Host Namespace

7.1.1.8.2.13 TClrWSDL Class


Collapse All Expand All

Contains methods to build and convert XML Web Services into a .net assembly. This class cannot be
inherited.

Inheritance Hierarchy
CNClrLib.Host.TClrWSDL

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrWSDL = class sealed(TClrBase);

Constructors

Name Description

Create Creates a new instance of the TClrWSDL class.

Destructors

Name Description

Destroy Destroys an instance of theTClrWSDL class.

Methods

Name Description

BuildAssembly Build and convert the XML Web Services to a .net assembly.

GetServices Returns the webservices from the XML Web Services path as
assembly types.

Properties

1342
.Net Runtime Library for Delphi

Name Description

DefaultInterface Get the underlyning interface of the TClrWSDL class.

ProtocolName Gets or sets the protocol used to access the described XML Web
services.

WSDLLocation Gets or Sets the path of the XML Web services.

See Also
TClrWSDL Methods
TClrWSDL Properties

7.1.1.8.2.13.1 TClrWSDL.Create Constructor


Creates a new instance of the TClrWSDL class.

Syntax
Delphi

constructor Create; overload;

See Also
TClrWSDL Class
CNClrLib.Host Namespace

7.1.1.8.2.13.2 TClrWSDL.Destroy Destructor


Destroys an instance of theTClrWSDL class.

Syntax
Delphi

destructor Destroy; override;

See Also
TClrWSDL Class
CNClrLib.Host Namespace

7.1.1.8.2.13.3 TClrWSDL Methods


The methods of the TClrWSDL class are listed here.

Methods

1343
.Net Runtime Library for Delphi

Name Description

BuildAssembly Build and convert the XML Web Services to a .net assembly.

GetServices Returns the webservices from the XML Web Services path as
assembly types.

7.1.1.8.2.13.3.1 TClrWSDL.BuildAssembly Method


Build and convert the XML Web Services to a .net assembly.

Syntax
Delphi

function BuildAssembly: TClrAssembly;

See Also
TClrWSDL Class
CNClrLib.Host Namespace

7.1.1.8.2.13.3.2 TClrWSDL.GetServices Method


Returns the webservices from the XML Web Services path as assembly types.

Syntax
Delphi

function GetServices: TStrings;

See Also
TClrWSDL Class
CNClrLib.Host Namespace

7.1.1.8.2.13.4 TClrWSDL Properties


The properties of the TClrWSDL class are listed here.

Properties

Name Description

DefaultInterface Get the underlyning interface of the TClrWSDL class.

1344
.Net Runtime Library for Delphi

Name Description

ProtocolName Gets or sets the protocol used to access the described XML Web
services.

WSDLLocation Gets or Sets the path of the XML Web services.

7.1.1.8.2.13.4.1 TClrWSDL.DefaultInterface Property


Gets the underlyning interface of the TClrWSDL class.

Syntax
Delphi

property DefaultInterface: _ClrWSDL;

See Also
TClrWSDL Class
CNClrLib.Host Namespace

7.1.1.8.2.13.4.2 TClrWSDL.ProtocolName Property


Gets or sets the protocol used to access the described XML Web services.

Syntax
Delphi

property ProtocolName: TClrWsdlProtocolName;

See Also
TClrWSDL Class
CNClrLib.Host Namespace

7.1.1.8.2.13.4.3 TClrWSDL.WSDLLocation Property


Gets or Sets the path of the XML Web services.

Syntax
Delphi

property WSDLLocation: ClrWString;

See Also
TClrWSDL Class
CNClrLib.Host Namespace

1345
.Net Runtime Library for Delphi

7.1.1.8.2.14 TClrDispatchActivator Class


Collapse All Expand All

Contains methods to create types of objects locally or remotely, or obtain references to existing remote objects and
returns the objects as IDispatch interface. This class cannot be inherited.

Inheritance Hierarchy
CNClrLib.Host.TClrDispatchActivator

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrDispatchActivator = class sealed;

Methods

Name Description

CreateInstance(ClrWString) Creates an instance of the type of specified type name using that
type's default constructor and returns the object as IDispatch
Interface.

CreateInstance(ClrWString, Creates an instance of the specified type using the constructor that
TClrVariantDynArray) best matches the specified parameters and returns the object as
IDispatch Interface.

CreateInstance(ClrWString, Creates an instance of the specified type using the constructor that
_ObjectArray) best matches the specified parameters and returns the object as
IDispatch Interface.

See Also
TClrActivator Methods

7.1.1.8.2.14.1 TClrDispatchActivator Methods


The methods of the TClrDispatchActivator class are listed here.

Methods

Name Description

CreateInstance(ClrWString) Creates an instance of the type of specified type name using that
type's default constructor and returns the object as IDispatch

1346
.Net Runtime Library for Delphi

Name Description

Interface.

CreateInstance(ClrWString, Creates an instance of the specified type using the constructor that
TClrVariantDynArray) best matches the specified parameters and returns the object as
IDispatch Interface.

CreateInstance(ClrWString, Creates an instance of the specified type using the constructor that
_ObjectArray) best matches the specified parameters and returns the object as
IDispatch Interface.

7.1.1.8.2.14.1.1 CreateInstance Method

This is the overview for the CreateInstance method overload.

Overload List

Name Description

CreateInstance(ClrWString) Creates an instance of the type of specified type name using that
type's default constructor and returns the object as IDispatch
Interface.

CreateInstance(ClrWString, Creates an instance of the specified type using the constructor that
TClrVariantDynArray) best matches the specified parameters and returns the object as
IDispatch Interface.

CreateInstance(ClrWString, Creates an instance of the specified type using the constructor that
_ObjectArray) best matches the specified parameters and returns the object as
IDispatch Interface.

7.1.1.8.2.14.1.1.1 TClrDispatchActivator.CreateInstance Method (ClrWString)


Creates an instance of the type of specified type name using that type's default constructor and returns the object as
IDispatch Interface.

Syntax
Delphi

class function CreateInstance(ATypeName: ClrWString): ClrIDispatch;


overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

1347
.Net Runtime Library for Delphi

7.1.1.8.2.14.1.1.2 TClrDispatchActivator.CreateInstance Method (ClrWString,


TClrVariantDynArray)
Creates an instance of the specified type using the constructor that best matches the specified parameters and returns
the object as IDispatch Interface.

Syntax
Delphi

class function CreateInstance(ATypeName: ClrWString; AArguments:


TClrVariantDynArray): ClrIDispatch; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.2.14.1.1.3 TClrDispatchActivator.CreateInstance Method (ClrWString, _ObjectArray)


Creates an instance of the specified type using the constructor that best matches the specified parameters and returns
the object as IDispatch Interface.

Syntax
Delphi

class function CreateInstance(ATypeName: ClrWString; AArguments:


_ObjectArray): ClrIDispatch; overload;

See Also
TClrActivator Class
CNClrLib.Host Namespace

7.1.1.8.3 Functions
The following table lists functions in this documentation.

Functions

Name Description

ClrHostManager Returns the default instance of the TClrHost Class.

ClrLibraryLoaded Determine whether the runtime host has been loaded and
started.

RaiseClrException Creates and raises an EClrException exception from the


specified SysUtils.Exception if the runtime host has been
loaded, otherwise EClrError exception will be created and

1348
.Net Runtime Library for Delphi

Name Description

raised.

RaiseClrException Creates and raises an EClrException exception with an error


message if the runtime host has been loaded, otherwise
EClrError exception will be created and raised.

7.1.1.8.3.1 CNClrLib.Host.ClrHostManager Function


Returns the default instance of the TClrHost Class.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

function ClrHostManager: TClrHost;

7.1.1.8.3.2 CNClrLib.Host.ClrLibraryLoaded Function


Determine whether the runtime host has been loaded and started.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

function ClrLibraryLoaded: ClrBoolean;

7.1.1.8.3.3 CNClrLib.Host.RaiseClrException Function


Creates and raises an EClrException exception from the specified SysUtils.Exception if the
runtime host has been loaded, otherwise EClrError exception will be created and raised.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

procedure RaiseClrException(AException: Exception); overload;

1349
.Net Runtime Library for Delphi

7.1.1.8.3.4 CNClrLib.Host.RaiseClrException Function


Creates and raises an EClrException exception with an error message if the runtime host has
been loaded, otherwise EClrError exception will be created and raised.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

procedure RaiseClrException(const AMessage: string); overload;

7.1.1.8.4 Structs, Records, Enums


The following table lists structs, records, enums in this documentation.

Enumerations

Name Description

TClrAssmLoadType Determine how the .net assembly library should be loaded


by TClrAssembly Class.

7.1.1.8.4.1 CNClrLib.Host.TClrAssmLoadType Enumeration


Determine how the .net assembly library should be loaded by TClrAssembly Class.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrAssmLoadType = (

ltGACByFullName,

ltGACByPartialName,

ltfileLocation,

ltWSDL

);

1350
.Net Runtime Library for Delphi

7.1.1.8.5 Types
Types

Name Description

ClrAChar This is a type of AnsiChar.

ClrAString This is a type of AnsiString.

ClrBoolean This is a type of Boolean.

ClrByte This is a type of Byte.

ClrChar Represents a character as a UTF-16 code unit. For more


information, see Char Structure in C#.

ClrDateTime This is a type of TDateTime.

ClrDecimal Another form of floating point number which represent a


decimal number. For more information, see Decimal
Structure in C#.

ClrDouble This is a type Double.

ClrGuid This is a type Guid.

ClrInt16 This is a type SmallInt.

ClrInt32 This is a type Integer.

ClrInt64 This is a type Int64.

ClrSByte This is a type ShortInt.

ClrSingle This is a type Single.

ClrString This is a type String.

ClrUInt16 This is a type Word.

ClrUInt32 This is a type LongWord.

ClrUInt64 This is a type Largeuint.

1351
.Net Runtime Library for Delphi

Name Description

ClrUString This is a type UnicodeString.

ClrVariant This is a type OleVariant.

ClrWChar This is a type WideChar.

ClrWString This is a type WideString.

TClrACharDynArray Represents a dynamic array of ClrAChar.

TClrAStringDynArray Represents a dynamic array of ClrAString.

TClrBase This is the ultimate base class of all classes in the Host Class
Library.

TClrBooleanDynArray Represents a dynamic array of ClrBoolean.

TClrByteDynArray Represents a dynamic array of ClrByte.

TClrCharDynArray Represents a dynamic array of ClrChar.

TClrDateTimeDynArray Represents a dynamic array of ClrDateTime.

TClrDecimalDynArray Represents a dynamic array of ClrDecimal.

TClrDoubleDynArray Represents a dynamic array of ClrDouble.

TClrEventHandler A standard method pointer for handling .net events invoked


in the Common Language Runtime which does not return a
value.

TClrEventHandlerR A standard method pointer for handling .net events invoked


in the Common Language Runtime which returns a value.

TClrExceptionDynArray Represents a dynamic array of Clr Exception interface.

TClrExtendedDynArray Represents a dynamic array of ClrExtended.

TClrInt16DynArray Represents a dynamic array of ClrInt16.

TClrInt32DynArray Represents a dynamic array of ClrInt32.

1352
.Net Runtime Library for Delphi

Name Description

TClrInt64DynArray Represents a dynamic array of ClrInt64.

TClrObjectDynArray Represents a dynamic array of _ClrObject interface.

TClrSByteDynArray Represents a dynamic array of ClrSByte.

TClrSingleDynArray Represents a dynamic array of ClrSingle.

TClrStringDynArray Represents a dynamic array of ClrString.

TClrTypeDynArray Represents a dynamic array of _Type Interface.

TClrUInt16DynArray Represents a dynamic array of ClrUInt16.

TClrUInt32DynArray Represents a dynamic array of ClrUInt32.

TClrUInt64DynArray Represents a dynamic array of ClrUInt64.

TClrVariantDynArray Represents a dynamic array of ClrVariant.

TClrWCharDynArray Represents a dynamic array of ClrWChar.

TClrWStringDynArray Represents a dynamic array of ClrWString.

TExceptionDynArray Represents a dynamic array of Delphi Exception.

TTClrObjectDynArray Represents a dynamic array of TClrBaseObject.

7.1.1.8.5.1 CNClrLib.Host.ClrAChar Type


This is a type of AnsiChar.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrAChar = System.AnsiChar;

1353
.Net Runtime Library for Delphi

7.1.1.8.5.2 CNClrLib.Host.ClrAString Type


This is a type of AnsiString.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrAString = System.AnsiString;

7.1.1.8.5.3 CNClrLib.Host.ClrBoolean Type


This is a type of Boolean.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrBoolean = System.Boolean;

7.1.1.8.5.4 CNClrLib.Host.ClrByte Type


This is a type of Byte.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrByte = System.Byte;

7.1.1.8.5.5 CNClrLib.Host.ClrChar Type


Represents a character as a UTF-16 code unit. For more information, see Char Structure in C#.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

1354
.Net Runtime Library for Delphi

ClrChar = _Char;

7.1.1.8.5.6 CNClrLib.Host.ClrDateTime Type


This is a type of TDateTime.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrDateTime = System.TDateTime;

7.1.1.8.5.7 CNClrLib.Host.ClrDecimal Type


Another form of floating point number which represent a decimal number. For more information, see Decimal
Structure in C#.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrDecimal = _Decimal;

7.1.1.8.5.8 CNClrLib.Host.ClrDouble Type


This is a type Double.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrDouble = System.Double;

7.1.1.8.5.9 CNClrLib.Host.ClrGuid Type


This is a type Guid.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax

1355
.Net Runtime Library for Delphi

Delphi

ClrGuid = _Guid;

7.1.1.8.5.10 CNClrLib.Host.ClrInt16 Type


This is a type SmallInt.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrInt16 = System.SmallInt;

7.1.1.8.5.11 CNClrLib.Host.ClrInt32 Type


This is a type Integer.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrInt32 = System.Integer;

7.1.1.8.5.12 CNClrLib.Host.ClrInt64 Type


This is a type Int64.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrInt64 = System.Int64;

7.1.1.8.5.13 CNClrLib.Host.ClrSByte Type


This is a type ShortInt.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

1356
.Net Runtime Library for Delphi

Syntax
Delphi

ClrSByte = System.ShortInt;

7.1.1.8.5.14 CNClrLib.Host.ClrSingle Type


This is a type Single.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrSingle = System.Single;

7.1.1.8.5.15 CNClrLib.Host.ClrString Type


This is a type String.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrString = System.String;

7.1.1.8.5.16 CNClrLib.Host.ClrUInt16 Type


This is a type Word.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrUInt16 = System.Word;

7.1.1.8.5.17 CNClrLib.Host.ClrUInt32 Type


This is a type LongWord.

File: CNClrLib.Host.pas

1357
.Net Runtime Library for Delphi

Namespace: CNClrLib.Host

Syntax
Delphi

ClrUInt32 = System.LongWord;

7.1.1.8.5.18 CNClrLib.Host.ClrUInt64 Type


This is a type Largeuint.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrUInt64 = ActiveX.Largeuint;

7.1.1.8.5.19 CNClrLib.Host.ClrUString Type


This is a type UnicodeString.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrUString = System.UnicodeString;

7.1.1.8.5.20 CNClrLib.Host.ClrVariant Type


This is a type OleVariant.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrVariant = System.OleVariant;

7.1.1.8.5.21 CNClrLib.Host.ClrWChar Type


This is a type WideChar.

1358
.Net Runtime Library for Delphi

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrWChar = System.Char;

7.1.1.8.5.22 CNClrLib.Host.ClrWString Type


This is a type WideString.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrWString = System.WideString;

7.1.1.8.5.23 CNClrLib.Host.TClrACharDynArray Type


Represents a dynamic array of ClrAChar.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrACharDynArray = array of ClrAChar;

7.1.1.8.5.24 CNClrLib.Host.TClrAStringDynArray Type


Represents a dynamic array of ClrAString.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrAStringDynArray = array of ClrAString;

1359
.Net Runtime Library for Delphi

7.1.1.8.5.25 CNClrLib.Host.TClrBase Type


This is the ultimate base class of all classes in the Host Class Library.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrBase = TInterfacedObject;

7.1.1.8.5.26 CNClrLib.Host.TClrBooleanDynArray Type


Represents a dynamic array of ClrBoolean.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrBooleanDynArray = array of ClrBoolean;

7.1.1.8.5.27 CNClrLib.Host.TClrByteDynArray Type


Represents a dynamic array of ClrByte.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrByteDynArray = array of ClrByte;

7.1.1.8.5.28 CNClrLib.Host.TClrCharDynArray Type


Represents a dynamic array of ClrChar.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

1360
.Net Runtime Library for Delphi

TClrCharDynArray = array of ClrChar;

7.1.1.8.5.29 CNClrLib.Host.TClrDateTimeDynArray Type


Represents a dynamic array of ClrDateTime.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrDateTimeDynArray = array of ClrDateTime;

7.1.1.8.5.30 CNClrLib.Host.TClrDecimalDynArray Type


Represents a dynamic array of ClrDecimal.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrDecimalDynArray = array of ClrDecimal;

7.1.1.8.5.31 CNClrLib.Host.TClrDoubleDynArray Type


Represents a dynamic array of ClrDouble.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrDoubleDynArray = array of ClrDouble;

7.1.1.8.5.32 CNClrLib.Host.TClrEventHandler Type


A standard method pointer for handling .net events invoked in the Common Language Runtime which does
not return a value.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax

1361
.Net Runtime Library for Delphi

Delphi

TClrEventHandler = procedure (ASender: _ClrObject; AEventArgs:


_ClrEventArgs);

7.1.1.8.5.33 CNClrLib.Host.TClrEventHandlerR Type


A standard method pointer for handling .net events invoked in the Common Language Runtime which returns
a value.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrEventHandlerR = procedure (ASender: _ClrObject; AEventArgs:


_ClrEventArgs; out ReturnValue: _ClrObject);

7.1.1.8.5.34 CNClrLib.Host.TClrExceptionDynArray Type


Represents a dynamic array of Clr Exception interface.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrExceptionDynArray = array of _Exception;

7.1.1.8.5.35 CNClrLib.Host.TClrExtendedDynArray Type


Represents a dynamic array of ClrExtended.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrExtendedDynArray = array of ClrExtended;

7.1.1.8.5.36 CNClrLib.Host.TClrInt16DynArray Type


Represents a dynamic array of ClrInt16.

File: CNClrLib.Host.pas

1362
.Net Runtime Library for Delphi

Namespace: CNClrLib.Host

Syntax
Delphi

TClrInt16DynArray = array of ClrInt16;

7.1.1.8.5.37 CNClrLib.Host.TClrInt32DynArray Type


Represents a dynamic array of ClrInt32.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrInt32DynArray = array of ClrInt32;

7.1.1.8.5.38 CNClrLib.Host.TClrInt64DynArray Type


Represents a dynamic array of ClrInt64.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrInt64DynArray = array of ClrInt64;

7.1.1.8.5.39 CNClrLib.Host.TClrObjectDynArray Type


Represents a dynamic array of _ClrObject interface.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrObjectDynArray = array of _ClrObject;

7.1.1.8.5.40 CNClrLib.Host.TClrSByteDynArray Type


Represents a dynamic array of ClrSByte.

1363
.Net Runtime Library for Delphi

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrSByteDynArray = array of ClrSByte;

7.1.1.8.5.41 CNClrLib.Host.TClrSingleDynArray Type


Represents a dynamic array of ClrSingle.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrSingleDynArray = array of ClrSingle;

7.1.1.8.5.42 CNClrLib.Host.TClrStringDynArray Type


Represents a dynamic array of ClrString.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrStringDynArray = array of ClrString;

7.1.1.8.5.43 CNClrLib.Host.TClrTypeDynArray Type


Represents a dynamic array of _Type Interface.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrTypeDynArray = array of _Type;

1364
.Net Runtime Library for Delphi

7.1.1.8.5.44 CNClrLib.Host.TClrUInt16DynArray Type


Represents a dynamic array of ClrUInt16.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrUInt16DynArray = array of ClrUInt16;

7.1.1.8.5.45 CNClrLib.Host.TClrUInt32DynArray Type


Represents a dynamic array of ClrUInt32.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrUInt32DynArray = array of ClrUInt32;

7.1.1.8.5.46 CNClrLib.Host.TClrUInt64DynArray Type


Represents a dynamic array of ClrUInt64.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrUInt64DynArray = array of ClrUInt64;

7.1.1.8.5.47 CNClrLib.Host.TClrVariantDynArray Type


Represents a dynamic array of ClrVariant.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

1365
.Net Runtime Library for Delphi

TClrVariantDynArray = array of ClrVariant;

7.1.1.8.5.48 CNClrLib.Host.TClrWCharDynArray Type


Represents a dynamic array of ClrWChar.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrWCharDynArray = array of ClrWChar;

7.1.1.8.5.49 CNClrLib.Host.TClrWStringDynArray Type


Represents a dynamic array of ClrWString.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TClrWStringDynArray = array of ClrWString;

7.1.1.8.5.50 CNClrLib.Host.TExceptionDynArray Type


Represents a dynamic array of Delphi Exception.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

TExceptionDynArray = array of Exception;

7.1.1.8.5.51 CNClrLib.Host.TTClrObjectDynArray Type


Represents a dynamic array of TClrBaseObject.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax

1366
.Net Runtime Library for Delphi

Delphi

TTClrObjectDynArray = array of TClrBaseObject;

7.1.1.8.5.52 CNClrLib.Host.ClrExtended Type


This is a type Extended.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrExtended = System.Extended;

7.1.1.8.5.53 CNClrLib.Host.ClrIDispatch Type


This is a type IDispatch.

File: CNClrLib.Host.pas

Namespace: CNClrLib.Host

Syntax
Delphi

ClrVariant = System.IDispatch;

7.1.1.9 CNClrLib.TypeNames Namespace


This CNClrLib.TypeNames namespace contains the list of type names of all the CLR wrapper
classes.

7.1.2 Delphi Framework Class Library


The Delphi Framework Class Library is an interface representation of the .NET Framework class library in delphi which is
a collection of reusable types that tightly integrate with the Delphi Host Class Library. The Delphi Framework interfaces
enable you to accomplish a range of common programming tasks, including tasks such as string management, data
collection, database connectivity, and file access. In addition to these common tasks, the class library includes types that
support a variety of specialized development scenarios. The class library contains interfaces that provide access to
system functionality.
The following table represents the classification of the Delphi Framework Class Library namespaces.
Namespaces Description

CNClrLib.CodeDom The CNClrLib.CodeDom namespace 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.

1367
.Net Runtime Library for Delphi

Namespaces Description

CNClrLib.Collections The CNClrLib.Collections namespace contains interfaces that


define various standard, specialized, and generic collection objects.

CNClrLib.Common The CNClrLib.Common namespace contains interfaces


shared among the various namespaces to prevent self
circular reference error when compiling your delphi
application.

CNClrLib.ComponentModel The CNClrLib.ComponentModel namespace contains interfaces


that implement the run-time and design-time behavior of
components and controls.

CNClrLib.Configuration The CNClrLib.Configuration namespace contains interfaces for


handling configuration data, such as data in machine or application
configuration files.

CNClrLib.CSharp The CNClrLib.CSharp namespace 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#.

CNClrLib.Data The CNClrLib.Data namespace 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.

CNClrLib.Deployment The CNClrLib.Deployment namespace contains interfaces that


support deployment of ClickOnce applications.

CNClrLib.Device The CNClrLib.Device namespace 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. As a result, application
developers who use this API do not need to tailor
applications to specific hardware configurations.

CNClrLib.Diagnostics The CNClrLib.Diagnostics namespace contains interfaces that


enable you to interact with system processes, event logs, and
performance counters. It contains interfaces to interact with code
analysis tools, to support contracts, to extend design-time support for
application monitoring and instrumentation, to log event data using

1368
.Net Runtime Library for Delphi

Namespaces Description

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.

CNClrLib.DirectoryServices The CNClrLib.DirectoryServices namespace contains interfaces


that provide access to Active Directory.

CNClrLib.Drawing The CNClrLib.Drawing namespace contains interfaces that


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

CNClrLib.Dynamic The CNClrLib.Dynamic Linq namespace provides interfaces that


support Dynamic Language Runtime.

CNClrLib.EnterpriseServices The CNClrLib.EnterpriseServices namespace 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.

CNClrLib.IdentityModel The CNClrLib.IdentityModel namespace contains interfaces that are


used to provide authentication and authorization for applications.

CNClrLib.IO The CNClrLib.IO namespace 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.

CNClrLib.Linq The CNClrLib.Linq namespace contains interfaces that support


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

CNClrLib.Management The CNClrLib.Management namespace 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 so that they expose their management information and
events through WMI to potential customers.

1369
.Net Runtime Library for Delphi

Namespaces Description

CNClrLib.Media The CNClrLib.Media namespace contains interfaces for playing


sound files and accessing sounds provided by the system.

CNClrLib.Messaging The CNClrLib.Messaging namespace contains interfaces that


enable you to connect to, monitor, and administer message queues
on the network and to send, receive, or peek messages.

CNClrLib.Net The CNClrLib.Net namespace 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.

CNClrLib.Numerics The CNClrLib.Numerics namespace contains numeric interfaces that


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

CNClrLib.Printing The CNClrLib.Printing namespace 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.

CNClrLib.Resources The CNClrLib.Resources namespace contains interfaces that enable


developers to create, store, and manage an application's culture-
specific resources.

CNClrLib.Runtime The CNClrLib.Runtime namespace 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).

CNClrLib.Security The CNClrLib.Security namespace contains interfaces that represent


the .NET Framework security system and permissions. The namespace
also provides interfaces that control access to and audit securable

1370
.Net Runtime Library for Delphi

Namespaces Description

objects, allow authentication, provide crytographic services, control


access to operations and resources based on policy, and support
rights management of application-created content.

CNClrLib.ServiceModel The CNClrLib.ServiceModel namespace contains the interfaces


necessary to build Windows Communication Foundation (WCF)
service and client applications.

CNClrLib.ServiceProcess The CNClrLib.ServiceProcess namespace contains interfaces that


enable you to implement, install, and control Windows service
applications and extend design-time support for Windows service
applications.

CNClrLib.Speech The CNClrLib.Speech namespaces contain interfaces that support


speech recognition.

CNClrLib.SqlServer The CNClrLib.SqlServer namespace 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.

CNClrLib.System The CNClrLib.System namespace contains fundamental


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

CNClrLib.Text The CNClrLib.Text namespace contains interfaces for character


encoding and string manipulation. It also enables you to process text
using regular expressions.

CNClrLib.Threading The CNClrLib.Threading namespace contains interface that


enable multithreaded programming. The namespace
provides types that simplify the work of writing concurrent
and asynchronous code.

CNClrLib.Timers The CNClrLib.Timers namespace provides the Timer


component, which allows you to raise an event on a
specified interval.

CNClrLib.Transactions The CNClrLib.Transactions namespace contains interfaces that


support transactions with multiple, distributed participants, multiple
phase notifications, and durable enlistments.

CNClrLib.VisualBasic The CNClrLib.VisualBasic namespace contains classes that


support compilation and code generation using the Visual

1371
.Net Runtime Library for Delphi

Namespaces Description

Basic language. The namespace also contain types that


provide services to the Visual Basic compiler and types that
include support for the Visual Basic application model, the
My namespace, lambda expressions, and code conversion.

CNClrLib.Web The CNClrLib.Web namespace contains interface that enable


browser/server communication. Child namespaces 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
namespace does not contain all the types defined in
System.Web namespace of the .Net Framework Class
library. Feature releases of the product will contain all
the types defined in the .Net System.Web namespace.

CNClrLib.Win32 The CNClrLib.Win32 namespace provides interface that handle


events raised by the operating system, that manipulate the system
registry, and that represent file and operating system handles.

CNClrLib.Windows The CNClrLib.Windows namespace contains interface used in


Windows Presentation Foundation (WPF) applications,
including animation clients, user interface controls, data
binding, and type conversion. This namespace does not
contain all the types defined in System.Windows namespace
of the .Net Framework Class library. Feature releases of the
product will contain all the types defined in the .Net
System.Windows namespace.

CNClrLib.Xaml The CNClrLib.Xaml namespace contains interface that support


parsing and processing the Extensible Application Markup Language
(XAML).

CNClrLib.Xml The CNClrLib.Xml namespace contains interface for processing


XML. The namespace also contains interfaces that support
serialization of XML documents or streams, XSD schemas, XQuery 1.0
and XPath 2.0, and LINQ to XML, which is an in-memory XML
programming interface that enables easy modification of XML
documents.

7.1.2.1 CNClrLib.CodeDom Namespace


The CNClrLib.CodeDom namespace 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.
These interfaces are defined as classes and interfaces in C# System.CodeDom Namespaces.

1372
.Net Runtime Library for Delphi

For Examples, go to Dynamic Source Code Generation and Compilation.

7.1.2.2 CNClrLib.Collections Namespace


The CNClrLib .Collections namespace contains interfaces that define various standard, specialized, and generic
collection objects. These interfaces are defined as classes and interfaces in C# System.Collections
Namespaces.

Example 1
The following example demonstrates several properties and methods of the _GenericL ist
interface of type string. The default constructor is used to create a list of strings with the default
capacity. The Capacity property is displayed and then the Add method is used to add several
items. The items are listed, and the Capacity property is displayed again, along with the Count
property, to show that the capacity has been increased as needed. The Contains method is
used to test for the presence of an item in the list, the Insert method is used to insert a new
item in the middle of the list, and the contents of the list are displayed again. The default Item
property is used to retrieve an item, the Remove method is used to remove the first instance of
the duplicate item added earlier, and the contents are displayed again. The Remove method
always removes the first instance it encounters. The TrimExcess method is used to reduce the
capacity to match the count, and the Capacity and Count properties are displayed. If the
unused capacity had been less than 10 percent of total capacity, the list would not have been
resized. Finally, the Clear method is used to remove all items from the list, and the Capacity
and Count properties are displayed.

Delphi

program Example;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils, CNClrLib.Host, CNClrLib.Core, CNClrLib.Collections,

CNClrLib.TypeNames;

var

dinosaurs: _GenericList;

Console: _Console;

I: Integer;

begin

try

1373
.Net Runtime Library for Delphi

Console := CoConsole.CreateInstance;

dinosaurs :=
CoGenericList.CreateInstance(TClrAssembly.GetType('System.String'));

try

Console.WriteLine_15('\nCapacity: {0}', dinosaurs.Capacity);

dinosaurs.Add('Tyrannosaurus');

dinosaurs.Add('Amargasaurus');

dinosaurs.Add('Mamenchisaurus');

dinosaurs.Add('Deinonychus');

dinosaurs.Add('Compsognathus');

Console.WriteLine();

for I := 0 to dinosaurs.Count - 1 do

Console.WriteLine_14(dinosaurs[I]);

Console.WriteLine_15('\nCapacity: {0}', dinosaurs.Capacity);

Console.WriteLine_15('Count: {0}', dinosaurs.Count);

Console.WriteLine_15('\nContains(''Deinonychus''): {0}',
dinosaurs.Contains('Deinonychus'));

Console.WriteLine_14('\nInsert(2, ''Compsognathus'')');

dinosaurs.Insert(2, 'Compsognathus');

Console.WriteLine();

for I := 0 to dinosaurs.Count - 1 do

Console.WriteLine_14(dinosaurs[I]);

// Shows accessing the list using the Item property.

Console.WriteLine_15('\ndinosaurs[3]: {0}', dinosaurs[3]);

Console.WriteLine_14('\nRemove(''Compsognathus'')');

dinosaurs.Remove('Compsognathus');

Console.WriteLine();

1374
.Net Runtime Library for Delphi

for I := 0 to dinosaurs.Count - 1 do

Console.WriteLine_14(dinosaurs[I]);

dinosaurs.TrimExcess();

Console.WriteLine_14('\nTrimExcess()');

Console.WriteLine_15('Capacity: {0}', dinosaurs.Capacity);

Console.WriteLine_15('Count: {0}', dinosaurs.Count);

dinosaurs.Clear();

Console.WriteLine_14('\nClear()');

Console.WriteLine_15('Capacity: {0}', dinosaurs.Capacity);

Console.WriteLine_15('Count: {0}', dinosaurs.Count);

finally

Console := nil;

dinosaurs:= nil;

end;

except

on E: Exception do

Writeln(E.ClassName, ': ', E.Message);

end;

end.

//This code example produces the following output:

//

//Capacity: 0

//

//Tyrannosaurus

//Amargasaurus

//Mamenchisaurus

//Deinonychus

//Compsognathus

//

1375
.Net Runtime Library for Delphi

//Capacity: 8

//Count: 5

//

//Contains("Deinonychus"): True

//

//Insert(2, "Compsognathus")

//

//Tyrannosaurus

//Amargasaurus

//Compsognathus

//Mamenchisaurus

//Deinonychus

//Compsognathus

//

//dinosaurs[3]: Mamenchisaurus

//

//Remove("Compsognathus")

//

//Tyrannosaurus

//Amargasaurus

//Mamenchisaurus

//Deinonychus

//Compsognathus

//

//TrimExcess()

//Capacity: 5

//Count: 5

//

//Clear()

//Capacity: 5

//Count: 0

1376
.Net Runtime Library for Delphi

1377
.Net Runtime Library for Delphi

1378
.Net Runtime Library for Delphi

Example 2
The following code example creates an empty GenericDictionary of strings with string keys and uses the Add method to
add some elements. The example demonstrates that the Add method throws an ArgumentException when attempting
to add a duplicate key. The example uses the Item property to retrieve values, demonstrating that a
KeyNotFoundException is thrown when a requested key is not present, and showing that the value associated with a key
can be replaced. The example shows how to use the TryGetValue method as a more efficient way to retrieve values if a
program often must try key values that are not in the dictionary, and it shows how to use the ContainsKey method to
test whether a key exists before calling the Add method. The example shows how to enumerate the keys and values in
the dictionary and how to enumerate the keys and values alone using the Keys property and the Values property.
Finally, the example demonstrates the Remove method.

Delphi

program Example;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils, CNClrLib.Host, CNClrLib.Core, CNClrLib.Collections,

CNClrLib.TypeNames;

var

openWith: _GenericDictionary;

1379
.Net Runtime Library for Delphi

openWith_Enum: _GenericDictionary_Enumerator;

valueColl: _GenericDictionary_ValueCollection;

valueCollEnum: _GenericValueCollection_Enumerator;

keyColl: _GenericDictionary_KeyCollection;

keyCollEnum: _GenericKeyCollection_Enumerator;

Console: _Console;

I: Integer;

valueO: OleVariant;

begin

try

Console := CoConsole.CreateInstance;

try

// Create a new dictionary of strings, with string keys.

openWith :=
CoGenericDictionary.CreateInstance(TClrAssembly.GetType('System.String
'),

TClrAssembly.GetType('System.String'));

// Add some elements to the dictionary. There are no

// duplicate keys, but some of the values are duplicates.

openWith.Add('txt', 'notepad.exe');

openWith.Add('bmp', 'paint.exe');

openWith.Add('dib', 'paint.exe');

openWith.Add('rtf', 'wordpad.exe');

// The Add method throws an exception if the new key is

// already in the dictionary.

try

openWith.Add('txt', 'winword.exe');

except //(ArgumentException)

Console.WriteLine_14('An element with Key = ''txt'' already


exists.');

end;

1380
.Net Runtime Library for Delphi

// The Item property is another name for the indexer, so you

// can omit its name when accessing elements.

Console.WriteLine_15('For key = ''rtf'', value = {0}.',


openWith['rtf']);

// The indexer can be used to change the value associated

// with a key.

openWith['rtf'] := 'winword.exe';

Console.WriteLine_15('For key = ''rtf'', value = {0}.',


openWith['rtf']);

// If a key does not exist, setting the indexer for that key

// adds a new key/value pair.

openWith['doc'] := 'winword.exe';

// The indexer throws an exception if the requested key is

// not in the dictionary.

try

Console.WriteLine_15('For key = ''tif'', value = {0}.',


openWith['tif']);

except //(KeyNotFoundException)

Console.WriteLine_14('Key = ''tif'' is not found.');

end;

// When a program often has to try keys that turn out not to

// be in the dictionary, TryGetValue can be a more efficient

// way to retrieve values.

if (openWith.TryGetValue('tif', valueO)) then

Console.WriteLine_15('For key = ''tif'', value = {0}.',


valueO)

else

Console.WriteLine_14('Key = ''tif'' is not found.');

// ContainsKey can be used to test keys before inserting them.

if (not openWith.ContainsKey('ht')) then

1381
.Net Runtime Library for Delphi

begin

openWith.Add('ht', 'hypertrm.exe');

Console.WriteLine_15('Value added for key = ''ht'': {0}',


openWith['ht']);

end;

// When you use when loop to enumerate dictionary elements from


GetEnumerator,

// the elements are retrieved as KeyValuePair objects.

Console.WriteLine();

openWith_Enum := openWith.GetEnumerator;

while openWith_Enum.MoveNext do

Console.WriteLine_17('Key = {0}, Value = {1}',


openWith_Enum.Current.Key, openWith_Enum.Current.Value);

// To get the values alone, use the Values property.

valueColl := openWith.Values;

valueCollEnum := valueColl.GetEnumerator;

// The elements of the ValueCollection are strongly typed

// with the type that was specified for dictionary values.

Console.WriteLine();

while valueCollEnum.MoveNext do

Console.WriteLine_15('Value = {0}', valueCollEnum.Current);

// To get the keys alone, use the Keys property.

keyColl := openWith.Keys;

keyCollEnum := keyColl.GetEnumerator;

// The elements of the KeyCollection are strongly typed

// with the type that was specified for dictionary keys.

Console.WriteLine();

while keyCollEnum.MoveNext do

Console.WriteLine_15('Key = {0}', keyCollEnum.Current);

1382
.Net Runtime Library for Delphi

// Use the Remove method to remove a key/value pair.

Console.WriteLine_14('Remove(''doc'')');

openWith.Remove('doc');

if (not openWith.ContainsKey('doc')) then

Console.WriteLine_14('Key ''doc'' is not found.');

finally

Console := nil;

end;

except

on E: Exception do

Writeln(E.ClassName, ': ', E.Message);

end;

end.

//This code example produces the following output:

//

//An element with Key = 'txt' already exists.

//For key = 'rtf', value = wordpad.exe.

//For key = 'rtf', value = winword.exe.

//Key = 'tif' is not found.

//Key = 'tif' is not found.

//Value added for key = 'ht': hypertrm.exe

//

//Key = txt, Value = notepad.exe

//Key = bmp, Value = paint.exe

//Key = dib, Value = paint.exe

//Key = rtf, Value = winword.exe

//Key = doc, Value = winword.exe

//Key = ht, Value = hypertrm.exe

//

//Value = notepad.exe

1383
.Net Runtime Library for Delphi

//Value = paint.exe

//Value = paint.exe

//Value = winword.exe

//Value = winword.exe

//Value = hypertrm.exe

//

//Key = txt

//Key = bmp

//Key = dib

//Key = rtf

//Key = doc

//Key = ht

//Remove('doc')

//Key 'doc' is not found.

1384
.Net Runtime Library for Delphi

1385
.Net Runtime Library for Delphi

1386
.Net Runtime Library for Delphi

Example 3
Delphi

program Example;

{$APPTYPE CONSOLE}

{$R *.res}

uses

System.SysUtils, CNClrLib.Host, CNClrLib.Core, CNClrLib.Collections,

CNClrLib.TypeNames, CNClrLib.Host.Helper;

var

Console: _Console;

names : _StringArray;

names_Enum: _IEnumerator;

arrayList: _ArrayList;

stringList: _StringCollection;

stringListD: _StringDictionary;

stringListD_Values_Enum: _IEnumerator;

sortedList_Values_Enum: _IEnumerator;

Hashtable_Keys_Enum: _IEnumerator;

dictEnum: _IEnumerator;

1387
.Net Runtime Library for Delphi

stackObject: _Stack;

queueObject: _Queue;

bitArray: _BitArray;

hashTable: _Hashtable;

sortedList: _SortedList;

I, P: Integer;

begin

try

Console := CoConsole.CreateInstance;

try

//====================================================================
====

// Using _IEnumerable Interface

//====================================================================
====

//An enumerator is an object that provides a forward, read-only


cursor for a set of items.

//The _IEnumerable interface has one method called the


GetEnumerator() method.

//This method returns an object that implements the IEnumerator


interface.

//The code snippet below illustrates how an enumerator can be


used to iterate

//though a list or collection of items.

names := CoStringArray.CreateInstance(2);

names[0] := 'Joydip';

names[1] := 'Jini';

names_Enum := names.AsIEnumerator();

while names_Enum.MoveNext do

Console.WriteLine_12(names_Enum.Current);

//Note that the GetEnumerator() method returns an enumerator


object each time it is called.

1388
.Net Runtime Library for Delphi

//Further, the loop contains the Console.WriteLine_12 statement


in its re-initializer portion,

//which is perfectly valid. The condition being evaluated is


whether the MoveNext() method

//returns a value of true. The MoveNext() method returns true as


long as there are items in

//the collection. The Current property returns the current


object and is automatically typecast

//to string by making a call to the ToString() method


implicitly.

//====================================================================
====

// Using _ArrayList Interface

//====================================================================
====

//The _ArrayList interface is a dynamic array of heterogeneous


objects. Note that in an array

//we can store only objects of the same type. In an ArrayList,


however, we can have different

//type of objects; these in turn would be stored as object type


only. We can have an ArrayList

//object that stores integer, float, string, etc., but all these
objects would only be stored as

//object type. An ArrayList uses its indexes to refer to a


particular object stored in its collection.

//The Count property gives the total number of items stored in


the ArrayList object.

//The Capacity property gets or sets the number of items that


the ArrayList object can contain.

//Objects are added using the Add() method of the ArrayList and
removed using its Remove() method.

//An example of usage of an ArrayList is given below.

arrayList := CoArrayList.CreateInstance;

arrayList.Add('Joydip');

arrayList.Add(100);

arrayList.Add(20.5);

1389
.Net Runtime Library for Delphi

for I := 0 to arrayList.Count - 1 do

Console.WriteLine_12(arrayList[I]);

//It is to be noted here that the initial capacity of an


ArrayList is 16, which is increased once the

//17th item is stored onto it. This repeated memory allocation


and copying of the items can be quite

//expensive in some situations. For performance reasons we can


set the initial capacity of the object

//of an ArrayList by using the Capacity property or an


overloaded constructor of the ArrayList class.

//This is shown in the example below.

arrayList := CoArrayList.CreateInstance;

arrayList.Capacity := 3;

arrayList.Add('Joydip');

arrayList.Add(100);

arrayList.Add(20.5);

for I := 0 to arrayList.Count - 1 do

Console.WriteLine_12(arrayList[I]);

//====================================================================
====

// Using _StringCollection Interface

//====================================================================
====

//The StringCollection interface implements the IList interface


and is like an ArrayList of strings.

//The following code example shows how we can work with a


StringCollection class.

stringList := CoStringCollection.CreateInstance;

stringList.Add('Manashi');

stringList.Add('Joydip');

1390
.Net Runtime Library for Delphi

stringList.Add('Jini');

stringList.Add('Piku');

for I := 0 to stringList.Count - 1 do

Console.WriteLine_14(stringList[I]);

//====================================================================
====

// Using _StringDictionary Interface

//====================================================================
====

//Similar to the StringCollection interface we have the


StringDictionary interface,

//which is just a Hashtable that has its keys as strings only.


Remember that a Hashtable

//can contain any object type in its key. The following code
shows how we can work with a

//StringDictionary interface.

stringListD := CoStringDictionary.CreateInstance;

stringListD.Add('A', 'Manashi');

stringListD.Add('B','Joydip');

stringListD.Add('C','Jini');

stringListD.Add('D','Piku');

stringListD_Values_Enum :=
stringListD.Values.AsIEnumerable.GetEnumerator;

while stringListD_Values_Enum.MoveNext do

Console.WriteLine_14(stringListD_Values_Enum.Current);

//====================================================================
====

1391
.Net Runtime Library for Delphi

// Using _Stack Interface

//====================================================================
====

//The _Stack interface is one that provides a Last-in-First-out


(LIFO) collection of items

//of the System.Object type. The last added item is always at


the top of the Stack and is also

//the first one to be removed. The following code sample shows


how we can use a Stack class for

//LIFO operation on its collection of items.

stackObject := CoStack.CreateInstance;

stackObject.Push('Joydip');

stackObject.Push('Steve');

stackObject.Push('Jini');

while (stackObject.Count > 0) do

Console.WriteLine_12(stackObject.Pop());

Console.ReadLine();

//The Push() method is responsible for storing items in the


Stack and the method Pop()

//removes them one at a time from the top of the Stack.

//====================================================================
====

// Using _Queue Interface

//====================================================================
====

//Unlike the Stack interface, the Queue is a data structure that


provides a First-in-First-out

//collection of items of the Object type. The newly added items


are stored at the end or

//the rear of the Queue and items are deleted from the front of
the Queue.

//The following code shows how the Queue class can be used.

1392
.Net Runtime Library for Delphi

queueObject := CoQueue.CreateInstance;

queueObject.Enqueue('Joydip');

queueObject.Enqueue('Steve');

queueObject.Enqueue('Jini');

while (queueObject.Count > 0) do

Console.WriteLine_12(queueObject.Dequeue());

Console.ReadLine();

//The Enqueue() method is responsible for storing items at the


rear of the Queue and the method Dequeue()

//removes them one at a time from the front of the Queue.

//====================================================================
====

// Using _BitArray Interface

//====================================================================
====

//The BitArray interface can be used to store bits in an array.


They can be set to true or false,

//depending on the parameter supplied at the time of creating


the BitArray object.

//The following is an example of its usage.

bitArray := CoBitArray.CreateInstance(5, false);

// Or

bitArray := CoBitArray.CreateInstance(5, true);

// Similar to the other collections discussed above, the


BitArray interface also contains the

//Count property to get the number of items stored in this


collection of bit values.

//The following methods of the BitArray class allow logical bit


operation.

// · And

1393
.Net Runtime Library for Delphi

// · Or

// · Not

// · Xor

//====================================================================
====

// Using _Hashtable Interface

//====================================================================
====

//The Hashtable provides a faster way of storage and retrieval


of items of the object type.

//The Hashtable class provides support for key based searching.


These keys are unique hash codes that

//are unique to a specific type. The GetHashCode() method of


the Hashtable class returns the hash code

//for an object instance. The following code snippet shows how


we can use a Hashtable interface.

hashTable := CoHashtable.CreateInstance;

hashTable.Add(1, 'Joydip');

hashTable.Add(2, 'Manashi');

hashTable.Add(3, 'Jini');

hashTable.Add(4, 'Piku');

Console.WriteLine_14('The keysare:--');

Hashtable_Keys_Enum :=
hashTable.Keys.AsIEnumerable.GetEnumerator;

while Hashtable_Keys_Enum.MoveNext do

Console.WriteLine_12(Hashtable_Keys_Enum.Current);

Console.WriteLine_14('Please enter the keyto search');

p := TClrInt32Helper.Parse(Console.ReadLine());

Console.WriteLine_12(hashTable[p]);

1394
.Net Runtime Library for Delphi

//To remove an item from the Hashtable interface, the Remove()


method is used.

//The statement hashTable.Remove(3) would remove the item “Jini”


from the Hashtable

//object created in the above code. The code shown above can
also be written as shown below

//to display the contents of the Hashtable object using


IDictionaryEnumerator.

hashTable := CoHashtable.CreateInstance;

hashTable.Add(1, 'Joydip');

hashTable.Add(2, 'Manashi');

hashTable.Add(3, 'Jini');

hashTable.Add(4, 'Piku');

Console.WriteLine_14('The keysare:--');

dictEnum := hashTable.GetEnumerator().AsIEnumerator;

while dictEnum.MoveNext do

Console.WriteLine_12(hashTable[p]);

//====================================================================
====

// Using _SortedList Interface

//====================================================================
====

//The _SortedList interface allows items of the Object type to


be placed in the

//collection using key value pairs and, at the same time,


supports sorting.

//The following code shows how we can use a SortedList.

sortedList := CoSortedList.CreateInstance;

sortedList.Add(1, 'Manashi');

sortedList.Add(3, 'Joydip');

sortedList.Add(2, 'Jini');

1395
.Net Runtime Library for Delphi

sortedList.Add(4, 'Piku');

Console.WriteLine_14('Displaying thenames');

sortedList_Values_Enum:=
sortedList.Values.AsIEnumerable.GetEnumerator;

while sortedList_Values_Enum.MoveNext do

Console.WriteLine_14(sortedList_Values_Enum.Current);

//The output of the above code is:

// Manashi

// Jini

// Joydip

// Piku

//The same code can be written using IDictionaryEnumerator to


display all the items of the

//SortedList object, as shown below.

sortedList := CoSortedList.CreateInstance;

sortedList.Add(1, 'Manashi');

sortedList.Add(3, 'Joydip');

sortedList.Add(2, 'Jini');

sortedList.Add(4, 'Piku');

Console.WriteLine_14('Displaying thenames');

dictEnum := sortedList.Values.AsIEnumerable.GetEnumerator;

while dictEnum.MoveNext do

Console.WriteLine_12(dictEnum.Current);

Console.ReadLine();

finally

Console := nil;

end;

except

1396
.Net Runtime Library for Delphi

on E: Exception do

Writeln(E.ClassName, ': ', E.Message);

end;

end.

7.1.2.3 CNClrLib.Common Namespace


The CNClrLib.Common namespace contains interfaces that are shared among the various
namespaces to prevent self circular reference error when compiling your delphi application.

It contains interfaces defined in the following namespaces:

 CNClrLib.CodeDom Namespace
 CNClrLib.ComponentModel Namespace
 CNClrLib.Configuration Namespace
 CNClrLib.Data Namespace
 CNClrLib.Diagnostics Namespace
 CNClrLib.DirectoryServices Namespace
 CNClrLib.Drawing Namespace
 CNClrLib.Dynamic Namespace
 CNClrLib.DynamicLinq Namespace
 CNClrLib.EnterpriseServices Namespace
 CNClrLib.IdentityModel Namespace
 CNClrLib.Linq Namespace
 CNClrLib.Net Namespace
 CNClrLib.Printing Namespace
 CNClrLib.Runtime Namespace
 CNClrLib.Security Namespace
 CNClrLib.System Namespace
 CNClrLib.Threading Namespace
 CNClrLib.Transactions Namespace
 CNClrLib.Web Namespace
 CNClrLib.Windows Namespace
 CNClrLib.Xaml Namespace
 CNClrLib.Xml Namespace

7.1.2.4 CNClrLib.ComponentModel Namespace


The CNClrLib.ComponentModel namespace contains interfaces that implement the run-time and design-time behavior
of components and controls. These interfaces are defined as classes and interfaces in C#
System.ComponentModel Namespaces.

Example 1

The following code example declares and initializes an 8-bit unsigned


integer and a string. The code then converts each of them to the other's
type, respectively.

1397
.Net Runtime Library for Delphi

Delphi
program ByteConverterExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.ComponentModel,

CNClrLib.EnumTypes,

CNClrLib.Host,

CNClrLib.Core;

var

Console: _Console;

myUint: ClrByte;

myUStr: ClrString;

TypeDescriptor : _TypeDescriptor;

begin

Console := CoConsole.CreateInstance;

TypeDescriptor :=
CoTypeDescriptor.CreateInstance;

myUint := 5;

myUStr := '2';

1398
.Net Runtime Library for Delphi

Console.WriteLine_14(TypeDescriptor.GetConverter(m
yUint).ConvertTo(myUint,
TClrAssembly.GetType(tcString)));

Console.WriteLine_14(TypeDescriptor.GetConverter(m
yUint).ConvertFrom(myUStr));

end.

Example 2

1399
.Net Runtime Library for Delphi

The following code example converts a variable of type CultureInfo to


a string, and vice versa. First it constructs a CultureInfo variable using
the Greek culture (represented by "el") and converts it to the string
"Greek". Then it converts the string "Russian" to the CultureInfo
representation "ru".

Delphi

program CultureInfoConverterExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.ComponentModel,

CNClrLib.EnumTypes,

CNClrLib.Host,

CNClrLib.Core;

var

Console: _Console;

myCulture: _CultureInfo;

myCString: ClrString;

TypeDescriptor : _TypeDescriptor;

begin

Console := CoConsole.CreateInstance;

1400
.Net Runtime Library for Delphi

// The sample first constructs a CultureInfo


variable using the Greek culture - 'el'.

myCulture := CoCultureInfo.CreateInstance('el');

myCString := 'Russian';

TypeDescriptor :=
CoTypeDescriptor.CreateInstance;

Console.WriteLine_14(TypeDescriptor.GetConverter(m
yCulture).ConvertTo(myCulture,
TClrAssembly.GetType(tcString)));

// The following line will output 'ru' based on


the string being converted.

Console.WriteLine_14(TypeDescriptor.GetConverter(m
yCulture).ConvertFrom(myCString));

end.

7.1.2.5 CNClrLib.Configuration Namespace


The CNClrLib.Configuration namespace contains interfaces that provides the programming model for handling
configuration data, such as data in machine or application configuration files. These interfaces are defined as
classes and interfaces in C# System.Configuration Namespaces.

Example
The first example shows a simple console application that reads application settings, adds a new
setting, and updates an existing setting.

Delphi

program ConfigurationExample;

{$APPTYPE CONSOLE}

{$R *.res}

1401
.Net Runtime Library for Delphi

uses

System.SysUtils,

CNClrLib.Host,

CNClrLib.Core,

CNClrLib.Collections,

CNClrLib.Configuration,

CNClrLib.Enums;

var

Console: _Console;

procedure ReadAllSettings;

var

appSettings: _NameValueCollection;

ConfigManager: _ConfigurationManager;

I: Integer;

AKey: string;

begin

try

ConfigManager := CoConfigurationManager.CreateInstance;

appSettings := ConfigManager.AppSettings;

if appSettings.Count = 0 then

Console.WriteLine_14('AppSettings is empty.')

else

begin

for I := 0 to appSettings.AllKeys.Length - 1 do

begin

AKey := appSettings.AllKeys.GetValue(i);

Console.WriteLine_17('Key: {0} Value: {1}', AKey,


appSettings.Item[AKey]);

end;

end;

1402
.Net Runtime Library for Delphi

except

Console.WriteLine_14('Error reading app settings');

end;

end;

procedure ReadSetting(Key: String);

var

appSettings: _NameValueCollection;

ConfigManager: _ConfigurationManager;

I: Integer;

result: string;

begin

try

ConfigManager := CoConfigurationManager.CreateInstance;

appSettings := ConfigManager.AppSettings;

result := appSettings.Item[Key];

if result = '' then

result := 'Not Found';

Console.WriteLine_14(result);

except

Console.WriteLine_14('Error reading app settings');

end;

end;

procedure AddUpdateAppSettings(Key, value: String);

var

configFile: _Configuration;

ConfigManager: _ConfigurationManager;

settings: _KeyValueConfigurationCollection;

I: Integer;

result: string;

begin

1403
.Net Runtime Library for Delphi

try

ConfigManager := CoConfigurationManager.CreateInstance;

configFile :=
ConfigManager.OpenExeConfiguration(ConfigurationUserLevel_None);

settings := configFile.AppSettings.Settings;

if settings[Key] = nil then

settings.Add_1(key, value)

else

settings[Key].Value := value;

configFile.Save_1(ConfigurationSaveMode_Modified);

ConfigManager.RefreshSection(configFile.AppSettings.SectionInformation
.Name);

except

Console.WriteLine_14('Error writing app settings');

end;

end;

begin

try

Console := CoConsole.CreateInstance;

ReadAllSettings;

ReadSetting('Setting1');

ReadSetting('NotValid');

AddUpdateAppSettings('NewSetting', 'May 7, 2014');

AddUpdateAppSettings('Setting1', 'May 8, 2014');

ReadAllSettings;

Console.ReadLine;

except

on E: Exception do

Writeln(E.ClassName, ': ', E.Message);

end;

end.

1404
.Net Runtime Library for Delphi

1405
.Net Runtime Library for Delphi

The above example assumes your project has an


ConfigurationExample.exe.config file as shown below.

XML

1406
.Net Runtime Library for Delphi

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<startup>
<supportedRuntime version="v4.0"
sku=".NETFramework,Version=v4.5" />

</startup>

<appSettings>
<add key="Setting1" value="May 5, 2014"/>

<add key="Setting2" value="May 6, 2014"/>

</appSettings>
</configuration>

7.1.2.6 CNClrLib.CSharp Namespace


The CNClrLib.CSharp namespace 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#. These interfaces are defined as classes
and interfaces in C# Microsoft.CSharp Namespaces.

ExamplesThe following example uses either the C# or Visual Basic code provider to
compile a source file. The example checks the input file extension and uses the corresponding
CSharpCodeProvider or VBCodeProvider for compilation. The input file is compiled into an
executable file, and any compilation errors are displayed to the console.

Delphi

program CompileAssemblyFromFile;

{$APPTYPE CONSOLE}

{$R *.res}

uses

SysUtils,

CNClrLib.VisualBasic,

CNClrLib.CodeDom,

1407
.Net Runtime Library for Delphi

CNClrLib.Host,

CNClrLib.Host.Helper,

CNClrLib.Core;

var

Console: _Console;

function CompileExecutable(ASourceName: string): Boolean;

var

sourceFile: _FileInfo;

provider: _CodeDomProvider;

cp: _CompilerParameters;

cr: _CompilerResults;

providerStatic: _CodeDomProviderHelper;

cultureInfoStatic : _CultureInfoHelper;

environment: _Environment;

exeName: string;

I: Integer;

begin

sourceFile := CoFileInfo.CreateInstance(ASourceName);

provider := nil;

cultureInfoStatic := CoCultureInfoHelper.CreateInstance;

providerStatic := CoCodeDomProviderHelper.CreateInstance;

environment := CoEnvironment.CreateInstance;

// Select the code provider based on the input file extension.

if TClrStringHelper.ToUpper(sourceFile.Extension,
cultureInfoStatic.InvariantCulture) = '.CS' then

begin

provider := providerStatic.CreateProvider_1('CSharp');

end

else if TClrStringHelper.ToUpper(sourceFile.Extension,
cultureInfoStatic.InvariantCulture) = '.VB' then

1408
.Net Runtime Library for Delphi

begin

provider := providerStatic.CreateProvider_1('VisualBasic');

end

else

begin

Console.WriteLine_14('Source file must have a .cs or .vb


extension');

end;

if provider <> nil then

begin

// Format the executable file name.

// Build the output assembly path using the current directory

// and <source>_cs.exe or <source>_vb.exe.

exeName := TClrStringHelper.Format('{0}\{1}.exe',

environment.CurrentDirectory,

TClrStringHelper.Replace(sourceFile.Name, '.',
'_'));

cp := CoCompilerParameters.CreateInstance;

// Generate an executable instead of

// a class library.

cp.GenerateExecutable := True;

// Specify the assembly file name to generate.

cp.OutputAssembly := exeName;

// Save the assembly as a physical file.

cp.GenerateInMemory := False;

// Set whether to treat all warnings as errors.

cp.TreatWarningsAsErrors := False;

1409
.Net Runtime Library for Delphi

// Invoke compilation of the source file.

cr := provider.CompileAssemblyFromFile(cp,
TClrArrayHelper.ToStringArray([ASourceName]));

if cr.Errors.Count > 0 then

begin

// Display compilation errors.

Console.WriteLine_17('Errors building {0} into {1}',


ASourceName, cr.PathToAssembly);

for I := 0 to cr.Errors.Count - 1 do

begin

Console.WriteLine_15(' {0}', cr.Errors[I].ToString());

Console.WriteLine;

end;

end

else

begin

// Display a successful compilation message.

Console.WriteLine_17('Source {0} built into {1}


successfully.', ASourceName, cr.PathToAssembly);

end;

Result := cr.Errors.Count = 0; //If True; Compiled OK, otherwise


it failed to compile;

end;

end;

var

afile: _File;

afileName: string;

begin

try

Console := CoConsole.CreateInstance;

1410
.Net Runtime Library for Delphi

Console.Write_22('Enter a source file path to compile: ');

afileName := Console.ReadLine;

afile := CoFile.CreateInstance;

if afile.Exists(afileName) then

begin

CompileExecutable(afileName);

end

else

begin

Console.WriteLine_15('Input source file not found - {0}',


afileName);

end;

except

on E: Exception do

begin

Console.WriteLine_14(E.message);

end;

end;

end.

1411
.Net Runtime Library for Delphi

1412
.Net Runtime Library for Delphi

7.1.2.7 CNClrLib.Data Namespace


The CNClrLib.Data namespace 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. These
interfaces are defined as classes and interfaces in C# System.Data Namespaces.

DataSet Examples
The following example consists of several methods that, combined, create and fill a DataSet from the Northwind
database.
Delphi

program NorthwindDataSet;

1413
.Net Runtime Library for Delphi

{$APPTYPE CONSOLE}

{$R *.res}

uses

SysUtils,

CNClrLib.Enums,

CNClrLib.Data,

CNClrLib.Core;

var

Console: _Console;

procedure ConnectToData(connectionString: string);

var

connection: _SqlConnection;

adapter: _SqlDataAdapter;

command: _SqlCommand;

dataSet: _DataSet;

productsAdapter: _SqlDataAdapter;

productsCommand: _SqlCommand;

parentColumn,

childColumn: _DataColumn;

relation: _DataRelation;

begin

//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');

1414
.Net Runtime Library for Delphi

// Open the connection.

connection.Open;

Console.WriteLine_14('The SqlConnection is open.');

// Create a SqlCommand to retrieve Suppliers data.

command := CoSqlCommand.CreateInstance(

'SELECT SupplierID, CompanyName FROM dbo.Suppliers;',

connection);

command.CommandType := CommandType_Text;

// Set the SqlDataAdapter's SelectCommand.

adapter.SelectCommand := command;

// Fill the DataSet.

dataSet := CoDataSet.CreateInstance('Suppliers');

adapter.Fill(dataSet);

// 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;',

connection);

productsAdapter.SelectCommand := productsCommand;

// Fill the DataSet.

productsAdapter.Fill(dataSet);

// Close the connection.

connection.Close();

Console.WriteLine_14('The SqlConnection is closed.');

1415
.Net Runtime Library for Delphi

// 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);

dataSet.Relations.Add(relation);

Console.WriteLine_15('The {0} DataRelation has been created.',


relation.RelationName);

end;

function GetConnectionString: string;

begin

// 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';

end;

var

connectionString: string;

begin

try

Console := CoConsole.CreateInstance;

connectionString := GetConnectionString;

ConnectToData(connectionString);

except

on E: Exception do

begin

Console.WriteLine_14(E.message);

end;

1416
.Net Runtime Library for Delphi

end;

end.

1417
.Net Runtime Library for Delphi

DataTable Examples
The following example creates two DataTable objects and one DataRelation object, and adds the new objects to a
DataSet.
Delphi

program DataTableExample;

{$APPTYPE CONSOLE}

{$R *.res}

1418
.Net Runtime Library for Delphi

uses

SysUtils,

CNClrLib.Data,

CNClrLib.Enums,

CNClrLib.Host,

CNClrLib.Core;

var

Console: _Console;

dataSet: _DataSet;

procedure MakeParentTable;

var

table: _DataTable;

column: _DataColumn;

row: _DataRow;

PrimaryKeyColumns: _DataColumnArray;

I: Integer;

begin

// Create a new DataTable.

table := CoDataTable.CreateInstance('ParentTable');

// Create new DataColumn, set DataType,

// ColumnName and add to DataTable.

column := CoDataColumn.CreateInstance;

column.DataType := TClrAssembly.GetType('System.Int32');

column.ColumnName := 'id';

column.ReadOnly := true;

column.Unique := true;

// Add the Column to the DataColumnCollection.

table.Columns.Add(column);

1419
.Net Runtime Library for Delphi

// Create second column.

column := CoDataColumn.CreateInstance;

column.DataType := TClrAssembly.GetType('System.String');

column.ColumnName := 'ParentItem';

column.AutoIncrement := false;

column.Caption := 'ParentItem';

column.ReadOnly := false;

column.Unique := false;

// Add the column to the table.

table.Columns.Add(column);

// Make the ID column the primary key column.

PrimaryKeyColumns := CoDataColumnArray.CreateInstance(1);

PrimaryKeyColumns[0] := table.Columns.Item_1['id'];

table.PrimaryKey := PrimaryKeyColumns;

// Instantiate the DataSet variable.

dataSet := CoDataSet.CreateInstance;

// Add the new DataTable to the DataSet.

dataSet.Tables.Add(table);

// Create three new DataRow objects and add

// them to the DataTable

for I := 0 to 2 do

begin

row := table.NewRow;

row.Item_1['id'] := i;

row.Item_1['ParentItem'] := 'ParentItem ' + i.ToString;

table.Rows.Add(row);

end;

end;

1420
.Net Runtime Library for Delphi

procedure MakeChildTable;

var

table: _DataTable;

column: _DataColumn;

row: _DataRow;

I: Integer;

begin

// Create a new DataTable.

table := CoDataTable.CreateInstance('childTable');

// Create first column and add to the DataTable.

column := CoDataColumn.CreateInstance;

column.DataType := TClrAssembly.GetType('System.Int32');

column.ColumnName := 'ChildID';

column.AutoIncrement := true;

column.Caption := 'ID';

column.ReadOnly := true;

column.Unique := true;

// Add the column to the DataColumnCollection.

table.Columns.Add(column);

// Create second column.

column := CoDataColumn.CreateInstance;

column.DataType := TClrAssembly.GetType('System.String');

column.ColumnName := 'ChildItem';

column.AutoIncrement := false;

column.Caption := 'ChildItem';

column.ReadOnly := false;

column.Unique := false;

table.Columns.Add(column);

// Create third column.

1421
.Net Runtime Library for Delphi

column := CoDataColumn.CreateInstance;

column.DataType := TClrAssembly.GetType('System.Int32');

column.ColumnName := 'ParentID';

column.AutoIncrement := false;

column.Caption := 'ParentID';

column.ReadOnly := false;

column.Unique := false;

table.Columns.Add(column);

dataSet.Tables.Add(table);

// Create three sets of DataRow objects,

// five rows each, and add to DataTable.

for I := 0 to 4 do

begin

row := table.NewRow;

row.Item_1['childID'] := i;

row.Item_1['ChildItem'] := 'Item ' + i.ToString;

row.Item_1['ParentID'] := 0;

table.Rows.Add(row);

end;

for I := 0 to 4 do

begin

row := table.NewRow;

row.Item_1['childID'] := i + 5;

row.Item_1['ChildItem'] := 'Item ' + i.ToString;

row.Item_1['ParentID'] := 1;

table.Rows.Add(row);

end;

for I := 0 to 4 do

begin

1422
.Net Runtime Library for Delphi

row := table.NewRow;

row.Item_1['childID'] := i + 10;

row.Item_1['ChildItem'] := 'Item ' + i.ToString;

row.Item_1['ParentID'] := 2;

table.Rows.Add(row);

end;

end;

procedure MakeDataRelation;

var

parentColumn,

childColumn: _DataColumn;

relation: _DataRelation;

begin

// DataRelation requires two DataColumn

// (parent and child) and a name.

parentColumn :=
dataSet.Tables.Item_1['ParentTable'].Columns.Item_1['id'];

childColumn :=
dataSet.Tables.Item_1['ChildTable'].Columns.Item_1['ParentID'];

relation := CoDataRelation.CreateInstance('parent2Child',
parentColumn, childColumn);

dataSet.Tables.Item_1['ChildTable'].ParentRelations.Add(relation);

end;

procedure MakeDataTables;

begin

// Run all of the functions.

MakeParentTable;

MakeChildTable;

MakeDataRelation;

end;

begin

1423
.Net Runtime Library for Delphi

try

MakeDataTables;

except

on E: Exception do

begin

Console.WriteLine_14(E.message);

end;

end;

end.

1424
.Net Runtime Library for Delphi

1425
.Net Runtime Library for Delphi

1426
.Net Runtime Library for Delphi

DataReader Examples
The following code example iterates through a DataReader object, and returns two columns
from each row.

Delphi

program DataReaderExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

SysUtils,

CNClrLib.Data,

CNClrLib.Core;

var

Console: _Console;

procedure HasRows(connection: _SqlConnection);

var

command: _SqlCommand;

reader: _SqlDataReader;

begin

command := CoSqlCommand.CreateInstance('SELECT CategoryID,


CategoryName FROM Categories;',

connection);

connection.Open();

1427
.Net Runtime Library for Delphi

reader := command.ExecuteReader;

if reader.HasRows then

begin

while reader.Read do

begin

Console.WriteLine_17('{0}' + Chr(9) + '{1}',


reader.GetInt32(0), reader.GetString(1));

end;

end

else

begin

Console.WriteLine_14('No rows found.');

end;

reader.Close();

end;

function GetConnectionString: string;

begin

// 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';

end;

var

connection: _SqlConnection;

begin

try

Console := CoConsole.CreateInstance;

connection:= CoSqlConnection.CreateInstance(GetConnectionString);

HasRows(connection);

1428
.Net Runtime Library for Delphi

except

on E: Exception do

begin

Console.WriteLine_14(E.message);

end;

end;

end.

7.1.2.8 CNClrLib.Deployment Namespace


The CNClrLib.Deployment namespace contains interfaces that support deployment of ClickOnce applications. These
interfaces are defined as classes and interfaces in C# System.Deployment Namespaces.

7.1.2.9 CNClrLib.Device Namespace


The CNClrLib.Device namespace 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. As a
result, application developers who use this API do not need to tailor applications to specific hardware
configurations. These interfaces are defined as classes and interfaces in C# System.Device.Location
Namespace.

Examples
The following example shows how to handle StatusChanged events and print out the current
GeoPositionStatus.

Delphi

program DeviceLocationExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

SysUtils,

CNClrLib.EnumArrays,

CNClrLib.EnumTypes,

CNClrLib.Device,

CNClrLib.Host,

CNClrLib.Host.Helper,

1429
.Net Runtime Library for Delphi

CNClrLib.Host.Utils,

CNClrLib.Core;

var

Console: _Console;

// Event Handler in C# looks like this:

// static void DoStatusChanged(object sender,


GeoPositionStatusChangedEventArgs e)

procedure DoStatusChanged(ASender: _ClrObject; AEventArgs:


_ClrEventArgs); stdcall;

var

e: _GeoPositionStatusChangedEventArgs;

ageoPositionStatus: TGeoPositionStatus;

begin

//Convert EventArgs value to GeoPositionStatusChangedEventArgs

e :=
CoGeoPositionStatusChangedEventArgs.Wrap(AEventArgs.EventArgs);

//Convert the status as TOleEnum to a delphi readable enumration


type defined in CNClrLib.EnumTypes

ageoPositionStatus :=
TGeoPositionStatus(OleEnumToOrd(GeoPositionStatusValues, e.Status));

case ageoPositionStatus of

gpsInitializing: Console.WriteLine_14('Working on location


fix');

gpsReady: Console.WriteLine_14('Have location');

gpsNoData: Console.WriteLine_14('No data');

gpsDisabled: Console.WriteLine_14('Disabled');

end;

end;

procedure ShowStatusUpdates;

var

watcher: _GeoCoordinateWatcher;

eventHandler: TClrEventHandler;

1430
.Net Runtime Library for Delphi

begin

watcher := CoGeoCoordinateWatcher.CreateInstance;

watcher.Start;

eventHandler := DoStatusChanged;

watcher.Add_StatusChanged(TClrIntPtrHelper.Zero,
TClrConvert.ToManagedPointer(@eventHandler));

Console.WriteLine_14('Enter any key to quit.');

Console.ReadLine;

end;

begin

try

Console := CoConsole.CreateInstance;

ShowStatusUpdates;

except

on E: Exception do

begin

Console.WriteLine_14(E.message);

end;

end;

end.

1431
.Net Runtime Library for Delphi

ExamplesThe following example shows how to resolve a CivicAddress from a


GeoCoordinate location synchronously.

Delphi

1432
.Net Runtime Library for Delphi

program ResolveAddressSync;

{$APPTYPE CONSOLE}

{$R *.res}

uses

SysUtils,

CNClrLib.EnumTypes,

CNClrLib.Device,

CNClrLib.Core;

var

Console: _Console;

procedure ResolveAddressSync;

var

watcher: _GeoCoordinateWatcher;

resolver: _CivicAddressResolver;

location: _GeoCoordinate;

timespan: _TimeSpanHelper;

address: _CivicAddress;

begin

watcher := CoGeoCoordinateWatcher.CreateInstance(gpaHigh);

watcher.MovementThreshold := 1.0; // set to one meter

timespan := CoTimeSpanHelper.CreateInstance;

watcher.TryStart(false, timespan.FromMilliseconds(1000));

resolver := CoCivicAddressResolver.CreateInstance;

location := CoGeoCoordinate.Wrap(watcher.Position.Location);

if location.IsUnknown = False then

begin

1433
.Net Runtime Library for Delphi

address := resolver.ResolveAddress(location);

if not address.IsUnknown then

begin

Console.WriteLine_17('Country: {0}, Zip: {1}',

address.CountryRegion,

address.PostalCode);

end

end

else

begin

Console.WriteLine_14('Address unknown.');

end;

end;

begin

try

Console := CoConsole.CreateInstance;

ResolveAddressSync;

except

on E: Exception do

begin

Console.WriteLine_14(E.message);

end;

end;

end.

7.1.2.10 CNClrLib.Diagnostics Namespace


The CNClrLib.Diagnostics namespace contains interfaces that enable you to interact with system processes, event
logs, and performance counters. It contains interfaces to interact with code analysis tools, 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. These interfaces are defined as classes and interfaces in C# System.Diagnostics
Namespaces.

Example 1

1434
.Net Runtime Library for Delphi

The following code example demonstrates the use of the PerformanceCounter class to create
and use an AverageCount64 counter type. The example creates categories, sets up counters,
collects data from the counters, and calls the CounterSampleCalculator class to interpret the
performance counter data. The intermediate and final results are displayed in the console
window. For additional examples of other performance counter types, see the
PerformanceCounterType enumeration.

Delphi

program DiagnosticsExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

SysUtils,

TypInfo,

CNClrLib.EnumArrays,

CNClrLib.Enums,

CNClrLib.EnumTypes,

CNClrLib.Diagnostics,

CNClrLib.Host.Helper,

CNClrLib.Host.Utils,

CNClrLib.Core;

var

Console: _Console;

samplesList: _ArrayList;

avgCounter64Sample: _PerformanceCounter;

avgCounter64SampleBase: _PerformanceCounter;

// Output information about the counter sample.

procedure OutputSample(s: _CounterSample);

begin

Console.WriteLine_14(#13#10 + '+++++++++++');

Console.WriteLine_14('Sample values - ' + #13#10);

1435
.Net Runtime Library for Delphi

Console.WriteLine;

Console.WriteLine_14(' BaseValue = ' +


s.BaseValue.ToString);

Console.WriteLine_14(' CounterFrequency = ' +


s.CounterFrequency.ToString);

Console.WriteLine_14(' CounterTimeStamp = ' +


s.CounterTimeStamp.ToString);

Console.WriteLine_14(' CounterType = ' +


GetEnumName(System.TypeInfo(TPerformanceCounterType),

OleEnumToOrd(PerformanceCounterTypeValues, s.CounterType)));

Console.WriteLine_14(' RawValue = ' +


s.RawValue.ToString);

Console.WriteLine_14(' SystemFrequency = ' +


s.SystemFrequency.ToString);

Console.WriteLine_14(' TimeStamp = ' +


s.TimeStamp.ToString);

Console.WriteLine_14(' TimeStamp100nSec = ' +


s.TimeStamp100nSec.ToString);

Console.WriteLine_14('++++++++++++++++++++++');

end;

//
++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//
++++++++

// Description - This counter type shows how many items are


processed, on average,

// during an operation. Counters of this type display a ratio of the


items

// processed (such as bytes sent) to the number of operations


completed. The

// ratio is calculated by comparing the number of items processed


during the

// last interval to the number of operations completed during the


last interval.

// Generic type - Average

// Formula - (N1 - N0) / (D1 - D0), where the numerator (N)


represents the number

// of items processed during the last sample interval and the


denominator (D)

// represents the number of operations completed during the last two


sample

1436
.Net Runtime Library for Delphi

// intervals.

// Average (Nx - N0) / (Dx - D0)

// Example PhysicalDisk\ Avg. Disk Bytes/Transfer

//
++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//
++++++++

function MyComputeCounterValue(s0, s1: _CounterSample): Single;

var

numerator, denomenator, counterValue: Single;

begin

numerator := s1.RawValue - s0.RawValue;

denomenator := s1.BaseValue - s0.BaseValue;

counterValue := numerator / denomenator;

Exit(counterValue);

end;

function SetupCategory: Boolean;

var

PerformanceCounterCategory: _PerformanceCounterCategoryHelper;

counterDataCollection: _CounterCreationDataCollection;

averageCount64: _CounterCreationData;

averageCount64Base: _CounterCreationData;

begin

PerformanceCounterCategory :=
CoPerformanceCounterCategoryHelper.CreateInstance;

if not
PerformanceCounterCategory.Exists('AverageCounter64SampleCategory')
then

begin

counterDataCollection :=
CoCounterCreationDataCollection.CreateInstance;

// Add the counter.

averageCount64 := CoCounterCreationData.CreateInstance;

averageCount64.CounterType :=
PerformanceCounterType_AverageCount64;

1437
.Net Runtime Library for Delphi

averageCount64.CounterName := 'AverageCounter64Sample';

counterDataCollection.Add(averageCount64);

// Add the base counter.

averageCount64Base := CoCounterCreationData.CreateInstance;

averageCount64Base.CounterType :=
PerformanceCounterType_AverageBase;

averageCount64Base.CounterName := 'AverageCounter64SampleBase';

counterDataCollection.Add(averageCount64Base);

// Create the category.

PerformanceCounterCategory.Create_1('AverageCounter64SampleCategory',

'Demonstrates usage of the AverageCounter64 performance


counter type.',

PerformanceCounterCategoryType_SingleInstance,
counterDataCollection);

Exit(True);

end

else

begin

Console.WriteLine_14('Category exists -
AverageCounter64SampleCategory');

Exit(False);

end;

end;

procedure CreateCounters;

begin

// Create the counters.

avgCounter64Sample :=
CoPerformanceCounter.CreateInstance('AverageCounter64SampleCategory',

'AverageCounter64Sample', False);

1438
.Net Runtime Library for Delphi

avgCounter64SampleBase :=
CoPerformanceCounter.CreateInstance('AverageCounter64SampleCategory',

'AverageCounter64SampleBase', False);

avgCounter64Sample.RawValue := 0;

avgCounter64SampleBase.RawValue := 0;

end;

procedure CollectSamples(samplesList: _ArrayList);

var

r: _Random;

j, value: Integer;

begin

r :=
CoRandom.CreateInstance(TClrDateTimeHelper.GetMillisecond(Now));

// Loop for the samples.

for j := 0 to 99 do

begin

value := r.Next_1(1, 10);

Console.Write_22(j.ToString + ' = ' + value.ToString);

avgCounter64Sample.IncrementBy(value);

avgCounter64SampleBase.Increment();

if j mod 10 = 9 then

begin

OutputSample(avgCounter64Sample.NextSample);

samplesList.Add(avgCounter64Sample.NextSample);

end

else

Console.WriteLine;

Sleep(50);

1439
.Net Runtime Library for Delphi

end;

end;

procedure CalculateResults(samplesList: _ArrayList);

var

CounterSampleCalculator: _CounterSampleCalculator;

i: Integer;

begin

for i := 0 to samplesList.Count - 1 do

begin

// Output the sample.

OutputSample(CoCounterSample.Wrap(samplesList[i]));

OutputSample(CoCounterSample.Wrap(samplesList[i + 1]));

CounterSampleCalculator :=
CoCounterSampleCalculator.CreateInstance;

// Use .NET to calculate the counter value.

Console.WriteLine_14('Computed counter value = ' +


CounterSampleCalculator.ComputeCounterValue_1

(CoCounterSample.Wrap(samplesList[i]),
CoCounterSample.Wrap(samplesList[i + 1])).ToString);

// Calculate the counter value manually.

Console.WriteLine_14('My computed counter value = ' +


MyComputeCounterValue(CoCounterSample.Wrap(samplesList[i]),

CoCounterSample.Wrap(samplesList[i + 1])).ToString);

end;

end;

begin

try

Console := CoConsole.CreateInstance;

samplesList := CoArrayList.CreateInstance;

1440
.Net Runtime Library for Delphi

// If the category does not exist, create the category and exit.

// Performance counters should not be created and immediately


used.

// There is a latency time to enable the counters, they should be


created

// prior to executing the application that uses the counters.

// Execute this sample a second time to use the category.

if SetupCategory then

Exit;

CreateCounters;

CollectSamples(samplesList);

CalculateResults(samplesList);

except

on E: Exception do

begin

Console.WriteLine_14(E.message);

end;

end;

end.

1441
.Net Runtime Library for Delphi

1442
.Net Runtime Library for Delphi

1443
.Net Runtime Library for Delphi

1444
.Net Runtime Library for Delphi

Example 2

The following example uses Trace to indicate the beginning and the end
of a program's execution. The example also uses the Trace.Indent and
Trace.Unindent methods to distinguish the tracing output.

Delphi
program DiagnosticsExample2;

{$APPTYPE CONSOLE}

{$R *.res}

uses

SysUtils,

CNClrLib.Diagnostics,

CNClrLib.Core;

var

Console: _Console;

Trace: _Trace;

begin

try
Console := CoConsole.CreateInstance;

1445
.Net Runtime Library for Delphi

Trace := CoTrace.CreateInstance;

Trace.Listeners.Add(CoTextWriterTraceListener.Crea
teInstance(Console.Out).AsTraceListener);

Trace.AutoFlush := true;

Trace.Indent;

Trace.WriteLine('Entering Main');

Console.WriteLine_14('Hello World.');

Trace.WriteLine('Exiting Main');

Trace.Unindent;

except
on E: Exception do

begin
Console.WriteLine_14(E.message);

end;

end;

end.

7.1.2.11 CNClrLib.DirectoryServices Namespace


The CNClrLib.DirectoryServices namespace provides easy access to Active Directory Domain Services. The namespace
contains two component interfaces, DirectoryEntry and DirectorySearcher , which use the Active Directory
Services Interfaces (ADSI) technology. ADSI is the set of interfaces that Microsoft provides as a flexible tool for working
with a variety of network providers. ADSI gives the administrator the ability to locate and manage resources on a
The namespace interfaces are defined as
network with relative ease, regardless of the size of the network.
Classes and interfaces in C# System.DirectoryServices namespaces.

Example
The example below uses DirectoryEntry interface.

Delphi

1446
.Net Runtime Library for Delphi

program DirectoryServicesExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

SysUtils,

CNClrLib.DirectoryServices,

CNClrLib.Core;

var

Console: _Console;

entry: _DirectoryEntry;

mySearcher: _DirectorySearcher;

objCollection: OleVariant;

searchResult: _SearchResultCollection;

keyEnumerator: _IEnumerator;

key: string;

I, J: Integer;

begin

try

Console := CoConsole.CreateInstance;

entry := CoDirectoryEntry.CreateInstance('LDAP://MCBcorp,
DC=com');

Console.WriteLine_14('Name = ' + entry.Name);

Console.WriteLine_14('Path = ' + entry.Path);

Console.WriteLine_14('SchemaClassName = ' +
entry.SchemaClassName);

Console.WriteLine_14('Properties:');

Console.WriteLine_14('=====================================');

keyEnumerator :=
entry.Properties.PropertyNames.AsIEnumerable.GetEnumerator;

1447
.Net Runtime Library for Delphi

while keyEnumerator.MoveNext do

begin

key := keyEnumerator.Current;

Console.WriteLine_14(Chr(9) + key + ' = ');

for J := 0 to entry.Properties[key].Count - 1 do

begin

objCollection := entry.Properties[key][J];

Console.WriteLine_15(#13#10 + #13#10 + '{0}', objCollection);

end;

Console.WriteLine_14('===================================');

end;

mySearcher := CoDirectorySearcher.CreateInstance(entry);

mySearcher.Filter := '(objectClass=*)';

Console.WriteLine_14('Active Directory Information');

Console.WriteLine_14('=====================================');

searchResult := mySearcher.FindAll;

for I := 0 to searchResult.Count - 1 do

begin

Console.WriteLine_14(searchResult[I].GetDirectoryEntry.Name);

Console.WriteLine_14(searchResult[I].GetDirectoryEntry.Path);

Console.WriteLine_14(searchResult[I].GetDirectoryEntry.NativeGuid);

Console.WriteLine_14('===================================');

end;

except

on E: Exception do

begin

Console.WriteLine_14(E.message);

end;

end;

1448
.Net Runtime Library for Delphi

end.

7.1.2.12 CNClrLib.Drawing Namespace


The CNClrLib.Drawing parent namespace contains interfaces that support basic GDI+ graphics functionality. Child
namespaces support advanced two-dimensional and vector graphics functionality, advanced imaging functionality, and
print-related and typographical services. The namespace also contains interfaces that extend design-time user-
interface logic and drawing. These
interfaces are defined as classes and interfaces in C#
System.Drawing Namespaces.

7.1.2.13 CNClrLib.Dynamic Namespace


The CNClrLib.Dynamic Linq namespace provides interfaces that support Dynamic Language Runtime. These
interfaces are defined as classes and interfaces in C# System.Dynamic Namespace.

7.1.2.14 CNClrLib.EnterpriseServices Namespace


The CNClrLib.EnterpriseServices namespace 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. These interfaces are defined as classes and interfaces in C# System.EnterpriseServices
Namespaces.

7.1.2.15 CNClrLib.IdentityModel Namespace


The CNClrLib.IdentityModel namespace contains interfaces that are used to provide
authentication and authorization for applications. These interfaces are defined as classes and
interfaces in C# System.IdentityModel Namespaces.

7.1.2.16 CNClrLib.IO Namespace


The CNClrLib.IO namespace 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. These interfaces are defined as classes and interfaces in C# System.IO Namespaces.

7.1.2.17 CNClrLib.Linq Namespace


The CNClrLib.Linq namespace contains interfaces that support queries that use Language-Integrated Query (LINQ). This
includes types that represent queries as objects in expression trees. These interfaces are defined as classes
and interfaces in C# System.Linq Namespaces.

7.1.2.18 CNClrLib.Management Namespace


The CNClrLib.Management namespace 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 so
that they expose their management information and events through WMI to potential customers. These interfaces
are defined as classes and interfaces in C# System.Management Namespaces.

1449
.Net Runtime Library for Delphi

Example 1
The following example shows how the client receives notification when an instance of Win32_Process is created
because the event class is __InstanceCreationEvent. For more information, see the Windows Management
Instrumentation documentation in the MSDN Library at http://msdn.microsoft.com/library. The client receives events
synchronously by calling the WaitForNextEvent method. This example can be tested by starting a process, such as
Notepad, while the example code is running.
Delphi

// This example shows synchronous consumption of events.

// The client is blocked while waiting for events.

program EventWatcherPolling;

{$APPTYPE CONSOLE}

{$R *.res}

uses

SysUtils,

CNClrLib.Management,

CNClrLib.Core;

var

Console: _Console;

query: _WqlEventQuery;

watcher: _ManagementEventWatcher;

e: _ManagementBaseObject;

begin

try

Console := CoConsole.CreateInstance;

// Create event query to be notified within 1 second of

// a change in a service

query := CoWqlEventQuery.CreateInstance('__InstanceCreationEvent',

CoTimeSpan.CreateInstance(0,0,1),

'TargetInstance isa ''Win32_Process''');

// Initialize an event watcher and subscribe to events

1450
.Net Runtime Library for Delphi

// that match this query

watcher := CoManagementEventWatcher.CreateInstance;

watcher.Query := query.AsEventQuery;

// times out watcher.WaitForNextEvent in 5 seconds

watcher.Options.Timeout := CoTimeSpan.CreateInstance(0,0,5);

// Block until the next event occurs

// Note: this can be done in a loop if waiting for

// more than one occurrence

Console.WriteLine_14('Open an application (notepad.exe) to trigger


an event.');

e := watcher.WaitForNextEvent;

//Display information from the event

Console.WriteLine_17('Process {0} has been created, path is: {1}',

CoManagementBaseObject.Wrap(e['TargetInstance'])['Name'],

CoManagementBaseObject.Wrap(e['TargetInstance'])['ExecutablePath']);

//Cancel the subscription

watcher.Stop;

except

on E: Exception do

begin

Console.WriteLine_14(E.message);

end;

end;

end.

1451
.Net Runtime Library for Delphi

Example 2
The following example demonstrates how the ManagementPath class parses a path to a WMI object. The path that is
parsed in the example is a path to an instance of a class.
Delphi

// This example shows synchronous consumption of events.

1452
.Net Runtime Library for Delphi

// The client is blocked while waiting for events.

program Sample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

SysUtils,

CNClrLib.Management,

CNClrLib.Core;

var

Console: _Console;

p: _ManagementPath;

begin

try

Console := CoConsole.CreateInstance;

// Get the WMI class path

p := CoManagementPath.CreateInstance('\\ComputerName\root' +

'\cimv2:Win32_LogicalDisk.DeviceID=''C:''');

Console.WriteLine_15('IsClass: {0}', p.IsClass);

// Should be False (because it is an instance)

Console.WriteLine_15('IsInstance: {0}', p.IsInstance);

// Should be True

Console.WriteLine_14('ClassName: ' + p.ClassName);

// Should be "Win32_LogicalDisk"

Console.WriteLine_14('NamespacePath: ' + p.NamespacePath);

// Should be "ComputerName\cimv2"

1453
.Net Runtime Library for Delphi

Console.WriteLine_14('Server: ' + p.Server);

// Should be "ComputerName"

Console.WriteLine_14('Path: ' + p.Path);

// Should be "ComputerName\root\cimv2:

// Win32_LogicalDisk.DeviceId="C:""

Console.WriteLine_14('RelativePath: ' + p.RelativePath);

// Should be "Win32_LogicalDisk.DeviceID="C:""

except

on E: Exception do

begin

Console.WriteLine_14(E.message);

end;

end;

end.

7.1.2.19 CNClrLib.Media Namespace


The CNClrLib.Media namespace contains interfaces for playing sound files and accessing sounds provided by the
system. These interfaces are defined as classes and interfaces in C# System.Media Namespace.

7.1.2.20 CNClrLib.Messaging Namespace


The CNClrLib.Messaging namespace contains interfaces that enable you to connect to, monitor, and administer
message queues on the network and to send, receive, or peek messages. These interfaces are defined as
classes and interfaces in C# System.Messaging Namespace.

7.1.2.21 CNClrLib.Net Namespace


The CNClrLib.Net namespace 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. These interfaces are defined as classes and interfaces in

7.1.2.22 CNClrLib.Numerics Namespace


The CNClrLib.Numerics namespace contains numeric interfaces that complement the numeric primitives, such as Byte,
Double, and Int32 that are defined by the .NET Framework. These interfaces are defined as classes and
interfaces in C# System.Numerics Namespace.

1454
.Net Runtime Library for Delphi

7.1.2.23 CNClrLib.Printing Namespace


The CNClrLib.Printing namespace 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. These
interfaces are defined as classes and interfaces in

7.1.2.24 CNClrLib.Resources Namespace


The CNClrLib.Resources namespace contains interfaces that enable developers to create, store, and manage an
application's culture-specific resources. These interfaces are defined as classes and interfaces in C#
System.Resources Namespaces.

7.1.2.25 CNClrLib.Runtime Namespace


The CNClrLib.Runtime namespace 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).
These interfaces are defined as classes and interfaces in C# System.Runtime Namespaces.

7.1.2.26 CNClrLib.Security Namespace


The CNClrLib.Security namespace contains interfaces that represent the .NET Framework security system and
permissions. The namespace also 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. These interfaces are defined as classes and interfaces
in C# System.Security Namespaces.

7.1.2.27 CNClrLib.ServiceModel Namespace


The CNClrLib.ServiceModel namespace contains the interfaces necessary to build Windows Communication Foundation
(WCF) service and client applications. These interfaces are defined as classes and interfaces in C#
System.ServiceModel Namespaces.

7.1.2.28 CNClrLib.ServiceProcess Namespace


The CNClrLib.ServiceProcess namespace contains interfaces that enable you to implement, install, and control Windows
service applications and extend design-time support for Windows service applications. These interfaces are
defined as classes and interfaces in C# System.ServiceProcess Namespaces.

7.1.2.29 CNClrLib.Speech Namespace


The CNClrLib.Speech namespaces contain interfaces that support speech recognition. These interfaces are
defined as classes and interfaces in C# System.Speech Namespaces.

7.1.2.30 CNClrLib.SqlServer Namespace


The CNClrLib.SqlServer namespace 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

1455
.Net Runtime Library for Delphi

process execution environment. These interfaces are defined as classes and interfaces in C#
Microsoft.SqlServer.Server Namespace.

7.1.2.31 CNClrLib.System Namespace


The CNClrLib.System namespace contains fundamental interfaces that define commonly-used value and
reference data types, events and event handlers, interfaces, attributes, and processing exceptions. All the
interfaces implementations in the CNClrLib.Core.Intf and CNClrLib.Common namespaces. These interfaces are
defined as classes and interfaces in

7.1.2.32 CNClrLib.Text Namespace


The CNClrLib.Text namespace contains interfaces for character encoding and string manipulation. It also enables you to
process text using regular expressions. These interfaces are defined as classes and interfaces in C#
System.Text Namespaces.

7.1.2.33 CNClrLib.Threading Namespace


The CNClrLib.Threading namespace contains interface that enable multithreaded programming.
The namespace provides types that simplify the work of writing concurrent and asynchronous code. These
interfaces are defined as classes and interfaces in C# System.Threading Namespace.

7.1.2.34 CNClrLib.Timers Namespace


The CNClrLib.Timers namespace provides the Timer component, which allows you to raise an event on a
specified interval. These interfaces are defined as classes and interfaces in C# System.Timers Namespace.

7.1.2.35 CNClrLib.Transactions Namespace


The CNClrLib.Transactions namespace contains interfaces that support transactions with multiple, distributed
participants, multiple phase notifications, and durable enlistments. These interfaces are defined as classes and
interfaces in C# System.Transactions Namespaces.

7.1.2.36 CNClrLib.VisualBasic Namespace


The CNClrLib.VisualBasic namespace contains interfaces that support compilation and code generation
using the Visual Basic language. The namespace contains interfaces that provide services to the Visual Basic compiler
and which include support for the Visual Basic application model, the My namespace, lambda expressions, and code
conversion. These interfaces are defined as classes and interfaces in C# Microsoft.VisualBasic
Namespaces.

7.1.2.37 CNClrLib.Web Namespace


The CNClrLib.Web namespace contains interfaces that enable browser/server communication.
Child namespaces 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. These interfaces are defined as classes and interfaces in C# System.Web
Namespaces.

1456
.Net Runtime Library for Delphi

7.1.2.38 CNClrLib.Win32 Namespace


The CNClrLib.Win32 namespace contains interfaces that provides two types of classes: those that handle
events raised by the operating system and those that manipulate the system registry. These interfaces are
defined as classes and interfaces in C# Microsoft.Win32 Namespace.

7.1.2.39 CNClrLib.Windows Namespace


The CNClrLib.Windows namespace contains interfaces that provides the ability to create, configure,
show, and manage the lifetime of windows and dialog boxes. These interfaces are defined as classes and
interfaces in C# System.Window Namespaces.

7.1.2.40 CNClrLib.Xaml Namespace


The CNClrLib.Xaml namespace contains interfaces that supports parsing and processing the Extensible
Application Markup Language (XAML). These interfaces are defined as classes and interfaces in C#
System.Xaml Namespaces.

7.1.2.41 CNClrLib.Xml Namespace


The CNClrLib.Xml namespace contains interfaces that provides standards-based support for processing
XML. These interfaces are defined as classes and interfaces in C# System.Xml

Namespaces. Example
The following example compares two element names using the interfaces defined in
CNClrLib.Xml namespace.

Delphi

program XmlExample;

{$APPTYPE CONSOLE}

{$R *.res}

uses

CNClrLib.Xml,

CNClrLib.Core;

var

nt: _NameTable;

book, price: Variant;

1457
.Net Runtime Library for Delphi

settings: _XmlReaderSettings;

reader: _XmlReader;

readerHelper: _XmlReaderHelper;

objectHelper: _ObjectHelper;

begin

nt := CoNameTable.CreateInstance;

book := nt.Add('book');

price := nt.Add('price');

// Create the reader.

settings := CoXmlReaderSettings.CreateInstance;

settings.NameTable := nt.AsXmlNameTable;

readerHelper := CoXmlReaderHelper.CreateInstance;

reader := readerHelper.Create_1('books.xml', settings);

reader.MoveToContent;

reader.ReadToDescendant('book');

objectHelper := CoObjectHelper.CreateInstance;

if objectHelper.ReferenceEquals(book, reader.Name) then

begin

// Do additional processing.

end;

end.

1458
.Net Runtime Library for Delphi

1459

S-ar putea să vă placă și