Documente Academic
Documente Profesional
Documente Cultură
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
1
.Net Runtime Library for Delphi
2
.Net Runtime Library for Delphi
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:
4
.Net Runtime Library for Delphi
CNClrLib.DynamicLinq CNCorLibrary.CorDynamicLinq
5
.Net Runtime Library for Delphi
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.
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.
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.
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:
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.
The following sections describe the main components and features of the .NET Framework in
greater detail.
9
.Net Runtime Library for Delphi
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.
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
See Also
For download information and links, see Installing the .Net Runtime Library for Delphi.
Platforms
Microsoft® Windows
11
.Net Runtime Library for Delphi
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.
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.
//1.
//and start the runtime host if the host object has not been
created already.
Console := CoConsole.CreateInstance;
//2.
ClrHost := ClrHostManager;
//3.
13
.Net Runtime Library for Delphi
ClrHost := TClrHost.GetDefault;
ClrHost := TClrHost.Create;
except
on E: Exception do
end;
end.
var
newDomain: TClrAppDomain;
begin
newDomain := TClrAppDomain.CreateDomain('NewApplicationDomain');
newDomain.ExecuteAssembly('c:\HelloWorld.exe');
TClrAppDomain.Unload(newDomain);
end.
14
.Net Runtime Library for Delphi
AppDomain/TClrAppDomain
Represents an application domain. Provides methods for creating and controlling application domains.
Related Sections
Reflection Overview
Describes how to use the Reflection class to obtain information about an assembly.
15
.Net Runtime Library for Delphi
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.ReadKey;
finally
Console := nil;
end;
except
on E: Exception do
end;
end.
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);
18
.Net Runtime Library for Delphi
TClrAppDomain.Unload(domain);
Console.WriteLine();
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
end;
Console.ReadKey;
end.
19
.Net Runtime Library for Delphi
//Output
//
//System.AppDomainUnloadedException
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;
domaininfo := CoAppDomainSetup.CreateInstance;
domaininfo.ApplicationBase :=
'C:\Temp\AppDomainDemo\EXE\Win32\Debug';
domain :=
TClrAppDomain.CreateDomain('MyDomain', nil,
domaininfo);
21
.Net Runtime Library for Delphi
TClrAppDomain.Unload(domain);
Console.ReadKey;
except
on E: Exception do
end;
end.
//Output
22
.Net Runtime Library for Delphi
program AppDomain;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
CNClrLib.Host,
CNClrLib.Core;
var
Console: _Console;
domain: TClrAppDomain;
begin
try
Console := CoConsole.CreateInstance;
23
.Net Runtime Library for Delphi
TClrAppDomain.Unload(domain);
Console.ReadKey;
except
on E: Exception do
end;
end.
//Output
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;
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
Console.WriteLine();
TClrAppDomain.Unload(domain);
Console.ReadKey;
except
on E: Exception do
end;
end.
//Output
//
27
.Net Runtime Library for Delphi
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');
myType := TClrAssembly.GetType('Example');
myMethod := myType.GetMethod_5('MethodA');
// Create an instance.
obj := TClrActivator.CreateInstance(myType);
myMethod.Invoke_2(obj, nil);
//OR
Clrobj := TClrActivator.ClrCreateInstance(myType);
Clrobj.InvokeMethod('MethodA');
end.
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');
// 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);
30
.Net Runtime Library for Delphi
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
//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
35
.Net Runtime Library for Delphi
Example in C#
C#
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
37
.Net Runtime Library for Delphi
38
.Net Runtime Library for Delphi
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');
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
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.
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');
//Output
//Add(30, 50): 80
//Subtract(30, 50): -20
//Equal(30, 50): False
//Equal(50, 50): True
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;
var
EvtArgs: _FirstChanceExceptionEventArgs;
begin
EvtArgs := CoFirstChanceExceptionEventArgs.Wrap(Args.EventArgs);
TClrAppDomain.GetCurrentDomain.FriendlyName,
EvtArgs.Exception.Message);
end;
begin
Console := CoConsole.CreateInstance;
try
FirstChangeEventPtr := FirstChanceEventHandler;
TClrAppDomain.GetCurrentDomain.AddFirstChanceException(nil,
@FirstChangeEventPtr);
except
on E: Exception do
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
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;
var
EvtArgs: _FirstChanceExceptionEventArgs;
begin
EvtArgs := CoFirstChanceExceptionEventArgs.Wrap(Args.EventArgs);
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
TClrAppDomain.GetCurrentDomain.FriendlyName, E.Message);
end;
end.
50
.Net Runtime Library for Delphi
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
var
EvtArgs: _FirstChanceExceptionEventArgs;
begin
EvtArgs := CoFirstChanceExceptionEventArgs.Wrap(Args.EventArgs);
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
Note
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.
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
var
AResolveEventArgs: _ResolveEventArgs;
begin
AResolveEventArgs := CoResolveEventArgs.Wrap(AEventArgs.EventArgs);
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.
55
.Net Runtime Library for Delphi
...
*)
Using Reflection
Using Common Language Runtime Object (ClrObject)
Using Constructor CoClasses
The following methods can be used to create instances of .Net Objects through reflections:
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.
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_;
end.
58
.Net Runtime Library for Delphi
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_;
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
Obj := TClrActivator.CreateInstance('System.Collections.ArrayList');
Obj := TClrActivator.CreateInstance('System.Collections.ArrayList',
[10]);
Obj := TClrActivator.CreateInstance('System.Collections.ArrayList',
TClrArrayHelper.ToObjectArray([10]));
Obj :=
TClrActivator.CreateInstance(TClrAssembly.GetType('System.Collections.
ArrayList'));
Obj :=
TClrActivator.CreateInstance(TClrAssembly.GetType('System.Collections.
ArrayList'),
//the named assembly file and the constructor that best matches the
specified parameters.
61
.Net Runtime Library for Delphi
ObjHandle :=
TClrActivator.CreateInstanceFrom('C:\Temp\Mathematics.dll', 'SumData',
Obj := ObjHandle.Unwrap_;
ObjHandle := TClrActivator.CreateComInstance('MyCOM_Assembly,
version=1.2.3.4, culture=neutral, publicKeyToken=null', 'MyType');
Obj := ObjHandle.Unwrap_;
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
Obj :=
TClrDispatchActivator.CreateInstance('System.Collections.ArrayList');
Obj :=
TClrDispatchActivator.CreateInstance('System.Collections.ArrayList',
[10]);
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
AAsm := TClrAssembly.LoadFrom('C:\Temp\Mathematics.dll');
65
.Net Runtime Library for Delphi
end.
Inherit from TClrBaseObject Class and create your own methods and properties for the
class.
C#
66
.Net Runtime Library for Delphi
// =================================================
using System;
using System.Runtime.InteropServices;
namespace Mathematics
public Mathematics()
return a + b;
return a - 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;
type
TMathematics = class(TClrBaseObject)
private
public
end;
{ TMathematics }
begin
end;
constructor TMathematics.Create;
begin
69
.Net Runtime Library for Delphi
end;
destructor TMathematics.Destroy;
begin
inherited;
end;
begin
end;
begin
Result := GetPropertyValue('IgnoreError');
end;
begin
SetPropertyValue('IgnoreError', Value);
end;
begin
end;
var
70
.Net Runtime Library for Delphi
AMaths: TMathematics;
Console: _Console;
begin
Console := CoConsole.CreateInstance;
//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;
AMaths.IgnoreError := True;
finally
AMaths.Free;
end;
Console.ReadKey;
end.
//Output
//Add(30, 50): 80
71
.Net Runtime Library for Delphi
//IgnoreError: False
//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');
clrObject :=
CoClrObject.CreateInstance(TClrAssembly.GetType('Mathematics.Mathemati
cs'), nil);
AMaths := TClrObject.Create(clrObject);
try
75
.Net Runtime Library for Delphi
Console.WriteLine_15('IgnoreError: {0}',
AMaths.GetPropertyValue('IgnoreError'));
Console.WriteLine;
AMaths.SetPropertyValue('IgnoreError', True);
Console.WriteLine_15('IgnoreError: {0}',
AMaths.GetPropertyValue('IgnoreError'));
finally
AMaths.Free;
end;
Console.ReadKey;
end.
//Output
//Add(30, 50): 80
//IgnoreError: False
//IgnoreError: True
76
.Net Runtime Library for Delphi
77
.Net Runtime Library for Delphi
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
Console := CoConsole.CreateInstance;
dataArray := CoByteArray.CreateInstance(100000);
random := CoRandom.CreateInstance;
random.NextBytes(dataArray);
for I := 0 to dataArray.Length - 1 do
fileStream.WriteByte(dataArray[I]);
fileStream.Seek(0, SeekOrigin_Begin);
try
for I := 0 to dataArray.Length - 1 do
begin
begin
79
.Net Runtime Library for Delphi
exit;
end;
end;
finally
Console.ReadKey;
end;
end.
//Output
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#
//Return Boolean
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
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#
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
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;
82
.Net Runtime Library for Delphi
begin
end;
begin
Console := CoConsole.CreateInstance;
AThresholdReachedPtr:= c_ThresholdReached;
ACounter := CoCounter.CreateInstance;
ACounter.AddThresholdReached(nil, @AThresholdReachedPtr);
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
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
threshold = passedThreshold;
total += x;
OnThresholdReached(EventArgs.Empty);
85
.Net Runtime Library for Delphi
if (handler != null)
handler(this, e);
86
.Net Runtime Library for Delphi
Delphi
program ExampleApp;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
CNClrLib.Host,
CNClrLib.Host.Helper,
CNClrLib.Core;
type
TCounter = class(TClrBaseObject)
private
FOnThresholdReached : TClrEventHandler;
public
end;
{ TCounter }
begin
87
.Net Runtime Library for Delphi
end;
begin
end;
destructor TCounter.Destroy;
begin
inherited;
end;
begin
UnRegisterEventCallBack('ThresholdReached', @FOnThresholdReached);
FOnThresholdReached := Value;
RegisterEventCallBack('ThresholdReached', @FOnThresholdReached)
end;
var
Console: _Console;
Counter: TCounter;
begin
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;
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
threshold = passedThreshold;
total += x;
args.Threshold = threshold;
args.TimeReached = DateTime.Now;
OnThresholdReached(args);
91
.Net Runtime Library for Delphi
EventHandler<ThresholdReachedEventArgs> handler =
ThresholdReached;
if (handler != null)
handler(this, e);
92
.Net Runtime Library for Delphi
Delphi
program ExampleApp1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
CNClrLib.Host,
CNClrLib.Host.Helper,
CNClrLib.Core;
type
TCounter = class(TClrBaseObject)
private
FOnThresholdReached : TClrEventHandler;
public
93
.Net Runtime Library for Delphi
end;
{ TCounter }
begin
end;
begin
end;
destructor TCounter.Destroy;
begin
inherited;
end;
begin
UnRegisterEventCallBack('ThresholdReached', @FOnThresholdReached);
FOnThresholdReached := Value;
RegisterEventCallBack('ThresholdReached', @FOnThresholdReached)
end;
94
.Net Runtime Library for Delphi
var
Console: _Console;
Counter: TCounter;
var
ThresholdReachedEventArgs: _ClrObject;
Threshold: Integer;
TimeReached: TDateTime;
begin
ThresholdReachedEventArgs:= AEventArgs.EventArgs.AsClrObject;
Threshold :=
ThresholdReachedEventArgs.GetPropertyValue('Threshold');
TimeReached :=
ThresholdReachedEventArgs.GetPropertyValue('TimeReached');
Abort;
end;
begin
Console := CoConsole.CreateInstance;
TClrAssembly.LoadFrom('Counter.dll');
Counter := TCounter.Create(CoRandom.CreateInstance.Next_2(10));
Counter.OnThresholdReached := c_ThresholdReached;
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
var
Args: _ResolveEventArgs;
AsmName: _AssemblyName;
AsmFileName: string;
Asmbly: _Assembly;
begin
Args := CoResolveEventArgs.Wrap(AEventArgs.EventArgs);
AsmName := CoAssemblyName.CreateInstance(Args.Name);
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, '+
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
threshold = passedThreshold;
total += x;
OnThresholdReached(total, threshold);
if (handler != null)
handler(this, e);
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
//I am creating my own which will mimick the signature of the the C#
event i want to register.
var
Console: _Console;
clrCounter: _ClrObject;
ARandom: _Random;
OnThresholdReached : TThresholdReached;
begin
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));
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
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.
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.
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
ClrObject := CoClrObject.CreateInstance;
ClrObject :=
ClrHostManager.DefaultInterface.CreateStaticObject(TClrAssembly.GetTyp
e('System.Convert'));
ClrObject := CoClrObject.CreateInstance(True);
ClrObject := CoClrObject.CreateInstance(12345);
ClrObject :=
CoClrObject.CreateInstance(TClrCharHelper.ToClrChar('c'));
ClrObject :=
CoClrObject.CreateInstance(TClrConvert.ToDecimal(4565.98676));
ClrObject := CoClrObject.CreateInstance(4565.98676);
108
.Net Runtime Library for Delphi
//
ClrObject := InvObject.InvokeMethod_('GetUD');
ClrObject :=
CoClrObject.CreateInstance(InvObject.InvokeMethod('GetUD'));
ClrObject := CoClrObject.CreateInstance(AnyVar);
ClrObject :=
CoClrObject.CreateInstance(TClrAssembly.GetType('System.Guid'),
TClrArrayHelper.ToObjectArray(['{7C0AE73C-599F-4EFD-
A287-ECA434B1BC40}']));
ClrObject :=
CoClrObject.CreateInstance(TClrAssembly.GetType('System.Collection.Gen
eric.List<>'),
TClrArrayHelper.ToTypeArray(['System.Int32']),
nil);
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;
ClrObject := CoClrObject.CreateInstance(IntVal);
111
.Net Runtime Library for Delphi
UnwrapVal := ClrObject.Unwrap;
Console.WriteLine;
end.
//Output
//
112
.Net Runtime Library for Delphi
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 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;
AChangeFieldValue: Variant);
begin
with AField do
begin
Console.WriteLine_15('GetValue : {0}',
GetValue(FieldInfoObj));
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);
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
(*
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.
// test
117
.Net Runtime Library for Delphi
// hi
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 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('MemberType : {0}',
myProperty.MemberType);
Console.WriteLine_15('PropertyType : {0}',
myProperty.PropertyType);
Console.WriteLine_15('GetValue : {0}',
myProperty.GetValue(PropertyInfoObj));
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;
get{return caption;}
// strings.
121
.Net Runtime Library for Delphi
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');
Parms := piProperty.GetIndexParameters;
Console.WriteLine_14(PropertyInfoObj.GetType.FullName + '.' +
piProperty.Name
piProperty := PropertyInfoObj.GetProperty('Item');
Parms := piProperty.GetIndexParameters;
Console.WriteLine_14(PropertyInfoObj.GetType.FullName + '.' +
piProperty.Name
123
.Net Runtime Library for Delphi
for I := 0 to Parms.Length - 1 do
Console.ReadKey;
end.
(*
Parameter: Index
*)
124
.Net Runtime Library for Delphi
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 MagicClass()
magicBaseValue = 9;
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);
Console.WriteLine_14('ClrObject.InvokeMethod() Example');
Console.WriteLine;
Console.ReadKey;
end.
127
.Net Runtime Library for Delphi
//
// MethodInfo.Invoke() Example
//
128
.Net Runtime Library for Delphi
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#
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.
//
// System.Int32
// System.Double
// System.Object
130
.Net Runtime Library for Delphi
Register/UnRegister Events
C#
namespace CounterEventhandler
threshold = passedThreshold;
total += x;
OnThresholdReached(EventArgs.Empty);
131
.Net Runtime Library for Delphi
if (handler != null)
handler(this, e);
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;
begin
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));
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
C#
namespace CounterEventhandler
135
.Net Runtime Library for Delphi
threshold = passedThreshold;
total += x;
OnThresholdReached(total, threshold);
if (handler != null)
handler(this, e);
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
137
.Net Runtime Library for Delphi
var
Console: _Console;
clrCounter: _ClrObject;
ARandom: _Random;
OnThresholdReached : TThresholdReached;
begin
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));
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
The ClrObject can be used to hold array types and the functions below allows you to access the
array information:
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;
ClrObject :=
CoClrObject.CreateInstance(TClrArrayHelper.ToInt32Array([0, 1, 2, 3,
4, 5]));
ClrObject.SetArrayElement(3, 300);
end.
//Output
//Array Length: 6
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
Array Declaration
Below is an example of how to declare an array using the runtime library:
Delphi
var
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
intArray = CoInt32Array.CreateInstance(5);
objectArray = CoObjectArray.CreateInstance(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.
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 := CoInt32Array.CreateInstance(10);
for I := 0 to 9 do
intArray[I] := i + 100;
intArray.Resize(11);
intArray[10] := 10 + 100;
for I := 0 to intArray.Length - 1 do
Console.ReadKey;
146
.Net Runtime Library for Delphi
end.
//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.
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;
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);
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;
//====================================================================
==========
151
.Net Runtime Library for Delphi
o2DimArray.SetValue_8('test', 0, 0);
o2DimArray.SetValue_8('test2', 0, 1);
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));
//====================================================================
==========
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);
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)]));
152
.Net Runtime Library for Delphi
//====================================================================
==========
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]));
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
//Element[0][0] = test
//Element[0][1] = test2
//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
//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;
for I := 0 to intArray.Length - 1 do
Console.WriteLine;
intArray.Reverse;
for I := 0 to intArray.Length - 1 do
Console.WriteLine;
159
.Net Runtime Library for Delphi
intArray.Sort;
for I := 0 to intArray.Length - 1 do
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
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
cArray := TClrArray.Create(TClrAssembly.GetType('System.Integer'),
5, 3);
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.
var
Console: _Console;
begin
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
nonStaticDecimal := CoDecimal.CreateInstance(400.90);
StaticDecimal := CoDecimalHelper.CreateInstance;
end.
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);
stream := fileStream.AsStream;
idisposable := fileStream.AsIDisposable;
fileStream := CoFileStream.Wrap(stream);
end.
165
.Net Runtime Library for Delphi
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.
166
.Net Runtime Library for Delphi
collection
Reference
Array Interface
TClrArray Class
CNClrLib.Collections Namespace
CNClrLib.Linq Namespace
ArrayList Collection
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;
ArrayList := CoArrayList.CreateInstance;
ArrayList.Add('Pascal');
ArrayList.Add(344);
ArrayList.Add(55);
ArrayList.Add(CoClrObject.CreateInstance);
ArrayList.Remove(55);
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;
//
openWith := CoHashtable.CreateInstance;
openWith.Add('txt', 'notepad.exe');
openWith.Add('bmp', 'paint.exe');
openWith.Add('dib', 'paint.exe');
openWith.Add('rtf', 'wordpad.exe');
try
openWith.Add('txt', 'winword.exe');
except
end;
170
.Net Runtime Library for Delphi
openWith['rtf'] := 'winword.exe';
openWith['doc'] := 'winword.exe';
// them.
begin
openWith.Add('ht', 'hypertrm.exe');
end;
// GetEnumerator for the keys. Enumerate through the key values and
display both the
Console.WriteLine();
Keys := openWith.Keys.AsIEnumerable.GetEnumerator;
while Keys.MoveNext do
171
.Net Runtime Library for Delphi
Values := openWith.Values.AsIEnumerable.GetEnumerator;
// with the type that was specified for hash table values.
Console.WriteLine();
while Values.MoveNext do
Keys.Reset;
// with the type that was specified for hash table keys.
Console.WriteLine();
while Keys.MoveNext do
Console.WriteLine;
Console.WriteLine_14('Remove(''doc'')');
openWith.Remove('doc');
end.
172
.Net Runtime Library for Delphi
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')
*)
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;
myQ := CoQueue.CreateInstance;
myQ.Enqueue('Hello');
myQ.Enqueue('World');
myQ.Enqueue('!');
176
.Net Runtime Library for Delphi
Console.WriteLine_14('myQ');
Console.Write_22(' Values:');
myCollection:= myQ.AsIEnumerable.GetEnumerator;
while myCollection.MoveNext do
end.
(*
myQ
Count: 3
*)
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;
myStack := CoStack.CreateInstance;
myStack.Push('Hello');
myStack.Push('World');
myStack.Push('!');
Console.WriteLine_14('myStack');
Console.Write_22(' Values:');
myCollection:= myStack.AsIEnumerable.GetEnumerator;
while myCollection.MoveNext do
end.
(*
myStack
Count: 3
*)
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;
mySL := CoSortedList.CreateInstance;
mySL.Add('Third', '!');
mySL.Add('Second', 'World');
mySL.Add('First', 'Hello');
Console.WriteLine_14('mySL');
for I := 0 to mySL.Count - 1 do
end.
(*
181
.Net Runtime Library for Delphi
mySL
Count: 3
Capacity: 16
-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;
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;
myBA1 := CoBitArray.CreateInstance(5);
myBA3 := CoBitArray.CreateInstance(myBytes);
184
.Net Runtime Library for Delphi
myBA4 := CoBitArray.CreateInstance(myBools);
myBA5 := CoBitArray.CreateInstance(myInts);
Console.WriteLine_14('myBA1');
Console.WriteLine_14(' Values:' );
PrintValues(myBA1.GetEnumerator, 8);
Console.WriteLine_14('myBA2');
Console.WriteLine_14(' Values:' );
PrintValues(myBA2.GetEnumerator, 8);
Console.WriteLine_14('myBA3');
Console.WriteLine_14(' Values:' );
PrintValues(myBA3.GetEnumerator, 8);
Console.WriteLine_14('myBA4');
Console.WriteLine_14(' Values:' );
PrintValues(myBA4.GetEnumerator, 8);
185
.Net Runtime Library for Delphi
Console.WriteLine_14('myBA5');
Console.WriteLine_14(' Values:' );
PrintValues(myBA5.GetEnumerator, 8);
end.
(*
myBA1
Count: 5
Length: 5
Values:
myBA2
Count: 5
Length: 5
Values:
myBA3
Count: 40
Length: 40
Values:
myBA4
Count: 5
Length: 5
Values:
186
.Net Runtime Library for Delphi
myBA5
Count: 160
Length: 160
Values:
*)
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;
I: Integer;
begin
Console := CoConsole.CreateInstance;
str1 := 'llegar';
str2 := 'lugar';
ComparerStatic := CoComparerHelper.CreateInstance;
myCompIntl := CoComparer.CreateInstance(CultureInfo1);
myCompTrad := CoComparer.CreateInstance(CultureInfoTrad);
end.
(*
191
.Net Runtime Library for Delphi
Invariant Comparer: -1
International Sort: -1
Traditional Sort : 1
*)
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
{$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;
list :=
CoGenericList.CreateInstance(TClrAssembly.GetType('System.Int32'));
list.Add(2);
list.Add(3);
list.Add(5);
list.Add(7);
for I := 0 to list.Count - 1 do
Console.WriteLine_8(list[I]);
list[0] := 300;
if list.Contains(300) then
else
193
.Net Runtime Library for Delphi
Console.WriteLine();
listEnum := list.AsIEnumerable.GetEnumerator;
while listEnum.MoveNext do
Console.WriteLine_15('{0}', listEnum.Current);
Console.WriteLine;
Console.WriteLine_14('Remove(300)');
list.Remove(300);
end.
194
.Net Runtime Library for Delphi
300
Remove(300)
*)
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
{$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;
//
openWith :=
CoGenericDictionary.CreateInstance(TClrAssembly.GetType('System.String
'),
TClrAssembly.GetType('System.String'));
openWith.Add('txt', 'notepad.exe');
openWith.Add('bmp', 'paint.exe');
openWith.Add('dib', 'paint.exe');
openWith.Add('rtf', 'wordpad.exe');
try
openWith.Add('txt', 'winword.exe');
except
on Eole: EOleSysError do
begin
ClrEx := EClrException.GetLastClrException;
try
if ClrEx.IsTypeOf('System.ArgumentException') then
finally
ClrEx.Free;
end;
end;
198
.Net Runtime Library for Delphi
end;
openWith['rtf'] := 'winword.exe';
openWith['doc'] := 'winword.exe';
try
except
on Eole: EOleSysError do
begin
ClrEx := EClrException.GetLastClrException;
try
if
ClrEx.IsTypeOf('System.Collections.Generic.KeyNotFoundException') then
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
value := '';
else
// them.
begin
openWith.Add('ht', 'hypertrm.exe');
end;
// GetEnumerator for the keys. Enumerate through the key values and
display both the
Console.WriteLine();
Keys := openWith.Keys.AsIEnumerable.GetEnumerator;
while Keys.MoveNext do
Values := openWith.Values.AsIEnumerable.GetEnumerator;
200
.Net Runtime Library for Delphi
// with the type that was specified for hash table values.
Console.WriteLine();
while Values.MoveNext do
Keys.Reset;
// with the type that was specified for hash table keys.
Console.WriteLine();
while Keys.MoveNext do
Console.WriteLine;
Console.WriteLine_14('Remove(''doc'')');
openWith.Remove('doc');
end.
201
.Net Runtime Library for Delphi
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')
*)
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
{$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;
var
ASetEnum: _IEnumerator;
begin
Console.Write_22('{');
206
.Net Runtime Library for Delphi
ASetEnum := Aset.AsIEnumerable.GetEnumerator;
while ASetEnum.MoveNext do
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
evenNumbers.Add(i * 2);
oddNumbers.Add((i * 2) + 1);
end;
DisplaySet(evenNumbers);
DisplaySet(oddNumbers);
numbers := CoGenericHashSet.CreateInstance(evenNumbers);
207
.Net Runtime Library for Delphi
numbers.UnionWith(oddNumbers.AsGenericIEnumerable);
DisplaySet(numbers);
end.
*)
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
var
AEnumerator: _IEnumerator;
begin
Console.WriteLine_14(test);
AEnumerator := words.AsIEnumerable.GetEnumerator;
while AEnumerator.MoveNext do
Console.WriteLine;
Console.WriteLine;
end;
var
result: _StringBuilder;
nodeP: _GenericLinkedListNode;
begin
Console.WriteLine_14(test);
begin
Console.WriteLine;
exit;
end;
result := CoStringBuilder.CreateInstance('(' +
VarToStr(node.Value) + ')');
nodeP := node.Previous;
begin
211
.Net Runtime Library for Delphi
nodeP := nodeP.Previous;
end;
node := node.Next;
begin
node := node.Next;
end;
Console.WriteLine_12(result);
Console.WriteLine;
end;
begin
Console := CoConsole.CreateInstance;
stringType := TClrAssembly.GetType('System.String');
sentence :=
CoGenericLinkedList.CreateInstance(words.AsArray.AsGenericIEnumerable)
;
Console.WriteLine_15('sentence.Contains(''jumped'') = {0}',
sentence.Contains('jumped'));
sentence.AddFirst('today');
212
.Net Runtime Library for Delphi
mark1 := sentence.First;
sentence.RemoveFirst;
sentence.AddLast_2(mark1);
sentence.RemoveLast;
sentence.AddLast('yesterday');
mark1 := sentence.Last;
sentence.RemoveLast;
sentence.AddFirst_2(mark1);
sentence.RemoveFirst();
current := sentence.FindLast('the');
sentence.AddAfter_1(current, 'old');
sentence.AddAfter_1(current, 'lazy');
current := sentence.Find('fox');
213
.Net Runtime Library for Delphi
sentence.AddBefore(current, 'quick');
sentence.AddBefore(current, 'brown');
// and to the previous node in the list. Indicate the 'dog' node.
mark1 := current;
mark2 := current.Previous;
current := sentence.Find('dog');
try
sentence.AddBefore(current, mark1);
except
on Ex: EOleSysError do
begin
ClrEx := EClrException.GetLastClrException;
try
if ClrEx.IsTypeOf('System.InvalidOperationException') then
finally
ClrEx.Free;
end;
end;
end;
Console.WriteLine;
214
.Net Runtime Library for Delphi
sentence.Remove_2(mark1);
sentence.AddBefore_2(current, mark1);
sentence.Remove_2(current);
sentence.AddAfter(mark2, current);
sentence.Remove('old');
sentence.CopyTo(sArray, 0);
for I := 0 to sArray.Length - 1 do
Console.WriteLine_12(sArray.GetValue(I));
sentence.Clear();
215
.Net Runtime Library for Delphi
Console.WriteLine();
sentence.Contains('jumped'));
Console.ReadLine();
end.
sentence.Contains('jumped') = True
216
.Net Runtime Library for Delphi
the (fox)
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:
Test 13: Add node removed in test 11 after a referenced node (brown):
the
quick
brown
dog
jumped
over
the
lazy
fox
217
.Net Runtime Library for Delphi
*)
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
{$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');
stackEnum := numbers.AsIEnumerable.GetEnumerator;
while stackEnum.MoveNext do
Console.WriteLine_12(stackEnum.Current);
Console.WriteLine;
numbers.Peek());
// GenericStack etc
stack2 :=
CoGenericStack.CreateInstance(numbers.AsGenericIEnumerable);
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();
end.
five
four
three
two
one
Popping 'five'
Popping 'four'
one
two
three
stack2.Contains('four') = False
stack2.Clear()
stack2.Count = 0
*)
225
.Net Runtime Library for Delphi
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);
for I := 0 to IntList.Count - 1 do
Console.WriteLine_8(IntList[I]);
227
.Net Runtime Library for Delphi
ListEnumerable := IntList.AsGenericIEnumerable;
Enumerable := CoEnumerable.CreateInstance;
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
end;
try
Console.WriteLine_15('SingleOrDefault: {0}',
Enumerable.SingleOrDefault(intType, ListEnumerable));
except
on E: Exception do
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('Max: {0}',
Enumerable.Max(ListEnumerable));
Console.WriteLine_15('Average: {0}',
Enumerable.Average(ListEnumerable));
Console.ReadLine();
end.
33
45
50
45
34
23
67
First: 33
FirstOrDefault: 33
Last: 67
LastOrDefault: 67
229
.Net Runtime Library for Delphi
ElementAt: 34
ElementAtOrDefault: 23
Count: 7
Contains: False
Contains: True
Sum: 297
Min: 23
Max: 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);
for I := 0 to IntList.Count - 1 do
Console.WriteLine_8(IntList[I]);
DynamicQry := CoClrDynamicQueryable.CreateInstance;
ListQueryable := DynamicQry.AsQueryable_6(IntList);
233
.Net Runtime Library for Delphi
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
end;
try
Console.WriteLine_15('SingleOrDefault: {0}',
DynamicQry.SingleOrDefault(ListQueryable));
except
on E: Exception do
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.
33
45
50
45
34
23
67
First: 33
FirstOrDefault: 33
Last: 67
LastOrDefault: 67
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
238
.Net Runtime Library for Delphi
Concatenation Concat
Equality SequenceEqual
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.
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
Lst.Add(100);
Lst.Add(200);
239
.Net Runtime Library for Delphi
Lst.Add(300);
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;
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);
DynamicQry := CoClrDynamicQueryable.CreateInstance;
exprStr := 'm.Equals(100)';
expParamArray := CoParameterExpressionArray.CreateInstance(1);
expHelper := CoExpressionHelper.CreateInstance;
expParamArray[0] := expParam;
DynamicExpr := CoClrDynamicExpression.CreateInstance;
242
.Net Runtime Library for Delphi
Value :=
Lst.Find(TClrGenericHelper.ToGenericPredicate(LambdaExpr.Compile,
intType));
Console.WriteLine_8(Value);
Console.ReadLine();
end.
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;
expParamArray: _ParameterExpressionArray;
expParam: _ParameterExpression;
expHelper: _ExpressionHelper;
ListEnumerator: _IEnumerator;
DynamicExpr: _ClrDynamicExpression;
LambdaExpr: _LambdaExpression;
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);
ListEnumerator := Lst.AsIEnumerable.GetEnumerator;
while ListEnumerator.MoveNext do
Console.WriteLine_12(ListEnumerator.Current);
DynamicQry := CoClrDynamicQueryable.CreateInstance;
ListQueryable := DynamicQry.AsQueryable_6(Lst);
expParamArray := CoParameterExpressionArray.CreateInstance(1);
expHelper := CoExpressionHelper.CreateInstance;
expParamArray[0] := expParam;
246
.Net Runtime Library for Delphi
DynamicExpr := CoClrDynamicExpression.CreateInstance;
evensLst :=
Lst.FindAll(TClrGenericHelper.ToGenericPredicate(LambdaExpr.Compile,
intType));
ListEnumerator := evensLst.AsIEnumerable.GetEnumerator;
while ListEnumerator.MoveNext do
Console.WriteLine_12(ListEnumerator.Current);
Console.ReadLine();
end.
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;
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);
ListEnumerator := Lst.AsIEnumerable.GetEnumerator;
while ListEnumerator.MoveNext do
Console.WriteLine_12(ListEnumerator.Current);
DynamicQry := CoClrDynamicQueryable.CreateInstance;
251
.Net Runtime Library for Delphi
expParamArray := CoParameterExpressionArray.CreateInstance(1);
expHelper := CoExpressionHelper.CreateInstance;
expParamArray[0] := expParam;
DynamicExpr := CoClrDynamicExpression.CreateInstance;
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.
252
.Net Runtime Library for Delphi
*)
253
.Net Runtime Library for Delphi
254
.Net Runtime Library for Delphi
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;
exprStr: string;
delegate: _Delegate;
begin
//Student Type
intType := TClrAssembly.GetType('ClassP.Student');
//Boolean Type
retType := TClrAssembly.GetType('System.Boolean');
expParamArray := CoParameterExpressionArray.CreateInstance(1);
expHelper := CoExpressionHelper.CreateInstance;
expParamArray[0] := expParam;
DynamicExpr := CoClrDynamicExpression.CreateInstance;
256
.Net Runtime Library for Delphi
delegate := LambdaExpr.Compile;
end.
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;
expHelper: _ExpressionHelper;
DynamicExpr: _ClrDynamicExpression;
LambdaExpr: _LambdaExpression;
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');
expParamArray := CoParameterExpressionArray.CreateInstance(2);
expHelper := CoExpressionHelper.CreateInstance;
258
.Net Runtime Library for Delphi
expParamArray[0] := expParam1;
expParamArray[1] := expParam2;
DynamicExpr := CoClrDynamicExpression.CreateInstance;
delegate := LambdaExpr.Compile;
end.
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);
decimalValue := TClrConvert.ToDecimal(shortValue);
decimalValue := TClrConvert.ToDecimal(intValue);
decimalValue := TClrConvert.ToDecimal(longValue);
decimalValue := TClrConvert.ToDecimal(ulongValue);
260
.Net Runtime Library for Delphi
Console.ReadLine;
except
on E: Exception do
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;
//====================================================================
======
//To convert integer value to decimal object, you can use the wrap
method of the
//_Decimal interface.
AInt32 := 45;
ADecimal := CoDecimal.Wrap(AInt32);
//====================================================================
======
//
//AsIComparable
//AsIConvertible
263
.Net Runtime Library for Delphi
AConvertible := ADecimal.AsIConvertible;
ACultureHelper := CoCultureInfoHelper.CreateInstance;
ACultureInfo := ACultureHelper.CurrentCulture;
AFormatProv := ACultureInfo.AsIFormatProvider;
AInt32 := AConvertible.ToInt32(AFormatProv);
AConsole.ReadKey;
except
on E: Exception do
end;
end.
264
.Net Runtime Library for Delphi
265
.Net Runtime Library for Delphi
266
.Net Runtime Library for Delphi
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.Name := 'ClrContainer1';
dynamicCtrl.Align := alClient;
dynamicCtrl.TabOrder := 0;
Delphi
FDataGridView := CoDataGridView.CreateInstance;
FDataGridView.Dock := DockStyle_Fill;
FDataGridView.AutoGenerateColumns := True;
268
.Net Runtime Library for Delphi
ClrContainer1.SuspendLayout;
ClrContainer1.AddClrControl(FDataGridView);
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;
interface
uses
269
.Net Runtime Library for Delphi
CNClrLib.Data, CNClrLib.Comp;
type
TForm1 = class(TForm)
Panel2: TPanel;
btnLoadData: TButton;
ClrContainer1: TClrContainer;
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
/// </summary>
procedure TForm1.AddHostControl;
begin
FDataGridView := CoDataGridView.CreateInstance;
FDataGridView.Dock := DockStyle_Fill;
FDataGridView.AutoGenerateColumns := True;
FBindingSource:= CoBindingSource.CreateInstance;
FDataGridView.DataSource := FBindingSource.Unwrap;
ClrContainer1.SuspendLayout;
ClrContainer1.AddClrControl(FDataGridView);
ClrContainer1.ResumeLayout();
end;
/// <summary>
/// Click event which loads the data from database and display on the
DataGridView control
/// </summary>
begin
LoadData;
end;
/// <summary>
271
.Net Runtime Library for Delphi
/// </summary>
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
adapter: _SqlDataAdapter;
commandBuilder: _SqlCommandBuilder;
table: _DataTable;
begin
try
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
276
.Net Runtime Library for Delphi
Form at Run-Time
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.
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));
// $1,632.54
end.
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;
begin
Console := CoConsole.CreateInstance;
AByteValues[0] := 12;
AByteValues[1] := 163;
AByteValues[2] := 255;
Console.WriteLine_14(TClrByteHelper.ToString(AByteValue, 'X4'));
end.
// 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');
ACultureInfo := CoCultureInfoHelper.CreateInstance;
ALongPattern :=
ACultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern;
281
.Net Runtime Library for Delphi
TClrDateTimeHelper.ToString(ADate1, ALongPattern));
end.
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;
ADate1 := TClrDateTimeHelper.Parse('28/08/2009');
Console.WriteLine_14(TClrDateTimeHelper.ToString(ADate1,
ACustomFormat));
end.
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.
// 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.
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
286
.Net Runtime Library for Delphi
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
See the files and subdirectories How to: Enumerate Directories and Files
in a directory
287
.Net Runtime Library for Delphi
program DirectoryCopyExample;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
CNClrLib.IO,
CNClrLib.Core,
CNClrLib.Host;
var
DirInfo: _DirectoryInfo;
DirInfos: _DirectoryInfoArray;
Dir: _Directory;
files: _FileInfoArray;
temppath: string;
Path: _Path;
I: Integer;
begin
DirInfo := CoDirectoryInfo.CreateInstance(ASourceDirName);
begin
288
.Net Runtime Library for Delphi
+ ASourceDirName);
end;
DirInfos := DirInfo.GetDirectories;
Dir := CoDirectory.CreateInstance;
Dir.CreateDirectory(ADestDirName);
// Get the files in the directory and copy them to the new
location.
files := DirInfo.GetFiles_2;
Path := CoPath.CreateInstance;
for I := 0 to files.Length - 1 do
begin
files[I].CopyTo_1(temppath, false);
end;
if ACopySubDir then
begin
for I := 0 to DirInfos.Length - 1 do
begin
end;
end;
289
.Net Runtime Library for Delphi
end;
begin
end.
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
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;
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
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;
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
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
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;
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
295
.Net Runtime Library for Delphi
end;
end;
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
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
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.
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;
begin
AWriter.WriteLine;
AWriter.WriteLine_17('{0} {1}',
TClrDateTimeHelper.ToLongTimeString(Now),
TClrDateTimeHelper.ToLongDateString(Now));
AWriter.WriteLine_12(' :');
AWriter.WriteLine_12 ('-----------------------
--------');
end;
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.
var
lines: TArray<string>;
Environment: _Environment;
outputFile: _StreamWriter;
I: Integer;
begin
304
.Net Runtime Library for Delphi
Environment := CoEnvironment.CreateInstance;
mydocpath := Environment.GetFolderPath(SpecialFolder_MyDocuments);
outputFile := CoStreamWriter.CreateInstance(mydocpath +
'\WriteLines.txt');
try
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;
mydocpath := Environment.GetFolderPath(SpecialFolder_MyDocuments);
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
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;
try
sr := CoStreamReader.CreateInstance('TestFile.txt');
try
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(e.Message);
end;
end;
Console.ReadLine;
end.
309
.Net Runtime Library for Delphi
See Also
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
b := CoCharArray.CreateInstance(str.Length);
sr := CoStringReader.CreateInstance(str);
try
sr.Read_1(b, 0, 13);
Console.WriteLine_3(b);
Console.WriteLine_3(b);
finally
sr.Close;
sr.Dispose;
end;
Console.ReadLine;
end.
//
// Some number o
// Some f characters
311
.Net Runtime Library for Delphi
See Also
Example
312
.Net Runtime Library for 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;
sw := CoStringWriter.CreateInstance(sb);
try
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.
//
314
.Net Runtime Library for Delphi
See Also
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
try
readmeEntry := archive.CreateEntry('Readme.txt');
writer := CoStreamWriter.CreateInstance(readmeEntry.Open);
try
320
.Net Runtime Library for Delphi
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;
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
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;
fileToCompress.Length.ToString(),
info.Length.ToString());
end;
finally
originalFileStream.Close;
originalFileStream.Dispose;
end;
end;
end;
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
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
Exit;
end;
try
reader := CoStreamReader.CreateInstance(fstream.AsStream);
try
// While not at the end of the file, read lines from the file.
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
Exit;
end;
try
breader := CoBinaryReader.CreateInstance(fstream.AsStream);
try
// While not at the end of the file, read lines from the file.
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.
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;
EncHelper: _EncodingHelper;
nBytes: Integer;
fs: _FileStream;
data: string;
begin
SetConsoleOutputCP(CP_UTF8);
Console := CoConsole.CreateInstance;
332
.Net Runtime Library for Delphi
EncHelper := CoEncodingHelper.CreateInstance;
cp737 := EncHelper.GetEncoding(737);
nBytes := cp737.GetByteCount(greekChars);
// bytes737 := CoByteArray.CreateInstance(nBytes);
bytes737 := cp737.GetBytes(greekChars);
fs := CoFileStream.CreateInstance('.\\CodePageBytes.dat', fmCreate);
fs.Write(bytes737, 0, bytes737.Length);
fs.Close();
fs := CoFileStream.CreateInstance('.\\CodePageBytes.dat', fmOpen);
bytes1 := CoByteArray.CreateInstance(fs.Length);
fs.Read(bytes1, 0, fs.Length);
fs.Close();
data := cp737.GetString(bytes1);
Console.WriteLine_13(CoClrObject.Wrap(data));
Console.WriteLine;
cp1252 := EncHelper.GetEncoding(1252);
data := cp1252.GetString(bytes1);
Console.WriteLine_14(data);
Console.ReadLine();
333
.Net Runtime Library for Delphi
end.
// ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ
// €‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—
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.
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;
begin
end;
begin
Console := CoConsole.CreateInstance;
cultureHelper := CoCultureInfoHelper.CreateInstance;
threadHelper := CoThreadHelper.CreateInstance;
threadHelper.CurrentThread.CurrentCulture :=
cultureHelper.CreateSpecificCulture('tr-TR');
uri := 'file:\\c:\users\username\Documents\bio.txt';
Console.WriteLine_14('Access is allowed.')
else
336
.Net Runtime Library for Delphi
// Prohibit access.
Console.ReadLine();
end.
// 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;
begin
end;
begin
Console := CoConsole.CreateInstance;
338
.Net Runtime Library for Delphi
cultureHelper := CoCultureInfoHelper.CreateInstance;
threadHelper := CoThreadHelper.CreateInstance;
threadHelper.CurrentThread.CurrentCulture :=
cultureHelper.CreateSpecificCulture('tr-TR');
uri := 'file:\\c:\users\username\Documents\bio.txt';
Console.WriteLine_14('Access is allowed.')
else
// Prohibit access.
Console.ReadLine();
end.
339
.Net Runtime Library for 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
end;
begin
Console := CoConsole.CreateInstance;
dates :=
TClrArrayHelper.ToDateTimeArray([TClrDateTimeHelper.GetDateTime(2012,
10, 11, 7, 06, 0),
cultureHelper := CoCultureInfoHelper.CreateInstance;
threadHelper := CoThreadHelper.CreateInstance;
threadHelper.CurrentThread.CurrentCulture :=
cultureHelper.CreateSpecificCulture('hr-HR');
ShowDayInfo;
Console.WriteLine;
341
.Net Runtime Library for Delphi
threadHelper.CurrentThread.CurrentCulture :=
cultureHelper.CreateSpecificCulture('en-GB');
ShowDayInfo;
Console.ReadLine();
end.
// Sunrise: 7:06:00
// Sunset: 18:19:00
//
// Sunrise: 07:06:00
// Sunset: 18:19:00
342
.Net Runtime Library for 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;
clrdateStrings: _StringArray;
dateStrings: TClrStringDynArray;
restoredDate: TDateTime;
begin
Console := CoConsole.CreateInstance;
cultureHelper := CoCultureInfoHelper.CreateInstance;
threadHelper := CoThreadHelper.CreateInstance;
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.Close();
sr := CoStreamReader.CreateInstance('dateData.dat');
dateData := sr.ReadToEnd();
sr.Close();
dateStrings := TClrArrayHelper.ToStringDynArray(clrdateStrings);
344
.Net Runtime Library for Delphi
// Restore and display the data using the conventions of the en-US
culture.
threadHelper.CurrentThread.CurrentCulture.DisplayName);
begin
else
end;
Console.WriteLine();
// Restore and display the data using the conventions of the en-GB
culture.
threadHelper.CurrentThread.CurrentCulture :=
cultureHelper.CreateSpecificCulture('en-GB');
threadHelper.CurrentThread.CurrentCulture.DisplayName);
begin
else
end;
Console.ReadLine();
end.
345
.Net Runtime Library for Delphi
//
346
.Net Runtime Library for 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;
clrdateStrings: _StringArray;
dateStrings: TClrStringDynArray;
restoredDate: TDateTime;
begin
Console := CoConsole.CreateInstance;
cultureHelper := CoCultureInfoHelper.CreateInstance;
threadHelper := CoThreadHelper.CreateInstance;
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.Close();
348
.Net Runtime Library for Delphi
sr := CoStreamReader.CreateInstance('dateData.dat');
dateData := sr.ReadToEnd();
sr.Close();
dateStrings := TClrArrayHelper.ToStringDynArray(clrdateStrings);
// Restore and display the data using the conventions of the en-US
culture.
threadHelper.CurrentThread.CurrentCulture.DisplayName);
begin
else
end;
Console.WriteLine();
// Restore and display the data using the conventions of the en-GB
culture.
threadHelper.CurrentThread.CurrentCulture :=
cultureHelper.CreateSpecificCulture('en-GB');
threadHelper.CurrentThread.CurrentCulture.DisplayName);
begin
349
.Net Runtime Library for Delphi
if TClrDateTimeHelper.TryParse(dateStr,
cultureHelper.InvariantCulture.AsIFormatProvider, dtsNone,
restoredDate) then
begin
end
else
end;
Console.ReadLine();
end.
//
350
.Net Runtime Library for Delphi
351
.Net Runtime Library for Delphi
352
.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.
C#
353
.Net Runtime Library for Delphi
// =================================================
namespace ClassLibraryTest
[DispId(0)]
return a + b;
[DispId(1)]
return ID;
[DispId(2)]
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}']
355
.Net Runtime Library for Delphi
end;
// NB: Method GetID and GetID_ are the same excepts GetID accept
Widestring as
var
oClass : _Class1;
begin
try
begin
TClrAssembly.LoadFrom('ClassLibraryTest.dll');
oClass :=
_Class1(TClrDispatchActivator.CreateInstance('ClassLibraryTest.Class1'
));
end;
except
on E: Exception do
end;
end.
// Output
// Add Method: 30
// 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 create methods and assemblies at run time by using Reflection.Emit.
Dynamic Source Code Generation and Compilation
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.
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
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.
Explains how reflection handles the type parameters and type arguments of generic types and
generic methods.
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.
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.
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
varObject := CoClrObject.CreateInstance.Unwrap;
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
a := TClrAssembly.LoadFrom('MyExe.exe');
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.
program ListMembers;
{$APPTYPE CONSOLE}
{$R *.res}
uses
CNClrLib.Core,
361
.Net Runtime Library for Delphi
CNClrLib.Enums,
CNClrLib.Host;
var
Console: _Console;
var
I: Integer;
begin
for I := 0 to ms.Length - 1 do
begin
end;
Console.WriteLine;
end;
var
t: _Type;
ci: _ConstructorInfoArray;
begin
Console := CoConsole.CreateInstance;
t := TClrAssembly.GetType('System.String');
// Constructors.
ci := t.GetConstructors_1(BindingFlags_Public or
BindingFlags_Instance);
Console.WriteLine_14('//Constructors');
PrintMembers(ci);
end.
362
.Net Runtime Library for 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');
TypeHelper := CoTypeHelper.CreateInstance;
MyType := TypeHelper.GetType_2('System.IO.File');
Mymemberinfoarray := MyType.GetMembers;
Console.WriteLine;
Mymemberinfoarray.Length, MyType.FullName);
Console.WriteLine_15('{0}.', MyType.FullName);
if MyType.IsPublic then
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;
MyType := TypeHelper.GetType_2('System.Reflection.FieldInfo');
Mymethodinfo := MyType.GetMethod_5('GetValue');
Mymembertypes := Mymethodinfo.MemberType;
begin
end
begin
end
begin
end
begin
end
366
.Net Runtime Library for Delphi
begin
end
begin
end
begin
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;
begin
while ms.MoveNext do
Console.WriteLine;
end;
var
t: _Type;
fi: _FieldInfoArray;
pi: _PropertyInfoArray;
ei: _EventInfoArray;
mi: _MethodInfoArray;
ci: _ConstructorInfoArray;
begin
Console := CoConsole.CreateInstance;
t := TClrAssembly.GetType('System.IO.BufferedStream');
fi := t.GetFields_1(BindingFlags_Static or BindingFlags_NonPublic
or BindingFlags_Public);
PrintMembers(fi.AsIEnumerator);
// Static properties.
pi := t.GetProperties_1(BindingFlags_Static or
BindingFlags_NonPublic or BindingFlags_Public);
369
.Net Runtime Library for Delphi
PrintMembers(pi.AsIEnumerator);
// Static events.
ei := t.GetEvents_1(BindingFlags_Static or BindingFlags_NonPublic
or BindingFlags_Public);
PrintMembers(ei.AsIEnumerator);
// Static methods.
mi := t.GetMethods_1(BindingFlags_Static or BindingFlags_NonPublic
or BindingFlags_Public);
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);
PrintMembers(fi.AsIEnumerator);
// Instance properites.
pi := t.GetProperties_1(BindingFlags_Instance or
BindingFlags_NonPublic or BindingFlags_Public);
PrintMembers(pi.AsIEnumerator);
// Instance events.
ei := t.GetEvents_1(BindingFlags_Instance or BindingFlags_NonPublic
or BindingFlags_Public);
370
.Net Runtime Library for Delphi
PrintMembers(ei.AsIEnumerator);
// Instance methods.
mi := t.GetMethods_1(BindingFlags_Instance or BindingFlags_NonPublic
or BindingFlags_Public);
PrintMembers(mi.AsIEnumerator);
Console.WriteLine;
Console.Read();
end.
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
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
for I := 0 to typeParameters.Length - 1 do
begin
372
.Net Runtime Library for Delphi
if typeParameters[I].IsGenericParameter then
DisplayGenericParameter(typeParameters[I])
else
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
begin
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
else
end;
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
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
else
begin
begin
end;
begin
end;
begin
end;
end;
375
.Net Runtime Library for Delphi
Delphi
var
d1: _Type;
d2: _GenericDictionary;
d3: _Type;
d4: _Type;
begin
// 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
d2 :=
CoGenericDictionary.CreateInstance(TClrAssembly.GetType('System.
String'),
TClrAssembly.GetType('OtherNamespace.Example'));
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;
var
classConstraint: _Type;
iConstraints: _TypeArray;
sConstraints: GenericParameterAttributes;
I: Integer;
begin
tp.Name, tp.GenericParameterPosition);
iConstraints := tp.GetGenericParameterConstraints;
for I := 0 to iConstraints.Length - 1 do
begin
if iConstraints[I].IsInterface then
iConstraints[I]);
end;
GenericParameterAttributes_SpecialConstraintMask;
begin
end
else
380
.Net Runtime Library for Delphi
begin
GenericParameterAttributes_DefaultConstructorConstraint))
then
begin
end
GenericParameterAttributes_ReferenceTypeConstraint)) then
begin
end
GenericParameterAttributes_NotNullableValueTypeConstraint))
then
begin
end;
end;
end;
// type.
var
typeParameters: _TypeArray;
I: Integer;
begin
Console.WriteLine;
t.IsGenericType);
381
.Net Runtime Library for Delphi
t.IsGenericTypeDefinition);
typeParameters := t.GetGenericArguments;
typeParameters.Length);
for I := 0 to typeParameters.Length - 1 do
begin
if typeParameters[I].IsGenericParameter then
DisplayGenericParameter(typeParameters[I])
else
typeParameters[I]);
end;
end;
var
d1: _Type;
d2: _GenericDictionary;
d3: _Type;
d4: _Type;
constructed: _Type;
typeArgs: _TypeArray;
o: OleVariant;
begin
Console := CoConsole.CreateInstance;
//
382
.Net Runtime Library for Delphi
// omit the type arguments but retain the comma that separates
// them.
d1 :=
TClrAssembly.GetType('System.Collections.Generic.Dictionary`2');
d2 :=
CoGenericDictionary.CreateInstance(TClrAssembly.GetType('System.String
'),
TClrAssembly.GetType('System.Int32'));
d3 := d2.GetType;
d4 := d3.GetGenericTypeDefinition;
DisplayGenericType(d1);
DisplayGenericType(d2.GetType());
383
.Net Runtime Library for Delphi
// dictionary is Integer.
typeArgs :=
TClrArrayHelper.ToTypeArray([TClrAssembly.GetType('System.String'),
TClrAssembly.GetType('System.Int32')]);
constructed := d1.MakeGenericType(typeArgs);
DisplayGenericType(constructed);
o := TClrActivator.CreateInstance(constructed);
Console.WriteLine;
(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
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;
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
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;
389
.Net Runtime Library for Delphi
assemHelper := CoAssemblyHelper.CreateInstance;
assem := assemHelper.Load(longName);
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);
//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
Delphi
var
...
returnType: _Type;
voidType: _Type;
handler: _DynamicMethod;
begin
...
returnType := GetDelegateReturnType(tDelegate);
voidType := TClrAssembly.GetType('System.Void');
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');
395
.Net Runtime Library for Delphi
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
public ExampleForm()
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;
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
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;
var
invoke: _MethodInfo;
begin
if not
d.BaseType.Equals(TClrAssembly.GetType('System.MulticastDelegate'))
then
RaiseClrException('Not a delegate.');
invoke := d.GetMethod_5('Invoke');
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
//
assem := TClrAssembly.GetType('exampleNamespace.Example').Assembly;
// in advance.)
//
tExForm := assem.GetType('ExampleForm');
exFormAsObj := TClrActivator.CreateInstance(tExForm);
400
.Net Runtime Library for Delphi
//
//Example:
exFormAsClrObj := TClrActivator.ClrCreateInstance(tExForm);
//
evClick := tExForm.GetEvent('Click');
tDelegate := evClick.EventHandlerType;
//
exType := TClrAssembly.GetType('exampleNamespace.Example');
miHandler := exType.GetMethod_4('LuckyHandler',
BindingFlags_NonPublic or BindingFlags_Instance);
//
delegateHelper := CoDelegateHelper.CreateInstance;
d := delegateHelper.CreateDelegate_2(tDelegate, exFormAsObj,
miHandler);
//
addHandler := evClick.GetAddMethod_1;
addHandlerArgs := TClrArrayHelper.ToObjectArray([d]);
addHandler.Invoke_2(exFormAsObj, addHandlerArgs);
401
.Net Runtime Library for Delphi
//
//
returnType := GetDelegateReturnType(tDelegate);
voidType := TClrAssembly.GetType('System.Void');
handler := CoDynamicMethod.CreateInstance('',
nil,
GetDelegateParameterTypes(tDelegate),
TClrAssembly.GetType('exampleNamespace.Example'));
//
ilgen := handler.GetILGenerator;
showParameters :=
TClrArrayHelper.ToTypeArray([TClrAssembly.GetType('System.String')]);
msgBoxType :=
TClrAssembly.GetType('System.Windows.Forms.Form.MessageBox');
402
.Net Runtime Library for Delphi
ilgen.Emit_5(opCode.Call, simpleShow);
ilgen.Emit(opCode.Pop);
ilgen.Emit(opCode.Ret);
//
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
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
406
.Net Runtime Library for Delphi
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.
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
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);
OpCodes := CoOpCodesHelper.CreateInstance;
ilgen.Emit(OpCodes.Ldarg_0);
ilgen.Emit_7(OpCodes.Newobj, ctor);
end.
413
.Net Runtime Library for Delphi
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>
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;
//
var
constraints: TOleEnum;
begin
if ((constraints and
GenericParameterAttributes_ReferenceTypeConstraint)
417
.Net Runtime Library for Delphi
begin
Console.WriteLine_14(' ReferenceTypeConstraint');
end;
if ((constraints and
GenericParameterAttributes_NotNullableValueTypeConstraint)
begin
Console.WriteLine_14(' NotNullableValueTypeConstraint');
end;
if ((constraints and
GenericParameterAttributes_DefaultConstructorConstraint)
begin
Console.WriteLine_14(' DefaultConstructorConstraint');
end;
end;
var
I, J: Integer;
begin
begin
Exit;
end;
begin
t := t.GetGenericTypeDefinition;
end;
418
.Net Runtime Library for Delphi
typeParameters := t.GetGenericArguments;
Console.WriteLine;
typeParameters.Length, t);
for I := 0 to typeParameters.Length - 1 do
begin
Console.WriteLine;
constraints := typeParameters[I].GetGenericParameterConstraints;
for J := 0 to constraints.Length - 1 do
begin
if constraints[J].IsInterface then
else
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
420
.Net Runtime Library for Delphi
// AssemblyBuilderAccess.Save is specified.
//
myAsmName := CoAssemblyName.CreateInstance('GenericEmitExample1');
myAssembly := myDomain.DefineDynamicAssembly(myAsmName,
abaRunAndSave);
// module assembly, the module name and file name are the same
//
myModule := myAssembly.DefineDynamicModule_2(myAsmName.Name,
myAsmName.Name + '.dll');
// be used as constraints.
//
//
421
.Net Runtime Library for Delphi
//
typeParamNames := TClrArrayHelper.ToStringArray(['TFirst',
'TSecond']);
typeParams := myType.DefineGenericParameters(typeParamNames);
TFirst := typeParams[0];
TSecond := typeParams[1];
//
// constructor.
TFirst.SetGenericParameterAttributes(
GenericParameterAttributes_DefaultConstructorConstraint or
GenericParameterAttributes_ReferenceTypeConstraint);
TSecond.SetBaseTypeConstraint(baseType);
interfaceTypes := TClrArrayHelper.ToTypeArray([interfaceA,
interfaceB]);
TSecond.SetInterfaceConstraints(interfaceTypes);
// of type TFirst.
422
.Net Runtime Library for Delphi
// 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);
// which does all the work of putting the input elements into
// the list, and to return, leaving the list on the stack. The
//
423
.Net Runtime Library for Delphi
// constructor of List<TFirst>.
//
//
// 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
OpCodes := CoOpCodesHelper.CreateInstance;
ilgen.Emit(OpCodes.Ldarg_0);
ilgen.Emit_7(OpCodes.Newobj, ctor);
ilgen.Emit(OpCodes.Ret);
finished := myType.CreateType;
myAssembly.Save(myAsmName.Name + '.dll');
// constructed type.
//
typeArgs := TClrArrayHelper.ToTypeArray([
TClrAssembly.GetType('Example'),
TClrAssembly.GetType('ExampleDerived')]);
constructed := finished.MakeGenericType(typeArgs);
mi := constructed.GetMethod_5('ExampleMethod');
425
.Net Runtime Library for Delphi
//
input :=
TClrArrayHelper.ToObjectArray([TClrActivator.CreateInstance('Example')
,
TClrActivator.CreateInstance('Example')]);
arguments := TClrArrayHelper.ToObjectArray([input]);
//List<Example>
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
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
432
.Net Runtime Library for Delphi
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'));
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);
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
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
var
provider: _CSharpCodeProvider;
sourceFile: string;
sw: _StreamWriter;
tw: _IndentedTextWriter;
begin
provider := CoCSharpCodeProvider.CreateInstance;
else
sw := CoStreamWriter.CreateInstance(sourceFile, false);
try
440
.Net Runtime Library for Delphi
tw := CoIndentedTextWriter.CreateInstance(sw.AsTextWriter, '
');
provider.GenerateCodeFromCompileUnit(compileunit, tw.AsTextWriter,
CoCodeGeneratorOptions.CreateInstance);
tw.Close();
finally
sw.Close;
sw.Dispose;
end;
Result := sourceFile;
end;
441
.Net Runtime Library for Delphi
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.
var
provider: _CSharpCodeProvider;
cp: _CompilerParameters;
cr: _CompilerResults;
I: Integer;
begin
provider := CoCSharpCodeProvider.CreateInstance;
442
.Net Runtime Library for Delphi
cp := CoCompilerParameters.CreateInstance;
cp.ReferencedAssemblies.Add('System.dll');
// a class library.
cp.GenerateExecutable := true;
cp.OutputAssembly := exeFile;
cp.GenerateInMemory := false;
// Invoke compilation.
cr := provider..CompileAssemblyFromFile(cp,
TClrArrayHelper.ToStringArray([sourceFile]));
begin
for I := 0 to cr.Errors.Count - 1 do
begin
Console.WriteLine;
end;
end
else
begin
443
.Net Runtime Library for Delphi
end;
Result := cr.Errors.Count = 0;
end;
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.
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.
Delphi
procedure AddFields;
var
widthValueField: _CodeMemberField;
heightValueField: _CodeMemberField;
begin
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);
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
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
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);
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
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
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');
returnStatement :=
CoCodeMethodReturnStatement.CreateInstance;
Environment := CoEnvironment.CreateInstance;
452
.Net Runtime Library for Delphi
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
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'));
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);
// "CodeDOMCreatedClass testClass =
start.Statements.Add(CoCodeVariableDeclarationStatement.CreateIn
stance(
CoCodeTypeReference.CreateInstance('CodeDOMCreatedClass'),
'testClass',
objectCreate.AsCodeExpression).AsCodeStatement);
// "testClass.ToString()"
toStringInvoke :=
CoCodeMethodInvokeExpression.CreateInstance(
CoCodeVariableReferenceExpression.CreateInstance('testClass').As
CodeExpression,
'ToString', nil);
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
Delphi
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
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
program SampleCodeDom;
{$APPTYPE CONSOLE}
{$R *.res}
uses
CNClrLib.Enums,
CNClrLib.EnumTypes,
CNClrLib.CodeDom,
CNClrLib.CSharp,
CNClrLib.Core,
CNClrLib.Host;
const
/// <summary>
/// </summary>
outputFileName = 'SampleCode.cs';
var
/// <summary>
/// </summary>
targetUnit: _CodeCompileUnit;
/// <summary>
461
.Net Runtime Library for Delphi
/// The only class in the compile unit. This class contains 2
fields,
/// </summary>
targetClass: _CodeTypeDeclaration;
type
/// <summary>
/// </summary>
TSample = class
public
constructor Create;
procedure AddFields;
procedure AddProperties;
procedure AddMethod;
procedure AddConstructor;
procedure AddEntryPoint;
end;
/// <summary>
/// </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>
/// </summary>
procedure TSample.AddFields;
var
widthValueField: _CodeMemberField;
heightValueField: _CodeMemberField;
begin
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);
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>
/// </summary>
procedure TSample.AddProperties;
var
widthProperty: _CodeMemberProperty;
heightProperty: _CodeMemberProperty;
areaProperty: _CodeMemberProperty;
areaExpression: _CodeBinaryOperatorExpression;
begin
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);
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);
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.'));
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
/// </summary>
procedure TSample.AddMethod;
var
toStringMethod: _CodeMemberMethod;
widthReference: _CodeFieldReferenceExpression;
heightReference: _CodeFieldReferenceExpression;
areaReference: _CodeFieldReferenceExpression;
returnStatement: _CodeMethodReturnStatement;
formattedOutput: string;
Environment: _Environment;
Parameters: _CodeExpressionArray;
begin
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');
returnStatement := CoCodeMethodReturnStatement.CreateInstance;
Environment := CoEnvironment.CreateInstance;
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>
/// </summary>
procedure TSample.AddConstructor;
var
constructorA: _CodeConstructor;
widthReference: _CodeFieldReferenceExpression;
heightReference: _CodeFieldReferenceExpression;
begin
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'));
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>
/// </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);
// "CodeDOMCreatedClass testClass =
start.Statements.Add(CoCodeVariableDeclarationStatement.CreateInstance
(
CoCodeTypeReference.CreateInstance('CodeDOMCreatedClass'),
'testClass',
objectCreate.AsCodeExpression).AsCodeStatement);
// "testClass.ToString()"
toStringInvoke := CoCodeMethodInvokeExpression.CreateInstance(
CoCodeVariableReferenceExpression.CreateInstance('testClass').AsCodeEx
pression,
'ToString', nil);
// 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>
/// </summary>
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>
/// </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>
// Runtime Version:2.0.50727.42
//
// </auto-generated>
477
.Net Runtime Library for Delphi
//--------------------------------------------------------------------
------
namespace CodeDOMSample
using System;
this.widthValue = width;
this.heightValue = height;
get
return this.widthValue;
478
.Net Runtime Library for Delphi
get
return this.heightValue;
get
return string.Format(
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.
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.
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.
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.
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.
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_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;
interface
uses
SystemXmlUnitConst;
type
{ Forward Declarations }
TXmlDocument = Class;
{ Event Handlers }
{ TXmlDocument }
TXmlDocument = Class(TClrBaseObject)
private
FNodeChanged : TXmlNodeChangedEventHandler;
procedure Set_NodeChanged(Value :
TXmlNodeChangedEventHandler);
public
constructor Create;
488
.Net Runtime Library for Delphi
end;
implementation
begin
Result :=
TClrAssembly.GetRegisterAssembly(sC_SystemXmlUnit_Asm_ID);
end;
{ TXmlDocument }
constructor TXmlDocument.Create;
begin
end;
begin
end;
begin
489
.Net Runtime Library for Delphi
end;
var
evtObject: TXmlDocument;
evtArg: _XmlNodeChangedEventArgs;
begin
evtObject :=
TXmlDocument(ClrHostManager.GetRegisteredEventObject(sender));
evtArg := CoXmlNodeChangedEventArgs.Wrap(e.EventArgs);
evtObject.FNodeChanged(evtObject, evtArg);
end;
procedure TXmlDocument.Set_NodeChanged(Value :
TXmlNodeChangedEventHandler);
var
stdEvtHandler : TClrEventHandler;
begin
stdEvtHandler := TXmlDocument_NodeChangedHandler;
RegisterEventCallBack('NodeChanged', @stdEvtHandler)
else
UnRegisterEventCallBack('NodeChanged', @stdEvtHandler);
FNodeChanged := Value;
end;
begin
SetPropertyValue('InnerText', Value);
end;
490
.Net Runtime Library for Delphi
begin
Result := GetPropertyValue('InnerXml');
end;
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.
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
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.
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
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
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;
interface
uses
type
{ TService1 }
TService1 = Class(TClrBaseObject)
private
public
constructor Create;
end;
500
.Net Runtime Library for Delphi
implementation
begin
Result := TClrAssembly.GetRegisterAssembly(sC_WebService1_Asm_ID);
end;
{ TService1 }
constructor TService1.Create;
begin
end;
begin
Result := InvokeMethod('HelloWorld');
end;
begin
Result := GetPropertyValue('AllowAutoRedirect');
end;
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
CoXXXXX = class
end;
503
.Net Runtime Library for Delphi
CoClrObject = class
504
.Net Runtime Library for Delphi
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
CoXXXXX = class
end;
CoClrObject = class
506
.Net Runtime Library for Delphi
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
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
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_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.
511
.Net Runtime Library for Delphi
//
// Type: System.EventArgs
// Value: System.EventArgs
// HashCode: 33476626
//
// Type: System.Random
// Value: System.Random
// HashCode: 32854180
//
// Type: System.Exception
// Value: System.Exception: Exception of type
'System.Exception' was thrown.
// HashCode: 27252167
//
// 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
argumentExc := CoArgumentException.CreateInstance;
obaseExc := CoException.Wrap(argumentExc);
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
// To convert integer value to decimal object, you can use the wrap
method of the
// _Decimal interface.
oInt32 := 45;
oDecimal := CoDecimal.Wrap(oInt32);
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.
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.
This Library contains classes and interfaces for starting and hostimg the .Net Comman
Language Runtime.
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
Namespaces
Name Description
515
.Net Runtime Library for Delphi
Name Description
Classes
Name Description
Interfaces
Name Description
Enumeration Types
Name Description
TAutoSizeMode Specifies how a control will behave when its AutoSize property is
enabled.
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 Class
Collapse All Expand All
Inheritance Hierarchy
CNClrLib.Comp.TClrContainer
File: CNClrLib.Comp.pas
Namespace: CNClrLib.Comp
Syntax
Delphi
Constructors
Name Description
Destructors
517
.Net Runtime Library for Delphi
Name Description
Methods
Show: Protected
Name Description
518
.Net Runtime Library for Delphi
Name Description
ValidateChildren Causes all of the child controls within a control that support
validation to validate their data.
Properties
Name Description
See Also
519
.Net Runtime Library for Delphi
TClrContainer Methods
TClrContainer Properties
TClrContainer.Create Constructor
Creates and initializes an instance of TClrContainer.
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Namespace
TClrContainer.Destroy Destructor
Destroys an instance of TClrContainer.
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Namespace
520
.Net Runtime Library for Delphi
TClrContainer Methods
The methods of the TClrContainer class are listed here.
Methods
Show: Protected
Name Description
521
.Net Runtime Library for Delphi
Name Description
ValidateChildren Causes all of the child controls within a control that support
validation to validate their data.
AddClrControl Method
This is the overview for the AddClrControl method overload.
Overload List
Name Description
522
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Namespace
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Namespace
AddRangeClrControls Method
This is the overview for the AddRangeClrControls method overload.
523
.Net Runtime Library for Delphi
Overload List
Name Description
TClrContainer.AddRangeClrControls Method
(_ControlArray)
Adds an array of control objects to the ClrContainer.
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Namespace
TClrContainer.AddRangeClrControls Method
(array of _Control)
Adds an array of control objects to the ClrContainer.
Syntax
Delphi
524
.Net Runtime Library for Delphi
See Also
TClrContainer Class
CNClrLib.Comp Names pace
Contains Method
This is the overview for the Contains method overload.
Overload List
Name Description
Syntax
Delphi
See Also
525
.Net Runtime Library for Delphi
TClrContainer Class
CNClrLib.Comp Namespace
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Namespace
TClrContainer.GetClrControls Method
Gets the collection of .net controls on the ClrContainer.
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Names pace
526
.Net Runtime Library for Delphi
TClrContainer.HasChildren Method
Gets a value indicating whether the control contains one or more child controls.
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Co mp Namespace
TClrContainer.Invalidate Method
Schedules a control repaint. Invalidates the entire surface of the control and causes the control
to be redrawn.
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Namespa ce
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
TClrContainer.PerformLayout Method
Performs scaling of the container control and its children.
Syntax
Delphi
procedure PerformLayout;
See Also
TClrContainer Class
CNClrLib.Comp Namespace
TClrContainer.QueryInterface Method
Returns a reference to a specified interface if the object supports that interface.
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Na mespace
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
TClrContainer.ResetBackColor Method
Resets the BackColor property to its default value.
Syntax
Delphi
procedure ResetBackColor;
See Also
TClrContainer Class
CNClrLib.Comp Namespace
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
TClrContainer.ResetFont Method
Resets the Font property to its default value.
Syntax
Delphi
procedure ResetFont;
See Also
TClrContainer Class
CNClrLib.Comp Namespace
TClrContainer.ResetForeColor Method
Resets the ForeColor property to its default value.
Syntax
Delphi
procedure ResetForeColor;
See Also
TClrContainer Class
CNClrLib.Comp Namespac e
530
.Net Runtime Library for Delphi
CLOSE
TClrContainer.ResumeLayout Method
Resumes usual layout logic.
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Namespace
TClrContainer.SuspendLayout Method
Temporarily suspends the layout logic for the control.
Syntax
Delphi
procedure SuspendLayout;
See Also
TClrContainer Class
CNClrLib.Comp Namespace
TClrContainer.Update Method
Causes the control to redraw the invalidated regions within its client area.
Syntax
Delphi
531
.Net Runtime Library for Delphi
See Also
TClrContainer Class
CNClrLib.Comp Name space
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
TClrContainer Properties
The properties of the TClrContainer class are listed here.
Properties
Name Description
532
.Net Runtime Library for Delphi
Name Description
TClrContainer.ActiveControl Property
Gets or sets the active control on the container control.
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Namespace
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
533
.Net Runtime Library for Delphi
See Also
TClrContainer Class
CNClrLib.Comp Namespace
TClrContainer.AutoSize Property
Specifies whether the control sizes itself automatically to accommodate its contents.
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Namespace
TClrContainer.AutoSizeMode Property
Gets or sets how the control will resize itself.
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Namespace
534
.Net Runtime Library for Delphi
CLOSE
TClrContainer.DefaultInterface Property
The default interface of the ClrContainer class.
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Namespace
TClrContainer.SizeMode Property
Determines how the CLR control is sized in the Clrcontainer.
Syntax
Delphi
See Also
TClrContainer Class
CNClrLib.Comp Namespace
TClrForm Class
Collapse All Expand All
Inheritance Hierarchy
535
.Net Runtime Library for Delphi
CNClrLib.Comp.IVCLFrameForm
CNClrLib.Comp.TClrForm
File: CNClrLib.Comp.pas
Namespace: CNClrLib.Comp
Syntax
Delphi
Constructors
Name Description
Destructors
Name Description
TClrForm.Create Constructor
Create creates a new instance of the TClrForm object.
Syntax
Delphi
See Also
TClrForm Class
CNClrLib.Comp Namespace
536
.Net Runtime Library for Delphi
TClrForm.Destroy Destructor
Destroy frees the memory associated with this instance of the TClrForm object.
Syntax
Delphi
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 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
Enumeration Types
Name Description
TAutoSizeMode Specifies how a control will behave when its AutoSize property is
enabled.
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
);
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
);
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
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
_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
_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.
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
_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.
_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.
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
_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
_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.
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
Properties
Name Description
545
.Net Runtime Library for Delphi
Name Description
546
.Net Runtime Library for Delphi
Name Description
547
.Net Runtime Library for Delphi
Name Description
548
.Net Runtime Library for Delphi
Name Description
See Also
_ClrDataTypeHelper Methods
_ClrDataTypeHelper Properties
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.
549
.Net Runtime Library for Delphi
Name Description
See Also
_ClrEventArgs Properties
Inheritance Hierarchy
CNClrLib.Core.Intf._ClrEventCallbacks
File: CNClrLib.Core.Intf.pas
Namespace: CNClrLib.Core.Intf
Syntax
Delphi
_ClrEventCallbacks = dispinterface;
Methods
Name Description
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.
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).
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).
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
Inheritance Hierarchy
CNClrLib.Core.Intf._ClrEventHander
File: CNClrLib.Core.Intf.pas
Namespace: CNClrLib.Core.Intf
Syntax
Delphi
_ClrEventHander = dispinterface;
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
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.
553
.Net Runtime Library for Delphi
Name Description
554
.Net Runtime Library for Delphi
Properties
Name Description
See Also
_ClrHost Methods
_ClrHost Properties
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
556
.Net Runtime Library for Delphi
Name Description
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.
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.
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.
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
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.
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.
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.
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.
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.
Properties
Name Description
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
See Also
_ClrObject Methods
_ClrObject Properties
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
See Also
_ClrWSDL Methods
_ClrWSDL Properties
Inheritance Hierarchy
CNClrLib.Core.Intf._Exception
File: CNClrLib.Core.Intf.pas
Namespace: CNClrLib.Core.Intf
Syntax
Delphi
_Exception = dispinterface;
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
See Also
_IClrObject Methods
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
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
See Also
How to: Use Linq and Dynamic Linq Interfaces
Inheritance Hierarchy
CNClrLib.DynamicLinq._ClrDynamicClass
File: CNClrLib.DynamicLinq.pas
Namespace: CNClrLib.DynamicLinq
Syntax
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.
Inheritance Hierarchy
CNClrLib.DynamicLinq._ClrDynamicProperty
File: CNClrLib.DynamicLinq.pas
Namespace: CNClrLib.DynamicLinq
Syntax
Inheritance Hierarchy
CNClrLib.DynamicLinq._ClrDynamicPropertyArray
File: CNClrLib.DynamicLinq.pas
Namespace: CNClrLib.DynamicLinq
Syntax
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.
Inheritance Hierarchy
CNClrLib.DynamicLinq._ClrParseException
File: CNClrLib.DynamicLinq.pas
Namespace: CNClrLib.DynamicLinq
Syntax
Delphi
_ClrParseException = dispinterface;
Examples
The example below shows the TypeCode enumeration in c# and it equivalent in Delphi using
TOleEnum defined in CNClrLib.Enums Namespaces.
C#
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
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
571
.Net Runtime Library for Delphi
Examples
The example below demonstrates how the delphi specific enumeration types are defined to
map to it counterparts in CNClrLib.Enums.
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
Examples
The example below demonstrates how the array constants of the enumeration types are
defined.
Delphi
const
);
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
ATypeCodeConst := TypeCodeValues[tcInt32];
Convert := CoConvert.CreateInstance;
//Get the TypeCode constant from the value after the type has
changed
ATypeCodeConst2 := Convert.GetTypeCode(typeChangeVal);
WriteLn(ATypeCodeConst = ATypeCodeConst2);
end.
//Output
// True
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
// bitwise combinations.
ATypeCodeConst2 := StringSplitOptions_None or
StringSplitOptions_RemoveEmptyEntries;
WriteLn(ATypeCodeConst = ATypeCodeConst2);
end.
//Output
// True
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
TClrBaseObject This is the base object that can store different kinds of data types.
TClrObject This Class is a wrapper of a .Net object. This class inherit from the
TClrBaseObject Class.
TClrWSDL Contains methods to build and convert XML Web Services into a
.net assembly.
Functions
Name Description
ClrLibraryLoaded Determine if the runtime host library has been loaded and
578
.Net Runtime Library for Delphi
Name Description
started.
Namespaces
Name Description
Name Description
Types
Name Description
579
.Net Runtime Library for Delphi
Name Description
TClrBase This is the ultimate base class of all classes in the Host Class
Library.
580
.Net Runtime Library for Delphi
Name Description
581
.Net Runtime Library for Delphi
Name Description
Classes
Name Description
TClrBitConverter Converts base data types to an array of bytes, and an array of bytes to
base data types.
TClrCharHelper Helper class for Char Data Type and _Char interface Type.
582
.Net Runtime Library for Delphi
Name Description
7.1.1.8.1.1 Classes
Contain classes that allow for conversion between delphi and .net data types.
Classes
Name Description
TClrBitConverter Converts base data types to an array of bytes, and an array of bytes to
base data types.
TClrCharHelper Helper class for Char Data Type and _Char interface Type.
583
.Net Runtime Library for Delphi
Name Description
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
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.
IsNaN Returns a value that indicates whether the specified value is not a
number.
585
.Net Runtime Library for Delphi
Name Description
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.
See Also
TClrDoubleHelper Methods
Methods
Name Description
586
.Net Runtime Library for Delphi
Name Description
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.
IsNaN Returns a value that indicates whether the specified value is not a
number.
587
.Net Runtime Library for Delphi
Name Description
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.
Overload List
Name Description
588
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Represents the smallest positive Double value that is greater than zero.
Syntax
Delphi
589
.Net Runtime Library for Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
590
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Returns a value indicating whether the specified number evaluates to negative or positive infinity
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Returns a value that indicates whether the specified value is not a number.
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Returns a value indicating whether the specified number evaluates to negative infinity.
Syntax
Delphi
591
.Net Runtime Library for Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Returns a value indicating whether the specified number evaluates to positive infinity.
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
592
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
593
.Net Runtime Library for Delphi
Name Description
IFormatProvider) equivalent.
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
594
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
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.
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
596
.Net Runtime Library for Delphi
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
597
.Net Runtime Library for Delphi
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDoubleHelper Class
CNClrLib.Host.Helper Namespace
Inheritance Hierarchy
CNClrLib.Host.Helper.TClrInt64Helper
File: CNClrLib.Host.Helper.pas
Namespace: CNClrLib.Host.Helper
Syntax
Delphi
TClrInt64Helper = class;
Methods
Name Description
598
.Net Runtime Library for Delphi
Name Description
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.
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 string
IFormatProvider) representation using the specified culture-specific format information.
599
.Net Runtime Library for Delphi
Name Description
See Also
TClrInt64Helper Methods
Methods
Name Description
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.
600
.Net Runtime Library for Delphi
Name Description
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.
Overload List
Name Description
Syntax
Delphi
601
.Net Runtime Library for Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
602
.Net Runtime Library for Delphi
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
603
.Net Runtime Library for Delphi
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
IFormatProvider)
IFormatProvider)
Syntax
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
604
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
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.
Syntax
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
606
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
607
.Net Runtime Library for Delphi
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt64Helper Class
CNClrLib.Host.Helper Namespace
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
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.
609
.Net Runtime Library for Delphi
Name Description
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
Methods
Name Description
GetBytes(ClrInt16) Returns the specified 16-bit signed integer value as an array of bytes.
GetBytes(ClrInt64) Returns the specified 64-bit signed integer value as an array of bytes.
611
.Net Runtime Library for Delphi
Name Description
Converts the specified double-precision floating point number to a 64-bit signed integer.
Syntax
612
.Net Runtime Library for Delphi
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrBitConverter.GetBytes Returns the specified Unicode Clr character value as an array of bytes.
(ClrChar)
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)
613
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
614
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
615
.Net Runtime Library for Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
616
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Converts the specified 64-bit signed integer to a double-precision floating point number.
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Returns a Boolean value converted from the byte at a specified position in a byte array.
Syntax
Delphi
See Also
617
.Net Runtime Library for Delphi
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Returns a Unicode character converted from two bytes at a specified position in a byte array.
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Returns a Unicode Clr character converted from two bytes at a specified position in a byte array.
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Returns a double-precision floating point number converted from eight bytes at a specified position in a byte array.
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
618
.Net Runtime Library for Delphi
Returns a 16-bit signed integer converted from two bytes at a specified position in a byte array.
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Returns a 32-bit signed integer converted from four bytes at a specified position in a byte array.
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Returns a 64-bit signed integer converted from eight bytes at a specified position in a byte array.
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
ClrInt32)
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
620
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte array.
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a byte array.
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
Properties
Name Description
IsLittleEndian Indicates the byte order ("endianness") in which data is stored in this
computer architecture.
Syntax
Delphi
See Also
TClrBitConverter Class
CNClrLib.Host.Helper Namespace
622
.Net Runtime Library for Delphi
Inheritance Hierarchy
CNClrLib.Host.Helper.TClrBooleanHelper
File: CNClrLib.Host.Helper.pas
Namespace: CNClrLib.Host.Helper
Syntax
Delphi
TClrBooleanHelper = class;
Methods
Name Description
623
.Net Runtime Library for Delphi
Name Description
See Also
TClrBooleanHelper Methods
Methods
Name Description
624
.Net Runtime Library for Delphi
Name Description
Overload List
Name Description
Syntax
Delphi
See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
625
.Net Runtime Library for Delphi
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace
626
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace
Converts the specified string representation of a logical value to its Boolean equivalent.
Syntax
Delphi
See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
IFormatProvider)
Syntax
627
.Net Runtime Library for Delphi
Delphi
See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace
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
628
.Net Runtime Library for Delphi
See Also
TClrBooleanHelper Class
CNClrLib.Host.Helper Namespace
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.
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.
629
.Net Runtime Library for Delphi
Name Description
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.
See Also
TClrByteHelper Methods
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.
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.
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.
631
.Net Runtime Library for Delphi
Name Description
ClrByte) succeeded.
Overload List
Name Description
Syntax
Delphi
See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
632
.Net Runtime Library for Delphi
See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrByteHelper.Equals Returns a value indicating whether this instance and a specified Byte
(ClrByte, ClrByte) object represent the same value.
Syntax
Delphi
See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
633
.Net Runtime Library for Delphi
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
Overload List
634
.Net Runtime Library for Delphi
Name Description
IFormatProvider)
IFormatProvider)
Syntax
Delphi
See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
635
.Net Runtime Library for Delphi
Converts the string representation of a number in a specified style to its Byte equivalent.
Syntax
Delphi
See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
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.
Syntax
Delphi
See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
637
.Net Runtime Library for Delphi
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
638
.Net Runtime Library for Delphi
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrByteHelper Class
CNClrLib.Host.Helper Namespace
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
639
.Net Runtime Library for Delphi
Name Description
ConvertFromUtf32 Converts the specified Unicode code point into a UTF-16 encoded
string.
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.
640
.Net Runtime Library for Delphi
Name Description
641
.Net Runtime Library for Delphi
Name Description
IsSurrogate(ClrWChar) Indicates whether the specified character has a surrogate code unit.
IsSurrogatePair(ClrWChar, Indicates whether the two specified Char objects form a surrogate
ClrWChar) pair.
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.
ToChar(ClrChar) Converts the value of the specified Clr Character interface to its
equivalent Unicode character.
642
.Net Runtime Library for Delphi
Name Description
ToClrChar(ClrInt32) Converts the value of the specified integer to Clr character interface.
ToClrChar(ClrVariant) Converts the value of the specified variant to Clr character interface.
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
643
.Net Runtime Library for Delphi
Methods
Name Description
ConvertFromUtf32 Converts the specified Unicode code point into a UTF-16 encoded
string.
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.
644
.Net Runtime Library for Delphi
Name Description
645
.Net Runtime Library for Delphi
Name Description
IsSurrogate(ClrWChar) Indicates whether the specified character has a surrogate code unit.
IsSurrogatePair(ClrWChar, Indicates whether the two specified Char objects form a surrogate
ClrWChar) pair.
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.
ToChar(ClrChar) Converts the value of the specified Clr Character interface to its
equivalent 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.
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.
Overload List
Name Description
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
648
.Net Runtime Library for Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Converts the specified Unicode code point into a UTF-16 encoded string.
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
649
.Net Runtime Library for Delphi
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrCharHelper.Equals Returns a value that indicates whether this instance is equal to the
(ClrWChar, ClrWChar) specified Char.
650
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
651
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
652
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
653
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
654
.Net Runtime Library for Delphi
Name Description
(ClrWChar)
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
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.
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
656
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
657
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
658
.Net Runtime Library for Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrCharHelper.IsLowSurrogate Indicates whether the Char object at the specified position in a string
(ClrWString, ClrInt32) is a low surrogate.
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
659
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
660
.Net Runtime Library for Delphi
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
661
.Net Runtime Library for Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
662
.Net Runtime Library for Delphi
Overload List
Name Description
TClrCharHelper.IsSurrogate Indicates whether the specified character has a surrogate code unit.
(ClrWChar)
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
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.
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
664
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
665
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
666
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
667
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
668
.Net Runtime Library for Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Converts the value of the specified Clr Character interface to its equivalent Unicode character.
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
669
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
670
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Converts the value of the specified unicode character to its equivalent Clr character interface.
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
671
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Converts the value of a specified Unicode character to its lowercase equivalent using specified
culture-specific formatting information.
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Converts the value of this instance to its equivalent string representation using the specified
culture-specific format information.
Syntax
Delphi
673
.Net Runtime Library for Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Converts the value of a specified Unicode character to its uppercase equivalent using specified
culture-specific formatting information.
Syntax
Delphi
See Also
674
.Net Runtime Library for Delphi
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Converts the value of a Unicode character to its uppercase equivalent using the casing rules of
the invariant culture.
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
Converts the value of the specified string to its equivalent Unicode character. A return code
indicates whether the conversion succeeded or failed.
Syntax
Delphi
See Also
TClrCharHelper Class
CNClrLib.Host.Helper Namespace
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
676
.Net Runtime Library for Delphi
Name Description
677
.Net Runtime Library for Delphi
Name Description
678
.Net Runtime Library for Delphi
Name Description
679
.Net Runtime Library for Delphi
Name Description
680
.Net Runtime Library for Delphi
Name Description
681
.Net Runtime Library for Delphi
Name Description
682
.Net Runtime Library for Delphi
Name Description
683
.Net Runtime Library for Delphi
Name Description
formatting information.
684
.Net Runtime Library for Delphi
Name Description
685
.Net Runtime Library for Delphi
Name Description
686
.Net Runtime Library for Delphi
Name Description
representation.
687
.Net Runtime Library for Delphi
Name Description
688
.Net Runtime Library for Delphi
Name Description
689
.Net Runtime Library for Delphi
Name Description
See Also
TClrConvert Methods
Methods
Name Description
690
.Net Runtime Library for Delphi
Name Description
specified variant.
691
.Net Runtime Library for Delphi
Name Description
692
.Net Runtime Library for Delphi
Name Description
693
.Net Runtime Library for Delphi
Name Description
694
.Net Runtime Library for Delphi
Name Description
695
.Net Runtime Library for Delphi
Name Description
696
.Net Runtime Library for Delphi
Name Description
697
.Net Runtime Library for Delphi
Name Description
698
.Net Runtime Library for Delphi
Name Description
699
.Net Runtime Library for Delphi
Name Description
700
.Net Runtime Library for Delphi
Name Description
701
.Net Runtime Library for Delphi
Name Description
702
.Net Runtime Library for Delphi
Name Description
703
.Net Runtime Library for Delphi
Name Description
704
.Net Runtime Library for Delphi
Overload List
Name Description
Returns a variant of the specified type and whose value is equivalent to the specified variant.
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
705
.Net Runtime Library for Delphi
Name Description
TClrConvert.ChangeType Returns a variant of the specified type and whose value is equivalent
(ClrVariant, _Type) to the specified variant.
Returns a variant of the specified type whose value is equivalent to the specified variant.
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Create Clr wrapper of the specified variant with the specified type.
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
707
.Net Runtime Library for Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
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
See Also
709
.Net Runtime Library for Delphi
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-
bit unsigned integer array.
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
710
.Net Runtime Library for Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
711
.Net Runtime Library for Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrConvert.ToAnsiChar Converts the value of the specified variant to its equivalent ansi
(ClrVariant) character.
712
.Net Runtime Library for Delphi
Converts the value of the specified clr character to its equivalent ansi character.
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
713
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
714
.Net Runtime Library for Delphi
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
715
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
716
.Net Runtime Library for Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Converts an array of 8-bit unsigned integers to its equivalent string representation that is
encoded with base-64 digits.
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
IFormatProvider)
719
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
720
.Net Runtime Library for Delphi
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrConvert.ToByte (ClrChar) Converts the value of the specified Unicode character to the
equivalent 8-bit unsigned integer.
721
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
722
.Net Runtime Library for Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrConvert.ToChar Converts the value of the specified variant to its equivalent Unicode
(ClrVariant, character, using the specified culture-specific formatting information.
IFormatProvider)
IFormatProvider)
Syntax
723
.Net Runtime Library for Delphi
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
724
.Net Runtime Library for Delphi
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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.
IFormatProvider)
Syntax
725
.Net Runtime Library for Delphi
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
726
.Net Runtime Library for Delphi
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
727
.Net Runtime Library for Delphi
Name Description
IFormatProvider)
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Converts the value of the specified variant to a DateTime object, using the specified culture-specific formatting
information.
Syntax
Delphi
728
.Net Runtime Library for Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
IFormatProvider)
729
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
730
.Net Runtime Library for Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
731
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
732
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
733
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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)
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
735
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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)
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
737
.Net Runtime Library for Delphi
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
738
.Net Runtime Library for Delphi
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)
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
739
.Net Runtime Library for Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
740
.Net Runtime Library for Delphi
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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 Object to clr managed pointer.
(TObject)
Syntax
Delphi
See Also
741
.Net Runtime Library for Delphi
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
742
.Net Runtime Library for Delphi
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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)
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
743
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
744
.Net Runtime Library for Delphi
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
745
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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.
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 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 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.
IFormatProvider)
Syntax
Delphi
748
.Net Runtime Library for Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
749
.Net Runtime Library for Delphi
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Converts the value of the specified DateTime to its equivalent string representation, using the specified culture-specific
formatting information.
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
751
.Net Runtime Library for Delphi
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
752
.Net Runtime Library for Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
753
.Net Runtime Library for Delphi
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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.
IFormatProvider)
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
756
.Net Runtime Library for Delphi
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
757
.Net Runtime Library for Delphi
Overload List
Name Description
TClrConvert.ToUInt32 Converts the value of the specified clr Unicode character to the
(ClrChar) equivalent 32-bit unsigned integer.
IFormatProvider)
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
758
.Net Runtime Library for Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
759
.Net Runtime Library for Delphi
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrConvert.ToUInt64 Converts the value of the specified clr Unicode character to the
(ClrChar) equivalent 64-bit unsigned integer.
IFormatProvider)
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
760
.Net Runtime Library for Delphi
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
761
.Net Runtime Library for Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrConvert.ToVariant Convert the value of the specified clr base object to variant.
(TClrBaseObject)
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
762
.Net Runtime Library for Delphi
Overload List
Name Description
Convert the value of specified variant to the dispatch interface of the specified type.
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Convert the value of specified variant to the dispatch interface of the specified type using the type name.
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
763
.Net Runtime Library for Delphi
Overload List
Name Description
Wrap the value of the specified dispatch interface to the dispatch of the specified type.
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Wrap the value of the specified dispatch interface to the dispatch of the specified type using the type name.
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Unwrap the value of the specified variant to the original .net object as variant.
Syntax
Delphi
764
.Net Runtime Library for Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
Unwrap the value of the specified variant to the original .net object as interface.
Syntax
Delphi
See Also
TClrConvert Class
CNClrLib.Host.Helper Namespace
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.
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.
Equals(ClrDateTime, ClrDateTime) Returns a value indicating whether two DateTime instances have
the same date and time value.
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.
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.
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.
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.
768
.Net Runtime Library for Delphi
Name Description
GetTicks Gets the number of ticks that represent the date and time of this
instance.
GetYear Gets the year component of the date represented by this instance.
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.
769
.Net Runtime Library for Delphi
Name Description
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)
ToBinary Serializes the current DateTime object to a 64-bit binary value that
subsequently can be used to recreate the DateTime object.
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.
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
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.
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.
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
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.
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.
Equals(ClrDateTime, ClrDateTime) Returns a value indicating whether two DateTime instances have
the same date and time value.
772
.Net Runtime Library for Delphi
Name Description
specified variant.
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.
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.
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.
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.
GetTicks Gets the number of ticks that represent the date and time of this
instance.
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
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.
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)
ToBinary Serializes the current DateTime object to a 64-bit binary value that
subsequently can be used to recreate the DateTime object.
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
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.
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.
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.
UtcNow Gets a DateTime object that is set to the current date and time on
this computer, expressed as the Coordinated Universal Time (UTC).
Returns a new DateTime that adds the value of the specified _TimeSpan to the value of this instance.
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
778
.Net Runtime Library for Delphi
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
779
.Net Runtime Library for Delphi
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
780
.Net Runtime Library for Delphi
Overload List
Name Description
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
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.
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
782
.Net Runtime Library for Delphi
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
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.
TClrDateTimeHelper.GetDateTime Returns a DateTime using the specified year, month, day, hour,
(ClrInt32, ClrInt32, ClrInt32, minute, second, and millisecond.
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.
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.
TClrDateTimeHelper.GetDateTime Returns a DateTime using the specified year, month, and day for
(ClrInt32, ClrInt32, ClrInt32, the specified calendar.
_Calendar)
784
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
785
.Net Runtime Library for Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
787
.Net Runtime Library for Delphi
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
788
.Net Runtime Library for Delphi
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
789
.Net Runtime Library for Delphi
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
790
.Net Runtime Library for Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
791
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
792
.Net Runtime Library for Delphi
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
793
.Net Runtime Library for Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
794
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
795
.Net Runtime Library for Delphi
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
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)
Syntax
Delphi
See Also
796
.Net Runtime Library for Delphi
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
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
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.
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
798
.Net Runtime Library for Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
799
.Net Runtime Library for Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrDateTimeHelper.Subtract Subtracts the specified date and time from this instance.
(ClrDateTime, ClrDateTime)
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
800
.Net Runtime Library for Delphi
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
801
.Net Runtime Library for Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
802
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
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)
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
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)
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
806
.Net Runtime Library for Delphi
Overload List
Name Description
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
807
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDateTimeHelper Class
CNClrLib.Host.Helper Namespace
808
.Net Runtime Library for Delphi
Inheritance Hierarchy
CNClrLib.Host.Helper.TClrDecimalHelper
File: CNClrLib.Host.Helper.pas
Namespace: CNClrLib.Host.Helper
Syntax
Delphi
TClrDecimalHelper = record
end;
Methods
Name Description
Ceiling Returns the smallest integral value that is greater than or equal to
the specified decimal number.
Equals(ClrDecimal, ClrVariant) Returns a value indicating whether this instance and a specified
Decimal object represent the same value.
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.
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.
810
.Net Runtime Library for Delphi
Name Description
IFormatProvider)
ToByte Converts the value of the specified Decimal to the equivalent 8-bit
unsigned integer.
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.
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.
812
.Net Runtime Library for Delphi
Name Description
See Also
TClrDecimalHelper Methods
Methods
Name Description
Ceiling Returns the smallest integral value that is greater than or equal to
the specified decimal number.
Equals(ClrDecimal, ClrVariant) Returns a value indicating whether this instance and a specified
Decimal object represent the same value.
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
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.
814
.Net Runtime Library for Delphi
Name Description
IFormatProvider)
ToByte Converts the value of the specified Decimal to the equivalent 8-bit
unsigned integer.
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.
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.
816
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Returns the smallest integral value that is greater than or equal to the specified decimal number.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
817
.Net Runtime Library for Delphi
Overload List
Name Description
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
818
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
819
.Net Runtime Library for Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Rounds a specified Decimal number to the closest integer toward negative infinity.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Converts the specified 64-bit signed integer, which contains an OLE Automation Currency value, to the equivalent
Decimal value.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Converts the value of a specified instance of Decimal to its equivalent binary representation.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
820
.Net Runtime Library for Delphi
Converts the value of a specified instance of Decimal to its equivalent binary representation.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrDecimalHelper.GetDecimal Returns new instance of Decimal to the value of the specified 32-bit
(ClrInt32) signed integer.
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
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
822
.Net Runtime Library for Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
823
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
824
.Net Runtime Library for Delphi
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
825
.Net Runtime Library for Delphi
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Returns the result of multiplying the specified Decimal value by negative one.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
826
.Net Runtime Library for Delphi
Overload List
Name Description
IFormatProvider)
IFormatProvider)
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
827
.Net Runtime Library for Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
828
.Net Runtime Library for Delphi
Overload List
Name Description
TMidpointRounding)
TMidpointRounding)
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
829
.Net Runtime Library for Delphi
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
830
.Net Runtime Library for Delphi
Converts the value of the specified Decimal to the equivalent 8-bit unsigned integer.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Converts the value of the specified Decimal to the equivalent double-precision floating-point number.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Converts the value of the specified Decimal to the equivalent 16-bit signed integer.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Converts the value of the specified Decimal to the equivalent 32-bit signed integer.
Syntax
Delphi
831
.Net Runtime Library for Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Converts the value of the specified Decimal to the equivalent 64-bit signed integer.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Converts the specified Decimal value to the equivalent OLE Automation Currency value, which is contained in a 64-bit
signed integer.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Converts the value of the specified Decimal to the equivalent 8-bit signed integer.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
832
.Net Runtime Library for Delphi
Converts the value of the specified Decimal to the equivalent single-precision floating-point number.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
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)
Syntax
Delphi
See Also
833
.Net Runtime Library for Delphi
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
834
.Net Runtime Library for Delphi
Converts the value of the specified Decimal to the equivalent 16-bit unsigned integer.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Converts the value of the specified Decimal to the equivalent 32-bit unsigned integer.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Converts the value of the specified Decimal to the equivalent 64-bit unsigned integer.
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Returns the integral digits of the specified Decimal; any fractional digits are discarded.
Syntax
Delphi
835
.Net Runtime Library for Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
836
.Net Runtime Library for Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrDecimalHelper Record
CNClrLib.Host.Helper Namespace
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, TGuid) Compares this instance to a specified T Guid object and returns an
indication of their relative values.
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.
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
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(TGuid) Returns a 16-element dynamic byte array that contains the value of
the TGuid instance.
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.
See Also
TClrGuidHelper Methods
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, TGuid) Compares this instance to a specified TGuid object and returns an
indication of their relative values.
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.
840
.Net Runtime Library for Delphi
Name Description
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.
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.
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
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.
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
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
843
.Net Runtime Library for Delphi
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
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 indicating whether this instance and a specified TGuid
(TGuid, TGuid) object represent the same value.
Syntax
Delphi
See Also
844
.Net Runtime Library for Delphi
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrGuidHelper.GetGuid Returns a new instance of the Guid by using the specified integers and
(ClrInt32, ClrInt16, ClrInt16, bytes.
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.
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.
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
846
.Net Runtime Library for Delphi
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
847
.Net Runtime Library for Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrGuidHelper.GetHashCode Returns the hash code for the Clr Guid instance.
(ClrGuid)
848
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
849
.Net Runtime Library for Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Converts the string representation of a GUID to the equivalent Guid structure, provided that the string is in the specified
format.
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
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.
Syntax
Delphi
See Also
850
.Net Runtime Library for Delphi
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
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.
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
851
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
852
.Net Runtime Library for Delphi
Name Description
(ClrGuid)
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Returns a string representation of the value of this Guid instance, according to the provided format specifier.
Syntax
Delphi
853
.Net Runtime Library for Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
854
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
Converts the string representation of a GUID to the equivalent Guid structure, provided that the string is in the specified
format.
Syntax
Delphi
See Also
TClrGuidHelper Class
CNClrLib.Host.Helper Namespace
855
.Net Runtime Library for Delphi
Inheritance Hierarchy
CNClrLib.Host.Helper.TClrInt16Helper
File: CNClrLib.Host.Helper.pas
Namespace: CNClrLib.Host.Helper
Syntax
Delphi
TClrInt16Helper = class;
Methods
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.
856
.Net Runtime Library for Delphi
Name Description
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.
See Also
TClrInt16Helper Methods
Methods
Name Description
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.
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.
858
.Net Runtime Library for Delphi
Name Description
Overload List
Name Description
Syntax
Delphi
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
859
.Net Runtime Library for Delphi
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
860
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
Overload List
861
.Net Runtime Library for Delphi
Name Description
IFormatProvider)
IFormatProvider)
Syntax
Delphi
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
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.
Syntax
Delphi
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
864
.Net Runtime Library for Delphi
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
865
.Net Runtime Library for Delphi
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt16Helper Class
CNClrLib.Host.Helper Namespace
Inheritance Hierarchy
CNClrLib.Host.Helper.TClrInt32Helper
File: CNClrLib.Host.Helper.pas
Namespace: CNClrLib.Host.Helper
Syntax
Delphi
TClrInt32Helper = class;
Methods
Name Description
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.
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.
867
.Net Runtime Library for Delphi
Name Description
See Also
TClrInt32Helper Methods
Methods
Name Description
Equals(ClrInt32, ClrInt32) Returns a value indicating whether this instance is equal to a specified
Int32 value.
868
.Net Runtime Library for Delphi
Name Description
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.
Overload List
Name Description
Syntax
869
.Net Runtime Library for Delphi
Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
870
.Net Runtime Library for Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
871
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
IFormatProvider)
IFormatProvider)
Syntax
Delphi
See Also
872
.Net Runtime Library for Delphi
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
873
.Net Runtime Library for Delphi
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.
Syntax
Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
874
.Net Runtime Library for Delphi
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
875
.Net Runtime Library for Delphi
Name Description
IFormatProvider, ClrInt32)
Syntax
Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrInt32Helper Class
CNClrLib.Host.Helper Namespace
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
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.
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.
See Also
TClrIntPtrHelper Methods
877
.Net Runtime Library for Delphi
Methods
Name Description
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.
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.
Syntax
878
.Net Runtime Library for Delphi
Delphi
See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace
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)
Syntax
Delphi
See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
880
.Net Runtime Library for Delphi
See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace
881
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace
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.
Syntax
Delphi
882
.Net Runtime Library for Delphi
See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrIntPtrHelper Class
CNClrLib.Host.Helper Namespace
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.
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.
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.
See Also
TClrSByteHelper Methods
Methods
Name Description
CompareTo(ClrSByte, Compares this instance to a specified 8-bit signed integer and returns
ClrSByte) an indication of their relative values.
Equals(ClrSByte, ClrSByte) Returns a value indicating whether this instance is equal to a specified
SByte value.
885
.Net Runtime Library for Delphi
Name Description
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.
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.
886
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
887
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
888
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
IFormatProvider)
889
.Net Runtime Library for Delphi
Name Description
IFormatProvider)
Syntax
Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
890
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
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.
Converts the numeric value of this instance to its equivalent string representation.
Syntax
Delphi
891
.Net Runtime Library for Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
892
.Net Runtime Library for Delphi
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
893
.Net Runtime Library for Delphi
See Also
TClrSByteHelper Class
CNClrLib.Host.Helper Namespace
Inheritance Hierarchy
CNClrLib.Host.Helper.TClrSingleHelper
File: CNClrLib.Host.Helper.pas
Namespace: CNClrLib.Host.Helper
Syntax
Delphi
TClrSingleHelper = class;
Methods
Name Description
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.
894
.Net Runtime Library for Delphi
Name Description
IsNaN Returns a value that indicates whether the specified value is not a
number (NaN ).
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.
See Also
TClrSingleHelper Methods
Methods
Name Description
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.
896
.Net Runtime Library for Delphi
Name Description
IsNaN Returns a value that indicates whether the specified value is not a
number ( NaN ).
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.
Overload List
Name Description
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
See Also
898
.Net Runtime Library for Delphi
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Represents the smallest positive Single value that is greater than zero. This field is constant.
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrSingleHelper.Equals Returns a value indicating whether this instance and a specified Single
(ClrSingle, ClrSingle) object represent the same value.
899
.Net Runtime Library for Delphi
Returns a value indicating whether this instance and a specified Single object represent the same value.
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Returns a value indicating whether the specified number evaluates to negative or positive infinity.
Syntax
Delphi
900
.Net Runtime Library for Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Returns a value that indicates whether the specified value is not a number ( NaN ).
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Returns a value indicating whether the specified number evaluates to negative infinity.
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Returns a value indicating whether the specified number evaluates to positive infinity.
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
901
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
902
.Net Runtime Library for Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
903
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
904
.Net Runtime Library for Delphi
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
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.
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
905
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Overload List
906
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrSingleHelper Class
CNClrLib.Host.Helper Namespace
907
.Net Runtime Library for Delphi
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.
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 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)
909
.Net Runtime Library for Delphi
Name Description
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, ClrVariant, Concatenates the string representations of four specified objects and
ClrVariant, ClrVariant) any objects specified in an optional variable length parameter list.
Copy Creates a new instance of String with the same value as a specified
String.
910
.Net Runtime Library for Delphi
Name Description
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.
GetEnumerator Retrieves an object that can iterate through the individual characters
in this string.
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
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.
913
.Net Runtime Library for Delphi
Name Description
Join(ClrWString, Concatenates all the elements of a dynamic string array, using the
TClrWStringDynArray) 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 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.
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.
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.
Split(ClrWString, Splits a string into substrings that are based on the characters in an
TClrWCharDynArray) array.
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.
_CultureInfo)
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.
918
.Net Runtime Library for Delphi
Name Description
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.
Trim(ClrWString) Removes all leading and trailing white-space characters 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.
919
.Net Runtime Library for Delphi
See Also
TClrStringHelper Methods
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.
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.
920
.Net Runtime Library for Delphi
Name Description
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)
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
Concat(ClrVariant, ClrVariant, Concatenates the string representations of four specified objects and
ClrVariant, ClrVariant) any objects specified in an optional variable length parameter list.
Copy Creates a new instance of String with the same value as a specified
String.
ClrInt32)
922
.Net Runtime Library for Delphi
Name Description
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.
GetEnumerator Retrieves an object that can iterate through the individual characters
in this string.
GetString(ClrWChar, ClrInt32) Returns a String to the value indicated by a specified wide character
repeated a specified number of times.
923
.Net Runtime Library for Delphi
Name Description
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.
925
.Net Runtime Library for Delphi
Name Description
Join(ClrWString, Concatenates all the elements of a dynamic string array, using the
TClrWStringDynArray) 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 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 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
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
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.
Split(ClrWString, Splits a string into substrings that are based on the characters in an
TClrWCharDynArray) array.
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.
_CultureInfo)
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.
930
.Net Runtime Library for Delphi
Name Description
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.
Trim(ClrWString) Removes all leading and trailing white-space characters 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.
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)
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
932
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
933
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
934
.Net Runtime Library for Delphi
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
ClrWString, ClrInt32,
ClrInt32)
ClrInt32, ClrBoolean)
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 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)
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
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
936
.Net Runtime Library for Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
937
.Net Runtime Library for Delphi
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
938
.Net Runtime Library for Delphi
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
939
.Net Runtime Library for Delphi
Name Description
Compares substrings of two specified Strings by evaluating the numeric values of the corresponding Char objects in
each substring.
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Compares two specified Strings by evaluating the numeric values of the corresponding Char objects in each string.
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
940
.Net Runtime Library for Delphi
Name Description
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.
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
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
941
.Net Runtime Library for Delphi
Name Description
ClrVariant, ClrVariant)
Syntax
Delphi
942
.Net Runtime Library for Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
943
.Net Runtime Library for Delphi
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
944
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
945
.Net Runtime Library for Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Returns a value indicating whether a specified substring occurs within this string.
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Creates a new instance of String with the same value as a specified String.
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrWCharDynArray,
ClrInt32, ClrInt32)
946
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
947
.Net Runtime Library for Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
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)
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
948
.Net Runtime Library for Delphi
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
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)
949
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
950
.Net Runtime Library for Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Retrieves an object that can iterate through the individual characters in this string.
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
951
.Net Runtime Library for Delphi
Overload List
Name Description
ClrInt32, ClrInt32)
ClrInt32)
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
952
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
953
.Net Runtime Library for Delphi
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
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
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
956
.Net Runtime Library for Delphi
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
957
.Net Runtime Library for Delphi
Reports the zero-based index of the first occurrence of the specified string in this instance.
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
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
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
959
.Net Runtime Library for Delphi
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.
Syntax
Delphi
See Also
960
.Net Runtime Library for Delphi
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
961
.Net Runtime Library for Delphi
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Returns a new string in which a specified string is inserted at a specified index position in this instance.
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
962
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TNormalizationForm)
Syntax
963
.Net Runtime Library for Delphi
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Indicates whether a specified string is nil, empty, or consists only of white-space characters.
Syntax
Delphi
See Also
964
.Net Runtime Library for Delphi
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrVariantDynArray)
TClrStringHelper.Join Concatenates all the elements of a dynamic string array, using the
(ClrWString, specified separator between each element.
TClrWStringDynArray)
TClrWStringDynArray,
ClrInt32, ClrInt32)
TClrStringHelper.Join Concatenates all the elements of a string array, using the specified
(ClrWString, _StringArray) separator between each element.
ClrInt32, ClrInt32)
Syntax
Delphi
See Also
965
.Net Runtime Library for Delphi
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
966
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
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 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.
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
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
969
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
970
.Net Runtime Library for Delphi
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
971
.Net Runtime Library for Delphi
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
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.
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
973
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
974
.Net Runtime Library for Delphi
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
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)
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
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)
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
977
.Net Runtime Library for Delphi
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
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)
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
978
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
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.
ClrInt32)
979
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
980
.Net Runtime Library for Delphi
Name Description
(ClrWString, ClrWChar, character in this instance are replaced with another specified Unicode
ClrWChar) character.
ClrWString)
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
981
.Net Runtime Library for Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
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)
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 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.
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 substrings based on the strings in an array. You can
(ClrWString, _StringArray, specify whether the substrings include empty array elements.
TStringSplitOptions)
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
984
.Net Runtime Library for Delphi
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
985
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
986
.Net Runtime Library for Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
987
.Net Runtime Library for Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
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)
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
988
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
ClrInt32)
989
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
ClrInt32)
Syntax
990
.Net Runtime Library for Delphi
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
991
.Net Runtime Library for Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrStringHelper.ToLower Returns a copy of this string to lowercase, using the casing rules of the
(ClrWString, _CultureInfo) specified culture.
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
992
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Returns a copy of this String converted to lowercase using the casing rules of the invariant culture.
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
993
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrStringHelper.ToUpper Returns a copy of this string converted to uppercase, using the casing
(ClrWString, _CultureInfo) rules of the specified culture.
Syntax
Delphi
994
.Net Runtime Library for Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrStringHelper.Trim Removes all leading and trailing white-space characters from the
(ClrWString) current String.
TClrWCharDynArray)
Syntax
Delphi
995
.Net Runtime Library for Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrWCharDynArray)
996
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
TClrWCharDynArray)
997
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrStringHelper Class
CNClrLib.Host.Helper Namespace
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
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.
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.
See Also
TClrUInt16Helper Methods
Methods
Name Description
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.
1000
.Net Runtime Library for Delphi
Name Description
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.
Overload List
1001
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
1002
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
1003
.Net Runtime Library for Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
IFormatProvider)
1004
.Net Runtime Library for Delphi
Name Description
IFormatProvider)
Syntax
Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
1005
.Net Runtime Library for Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
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.
Syntax
1006
.Net Runtime Library for Delphi
Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
1007
.Net Runtime Library for Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
1008
.Net Runtime Library for Delphi
See Also
TClrUInt16Helper Class
CNClrLib.Host.Helper Namespace
Inheritance Hierarchy
CNClrLib.Host.Helper.TClrUInt32Helper
File: CNClrLib.Host.Helper.pas
Namespace: CNClrLib.Host.Helper
Syntax
Delphi
TClrUInt32Helper = class;
Methods
Name Description
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.
1009
.Net Runtime Library for Delphi
Name Description
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.
See Also
TClrUInt32Helper Methods
Methods
1010
.Net Runtime Library for Delphi
Name Description
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.
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
Overload List
Name Description
Syntax
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
1012
.Net Runtime Library for Delphi
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
1013
.Net Runtime Library for Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
1014
.Net Runtime Library for Delphi
Overload List
Name Description
IFormatProvider)
IFormatProvider)
Syntax
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
1015
.Net Runtime Library for Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
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
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.
Syntax
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
1017
.Net Runtime Library for Delphi
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
Syntax
1018
.Net Runtime Library for Delphi
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt32Helper Class
CNClrLib.Host.Helper Namespace
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
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.
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
See Also
TClrUInt64Helper Methods
Methods
Name Description
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.
1021
.Net Runtime Library for Delphi
Name Description
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.
Overload List
Name Description
1022
.Net Runtime Library for Delphi
Compares this instance to a specified 64-bit unsigned integer and returns an indication of their relative values.
Syntax
Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
1023
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
1024
.Net Runtime Library for Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Overload List
Name Description
IFormatProvider)
Syntax
1025
.Net Runtime Library for Delphi
Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Converts the string representation of a number in a specified culture-specific format to its 64-bit unsigned
integer equivalent.
Syntax
Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
1026
.Net Runtime Library for Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
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.
Syntax
Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
1027
.Net Runtime Library for Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Name Description
1028
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrUInt64Helper Class
CNClrLib.Host.Helper Namespace
Syntax
Delphi
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
EClrError The base exception class for errors generated during application
execution.
TClrArrayHelper Helper class for the TClrArray class. 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.
TClrWSDL Contains methods to build and convert XML Web Services into a
.net assembly. This class cannot be inherited.
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
Syntax
Delphi
See Also
EClrArgumentNullException Class
CNClrLib.Host Namespace
Inheritance Hierarchy
CNClrLib.Host.EClrError
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
EClrError = class(Exception);
1031
.Net Runtime Library for Delphi
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.
1032
.Net Runtime Library for Delphi
Name Description
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.
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.
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.
Destructors
Name Description
Methods
Name Description
1033
.Net Runtime Library for Delphi
Name Description
GetClrBaseException Returns the Exception that is the root cause of one or more
subsequent exceptions.
Properties
Name Description
HelpLink Gets or sets a link to the help file associated with this exception.
InnerException Gets the Exception instance that caused 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
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.
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
1035
.Net Runtime Library for Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
1036
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
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.
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
1037
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
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.
Syntax
Delphi
See Also
1038
.Net Runtime Library for Delphi
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
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.
Syntax
Delphi
1039
.Net Runtime Library for Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
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.
Syntax
1040
.Net Runtime Library for Delphi
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
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.
GetClrBaseException Returns the Exception that is the root cause of one or more
subsequent exceptions.
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
1042
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
1043
.Net Runtime Library for Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
This method creates a .net exception object that is passed to the delphi exception handler.
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Returns the last occurring exception from the common language runtime.
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Returns the last occurring clr exception interface from the common language runtime.
Syntax
Delphi
See Also
1044
.Net Runtime Library for Delphi
EClrException Class
CNClrLib.Host Namespace
Properties
Name Description
HRESULT Gets or sets a link to the help file associated with this exception.
InnerException Gets the Exception instance that caused the current exception.
Source Gets or sets the name of the application or the object that causes the
error.
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
1045
.Net Runtime Library for Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
1046
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
EClrException Class
CNClrLib.Host Namespace
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
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.
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.
TAssemblyHashAlgorithm)
TAssemblyHashAlgorithm)
CreateInstance(ClrWString) Creates an instance of the specified type name using that type's
default constructor.
1048
.Net Runtime Library for Delphi
Name Description
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.
TBindingFlags_Set, _Binder)
_Binder)
CreateInstanceFrom(TFileName, Creates an instance of the type whose name is specified, using the
ClrWString, TClrAppDomain) named assembly file and default constructor.
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
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(_Type) Creates an instance of the specified type using that type's default
constructor and returns the object as ClrObject Interface.
TAssemblyHashAlgorithm)
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(_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.
_Binder)
CreateInstanceFrom(TFileName, Creates an instance of the type whose name is specified, using the
ClrWString, TClrAppDomain) named assembly file and default constructor.
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.
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 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
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
See Also
TClrActivator Class
CNClrLib.Host Namespace
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
See Also
TClrActivator Class
CNClrLib.Host Namespace
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
See Also
TClrActivator Class
CNClrLib.Host Namespace
1053
.Net Runtime Library for Delphi
Creates an instance of the specified type using that type's default constructor and returns the object as ClrObject
Interface.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
Creates an instance of the specified type using that type's default constructor and returns the object as ClrObject
Interface.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
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
See Also
TClrActivator Class
CNClrLib.Host Namespace
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
See Also
TClrActivator Class
CNClrLib.Host Namespace
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
See Also
TClrActivator Class
CNClrLib.Host Namespace
Overload List
Name Description
TClrByteDynArray,
TAssemblyHashAlgorithm)
_ByteArray,
1055
.Net Runtime Library for Delphi
Name Description
TAssemblyHashAlgorithm)
Creates an instance of the COM object whose name is specified, using the named assembly file and the default
constructor.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
Creates an instance of the COM object whose name is specified, using the named assembly file and the default
constructor.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
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
See Also
TClrActivator Class
CNClrLib.Host Namespace
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 specified type using the constructor that
(ClrWString, best matches the specified parameters.
TClrVariantDynArray)
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
TClrActivator.CreateInstance Creates an instance of the specified type using the constructor that
(_Type, _ObjectArray, best matches the specified parameters.
TBindingFlags_Set, _Binder)
Creates an instance of the specified type name using that type's default constructor.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
Creates an instance of the type whose name is specified in the specified remote domain, using the named assembly and
default constructor.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
1058
.Net Runtime Library for Delphi
Creates an instance of the specified type using the constructor that best matches the specified parameters.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
Creates an instance of the specified type using the constructor that best matches the specified parameters.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
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
See Also
TClrActivator Class
CNClrLib.Host Namespace
Creates an instance of the type that is designated by the specified ActivationContext object and activated with the
specified custom activation data.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
Creates an instance of the specified type using that type's default constructor.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
Creates an instance of the specified type using that type's default constructor.
Syntax
Delphi
1060
.Net Runtime Library for Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
Creates an instance of the specified type using the constructor that best matches the specified parameters.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
Creates an instance of the specified type using the constructor that best matches the specified parameters.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
Overload List
Name Description
1061
.Net Runtime Library for Delphi
Name Description
TClrActivator.CreateInstanceFrom Creates an instance of the type whose name is specified, using the
(TFileName, ClrWString, named assembly file and default constructor.
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
See Also
TClrActivator Class
CNClrLib.Host Namespace
Creates an instance of the type whose name is specified, using the named assembly file and default constructor.
Syntax
Delphi
See Also
1062
.Net Runtime Library for Delphi
TClrActivator Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
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)
Creates a proxy for the well-known object indicated by the specified type and URL.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
1063
.Net Runtime Library for Delphi
Creates a proxy for the well-known object indicated by the specified type, URL, and channel data.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
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
Constructors
Name Description
Destructors
Name Description
1064
.Net Runtime Library for Delphi
Name Description
Methods
Name Description
1065
.Net Runtime Library for Delphi
Name Description
1066
.Net Runtime Library for Delphi
Name Description
GetAssemblies Gets the assemblies that have been loaded into the
execution context of this application domain.
1067
.Net Runtime Library for Delphi
Name Description
1068
.Net Runtime Library for Delphi
Name Description
Properties
Name Description
BaseDirectory Gets the base directory that the assembly resolver uses to probe for
assemblies.
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
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
Overload List
Name Description
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
1070
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Methods
Name Description
1071
.Net Runtime Library for Delphi
Name Description
1072
.Net Runtime Library for Delphi
Name Description
1073
.Net Runtime Library for Delphi
Name Description
GetAssemblies Gets the assemblies that have been loaded into the
execution context of this application domain.
1074
.Net Runtime Library for Delphi
Name Description
1075
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1076
.Net Runtime Library for Delphi
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
1077
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
1078
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Overload List
Name Description
1079
.Net Runtime Library for Delphi
Name Description
(ClrWString, ClrWString) containing the type and the name of the type.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
1080
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Overload List
Name Description
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)
_AppDomainSetup)
1081
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Creates a new application domain with the given name using the supplied evidence.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
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
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
1082
.Net Runtime Library for Delphi
Creates a new application domain using the specified name, evidence, and application domain setup information.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
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
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
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)
Creates a new instance of the specified type defined in the specified assembly.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Creates a new instance of the specified type defined in the specified assembly. A parameter specifies an array of
activation attributes.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Overload List
Name Description
1084
.Net Runtime Library for Delphi
Name Description
_ObjectArray)
Creates a new instance of the specified type defined in the specified assembly file.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Creates a new instance of the specified type defined in the specified assembly file.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Overload List
1085
.Net Runtime Library for Delphi
Name Description
TAssemblyBuilderAccess)
TAssemblyBuilderAccess, ClrWString)
Defines a dynamic assembly with the specified name and access mode.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Defines a dynamic assembly using the specified name, access mode, and storage directory.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
1086
.Net Runtime Library for Delphi
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Overload List
Name Description
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.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Executes the assembly contained in the specified file, using the specified arguments.
1087
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Executes the assembly contained in the specified file, using the specified arguments.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Overload List
Name Description
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
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Executes the assembly given its display name, using the specified arguments.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Executes the assembly given its display name, using the specified arguments.
Syntax
Delphi
1089
.Net Runtime Library for Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Executes the assembly given its display name, using the specified arguments.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1090
.Net Runtime Library for Delphi
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
1091
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Gets the value as ClrObject interface stored in the current application domain for the specified name.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
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
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Overload List
Name Description
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 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.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Loads the Assembly with a common object file format (COFF) based image containing an emitted Assembly.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
1094
.Net Runtime Library for Delphi
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
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Loads the Assembly with a common object file format (COFF) based image containing an emitted Assembly.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
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
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1096
.Net Runtime Library for Delphi
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
procedure RemoveFirstChanceException(AFunctionPointer:
System.Pointer);
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
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
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
1098
.Net Runtime Library for Delphi
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Overload List
Name Description
Syntax
Delphi
See Also
1099
.Net Runtime Library for Delphi
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
1100
.Net Runtime Library for Delphi
Properties
Name Description
BaseDirectory Gets the base directory that the assembly resolver uses to probe for
assemblies.
DomainManager Gets the domain manager that was provided by the host when the
application domain was initialized.
IsFullyTrusted Gets a value that indicates whether assemblies that are loaded into
the current application domain execute with full trust.
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1101
.Net Runtime Library for Delphi
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
1102
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAppDomain Class
CNClrLib.Host Namespace
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(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(_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.
Destructors
Name Description
Methods
1104
.Net Runtime Library for Delphi
Show: Private
Name Description
IComparer)
IComparer)
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 value using the
IComparer) specified IComparer interface.
1105
.Net Runtime Library for Delphi
Name Description
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.
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
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.
1107
.Net Runtime Library for Delphi
Name Description
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(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.
1109
.Net Runtime Library for Delphi
Name Description
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(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 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.
Properties
Name Description
IsFixedSize Gets a value indicating whether the Array has a fixed size.
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
Overload List
Name Description
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(_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.
1112
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1113
.Net Runtime Library for Delphi
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
1114
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
1115
.Net Runtime Library for Delphi
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
1116
.Net Runtime Library for Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Methods
Show: Private
Name Description
IComparer)
IComparer)
BinarySearch(ClrVariant, Searches an entire one-dimensional sorted array for a value using the
1117
.Net Runtime Library for Delphi
Name Description
BinarySearch(_ClrObject, Searches an entire one-dimensional sorted array for a value using the
IComparer) specified IComparer interface.
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
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, 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(_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.
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(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(_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(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 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.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
1123
.Net Runtime Library for Delphi
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Overload List
Name Description
1124
.Net Runtime Library for Delphi
Name Description
ClrVariant, IComparer)
_ClrObject, IComparer)
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 value using the
(_ClrObject, IComparer) specified IComparer interface.
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
Searches a range of elements in a one-dimensional sorted array for a value, using the specified IComparer interface.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
Searches an entire one-dimensional sorted array for a value using the specified IComparer interface.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
Searches an entire one-dimensional sorted array for a value using the specified IComparer interface.
Syntax
Delphi
See Also
1127
.Net Runtime Library for Delphi
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
1128
.Net Runtime Library for Delphi
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.
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
1129
.Net Runtime Library for Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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.
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
See Also
1130
.Net Runtime Library for Delphi
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
1131
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
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.
Gets the value at the specified position in the one-dimensional Array. The index is specified as a 32-bit integer.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
1133
.Net Runtime Library for Delphi
Gets the value at the specified position in the two-dimensional Array. The indexes are specified as 32-bit integers.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Gets the value at the specified position in the three-dimensional Array. The indexes are specified as 32-bit integers.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Gets the value at the specified position in the one-dimensional Array. The index is specified as a 64-bit integer.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
Gets the value at the specified position in the three-dimensional Array. The indexes are specified as 64-bit integers.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
1135
.Net Runtime Library for Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Gets the value at the specified position in the multidimensional Array. The indexes are specified as an array of 32-bit
integers.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Gets the value at the specified position in the multidimensional Array. The indexes are specified as an array of 64-bit
integers.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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.
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
See Also
TClrArray Class
CNClrLib.Host Namespace
1137
.Net Runtime Library for Delphi
Gets the value as ClrObject at the specified position in the two-dimensional Array. The indexes are specified as 32-bit
integers.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Gets the value as ClrObject at the specified position in the three-dimensional Array. The indexes are specified as 32-
bit integers.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
1138
.Net Runtime Library for Delphi
Gets the value as ClrObject at the specified position in the two-dimensional Array. The indexes are specified as 64-bit
integers.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Gets the value as ClrObject at the specified position in the three-dimensional Array. The indexes are specified as 64-
bit integers.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
1139
.Net Runtime Library for Delphi
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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 object and returns the index of its first
(_ClrObject) occurrence in a one-dimensional array.
Searches for the specified variant and returns the index of its first occurrence in a one-dimensional array.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
Searches for the specified object and returns the index of its first occurrence in a one-dimensional array.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
1142
.Net Runtime Library for Delphi
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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.
Searches for the specified variant and returns the index of the last occurrence within the entire one-dimensional Array.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
1144
.Net Runtime Library for Delphi
TClrArray Class
CNClrLib.Host Namespace
Searches for the specified object and returns the index of the last occurrence within the entire one-dimensional Array.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
1145
.Net Runtime Library for Delphi
Overload List
Name Description
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Reverses the sequence of the elements in a range of elements in the one-dimensional Array.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
1146
.Net Runtime Library for Delphi
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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 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
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
1151
.Net Runtime Library for Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
1152
.Net Runtime Library for Delphi
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
1153
.Net Runtime Library for Delphi
Overload List
Name Description
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.
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.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
1154
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Sorts the elements in a range of elements in a one-dimensional Array using the specified IComparer.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
Sorts the elements in a range of elements in a one-dimensional Array using the specified IComparer.
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
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
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1156
.Net Runtime Library for Delphi
TClrArray Class
CNClrLib.Host Namespace
Properties
Name Description
Syntax
Delphi
See Also
1157
.Net Runtime Library for Delphi
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
1158
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
1159
.Net Runtime Library for Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArray Class
CNClrLib.Host Namespace
1160
.Net Runtime Library for Delphi
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(_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.
1161
.Net Runtime Library for Delphi
Name Description
integers.
1162
.Net Runtime Library for Delphi
Name Description
1163
.Net Runtime Library for Delphi
Name Description
1164
.Net Runtime Library for Delphi
Name Description
See Also
TClrArrayHelper Methods
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(_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.
1166
.Net Runtime Library for Delphi
Name Description
1167
.Net Runtime Library for Delphi
Name Description
1168
.Net Runtime Library for Delphi
Name Description
1169
.Net Runtime Library for Delphi
Name Description
See Also
TClrArrayHelper Methods
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.
ClrInt32)
1170
.Net Runtime Library for Delphi
Name Description
TClrInt32DynArray)
_Int32Array)
Creates a one-dimensional Array of the Type from the specified Type Name and length, with zero-based indexing.
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Creates a one-dimensional Array of the Type from the specified TypeCode and length, with zero-based indexing.
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
1171
.Net Runtime Library for Delphi
Creates a one-dimensional Array of the specified Type and length, with zero-based indexing.
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Creates a two-dimensional Array of the specified Type and dimension lengths, with zero-based indexing.
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Creates a three-dimensional Array of the specified Type and dimension lengths, with zero-based indexing.
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
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
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Creates a multidimensional Array of the specified Typeand dimension lengths, with the specified lower bounds.
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
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
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Creates a multidimensional Array of the specified Typeand dimension lengths, with the specified lower bounds.
Syntax
Delphi
1173
.Net Runtime Library for Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1174
.Net Runtime Library for Delphi
TClrArrayHelper Class
CNClrLib.Host Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1175
.Net Runtime Library for Delphi
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
1176
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
1177
.Net Runtime Library for Delphi
Converts a dynamic array of Unicode Characters to a .net one-dimensional array of Unicode Characters.
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Converts a dynamic array of Unicode Characters to a .net one-dimensional array of Unicode Characters.
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
1178
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Overload List
Name Description
Syntax
Delphi
1179
.Net Runtime Library for Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1180
.Net Runtime Library for Delphi
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Overload List
Name Description
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
1181
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
1182
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
1183
.Net Runtime Library for Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Overload List
Name Description
1184
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
1185
.Net Runtime Library for Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1186
.Net Runtime Library for Delphi
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Overload List
Name Description
Syntax
Delphi
See Also
1187
.Net Runtime Library for Delphi
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
1188
.Net Runtime Library for Delphi
Overload List
Name Description
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
1189
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
1190
.Net Runtime Library for Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1191
.Net Runtime Library for Delphi
TClrArrayHelper Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrArrayHelper Class
CNClrLib.Host Namespace
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
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
Methods
Name Description
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.
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.
1193
.Net Runtime Library for Delphi
Name Description
executed by TClrAppDomain.ExecuteAssembly.
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.
GetGACAssemblyPath Get the Global Assembly Cache (GAC) path of the assembly.
GetModules Gets all the modules that are part of this assembly, specifying whether
to include resource modules.
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.
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(_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.
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.
ToString Returns the full name of the assembly, also known as the display
name.
Properties
1195
.Net Runtime Library for Delphi
Name Description
GlobalAssemblyCache Gets a value indicating whether the assembly was loaded from the
global assembly cache.
Location Gets the full path or UNC location of the loaded file that contains the
manifest.
See Also
TClrAssembly Methods
TClrAssembly Properties
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
1196
.Net Runtime Library for Delphi
Methods
Name Description
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.
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.
1197
.Net Runtime Library for Delphi
Name Description
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.
GetGACAssemblyPath Get the Global Assembly Cache (GAC) path of the assembly.
GetModules Gets all the modules that are part of this assembly, specifying whether
to include resource modules.
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.
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(_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.
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.
ToString Returns the full name of the assembly, also known as the display
name.
1199
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
1200
.Net Runtime Library for Delphi
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Overload List
1201
.Net Runtime Library for Delphi
Name Description
TClrAssembly.Equals Determines whether this assembly and the specified variant are equal.
(ClrVariant)
Determines whether this assembly and the specified variant are equal.
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Determines whether this assembly and the specified TClrAssembly object are equal.
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
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.
Gets the currently loaded assembly in which the specified object has been created or loaded.
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Gets the currently loaded assembly in which the type from the specified type name is defined.
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Gets the currently loaded assembly in which the specified type is defined.
Syntax
1203
.Net Runtime Library for Delphi
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1204
.Net Runtime Library for Delphi
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
1205
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
1206
.Net Runtime Library for Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
1207
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Overload List
Name Description
1208
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
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
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Overload List
1209
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Overload List
Name Description
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 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.
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
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
See Also
TClrAssembly Class
CNClrLib.Host Namespace
1211
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
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
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
1212
.Net Runtime Library for Delphi
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
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.
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
See Also
1213
.Net Runtime Library for Delphi
TClrAssembly Class
CNClrLib.Host Namespace
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
See Also
TClrAssembly Class
CNClrLib.Host Namespace
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
See Also
TClrAssembly Class
CNClrLib.Host Namespace
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
See Also
1214
.Net Runtime Library for Delphi
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
1215
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Properties
Name Description
GlobalAssemblyCache Gets a value indicating whether the assembly was loaded from the
global assembly cache.
Location Gets the full path or UNC location of the loaded file that contains the
1216
.Net Runtime Library for Delphi
Name Description
manifest.
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
1217
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrAssembly Class
CNClrLib.Host Namespace
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
Name Description
Create(ClrWString) Creates a static TClrBaseObject Class from the specified type name.
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
Methods
Show: Protected
Name Description
1219
.Net Runtime Library for Delphi
Name Description
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.
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.
1221
.Net Runtime Library for Delphi
Name Description
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.
1222
.Net Runtime Library for Delphi
Name Description
GetPropertyValueO(ClrWString, ClrInt32) Searches for the public property with the specified
name and returns the property index clrobject value of
a specified indexer object.
1223
.Net Runtime Library for Delphi
Name Description
1224
.Net Runtime Library for Delphi
Name Description
1225
.Net Runtime Library for Delphi
Name Description
1226
.Net Runtime Library for Delphi
Name Description
1227
.Net Runtime Library for Delphi
Name Description
1228
.Net Runtime Library for Delphi
Name Description
RegisterEventCallBackDirect methoddirectly
add the event handler to the event.
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, _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.
1229
.Net Runtime Library for Delphi
Name Description
SetPropertyValue(ClrWString, _ClrObject) Searches for the public property with the specified
name and sets the property clrobject value of a
specified object.
1230
.Net Runtime Library for Delphi
Name Description
Properties
Name Description
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.
See Also
Create Constructor
TClrBaseObject Methods
TClrBaseObject Properties
Overload List
1231
.Net Runtime Library for Delphi
Show: Protected
Name Description
TClrBaseObject.Create Creates a static TClrBaseObject Class from the specified type name.
(ClrWString)
TClrVariantDynArray)
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)
Syntax
Delphi
See Also
1232
.Net Runtime Library for Delphi
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1233
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1234
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Methods
1235
.Net Runtime Library for Delphi
Show: Protected
Name Description
1236
.Net Runtime Library for Delphi
Name Description
GetField(ClrWString) Searches for the public field with the specified name.
GetFieldValue(ClrWString) Searches for the public field with the specified name
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.
1237
.Net Runtime Library for Delphi
Name Description
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.
1238
.Net Runtime Library for Delphi
Name Description
GetPropertyValueO(ClrWString, ClrInt32) Searches for the public property with the specified
name and returns the property index clrobject value of
a specified indexer object.
1239
.Net Runtime Library for Delphi
Name Description
1240
.Net Runtime Library for Delphi
Name Description
1241
.Net Runtime Library for Delphi
Name Description
1242
.Net Runtime Library for Delphi
Name Description
1243
.Net Runtime Library for Delphi
Name Description
1244
.Net Runtime Library for Delphi
Name Description
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, _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, _ClrObject) Searches for the public property with the specified
name and sets the property clrobject value of a
specified object.
1246
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1247
.Net Runtime Library for Delphi
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1248
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
procedure Dispose;
See Also
1249
.Net Runtime Library for Delphi
TClrBaseObject Class
CNClrLib.Host Namespace
Overload List
Name Description
TClrBaseObject.Equals Determines whether this object and the specified variant are equal.
(ClrVariant)
Determines whether this object and the specified variant are equal.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Determines whether this object and the specified TClrBaseObject object are equal.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1250
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
1251
.Net Runtime Library for Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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)
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Returns the EventInfo object representing the specified event, using the specified binding constraints.
Syntax
Delphi
See Also
1252
.Net Runtime Library for Delphi
TClrBaseObject Class
CNClrLib.Host Namespace
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)
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the specified field, using the specified binding constraints.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1253
.Net Runtime Library for Delphi
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)
Searches for the public field with the specified name and returns the value of a field supported by a given object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the specified field, using the specified binding constraints and returns the value of a field supported by a
given object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1254
.Net Runtime Library for Delphi
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.
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1255
.Net Runtime Library for Delphi
Overload List
Name Description
TClrTypeDynArray)
_TypeArray)
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1256
.Net Runtime Library for Delphi
Searches for the specified public generic method whose parameters match the specified generic and argument types.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the specified public generic method whose parameters match the specified generic types.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1257
.Net Runtime Library for Delphi
Searches for the specified public generic method whose parameters match the specified generic and argument types.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the specified public method whose parameters match the specified argument types.
Syntax
Delphi
See Also
1259
.Net Runtime Library for Delphi
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the specified public method whose parameters match the specified argument types.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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.
Syntax
Delphi
See Also
1260
.Net Runtime Library for Delphi
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the specified public property whose parameters match the specified argument types.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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)
Searches for the public property with the specified name and returns the property value of a specified object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and returns the property index value of a specified indexer
object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1262
.Net Runtime Library for Delphi
Searches for the public property with the specified name and returns the property index value of a specified indexer
object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and returns the property index value of a specified indexer
object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and returns the property index value of a specified indexer
object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1263
.Net Runtime Library for Delphi
Searches for the public property with the specified name and returns the property index value of a specified indexer
object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
Searches for the public property with the specified name and returns the property clrobject value of a specified object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and returns the property index clrobject value of a specified
indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and returns the property index clrobject value of a specified
indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1265
.Net Runtime Library for Delphi
Searches for the public property with the specified name and returns the property index clrobject value of a specified
indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and returns the property index clrobject value of a specified
indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and returns the property index clrobject value of a specified
indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1266
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Overload List
1267
.Net Runtime Library for Delphi
Name Description
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
See Also
1268
.Net Runtime Library for Delphi
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the specified public generic method whose parameters match the specified generic types and invokes the
method.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
1269
.Net Runtime Library for Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Overload List
Name Description
1271
.Net Runtime Library for Delphi
Name Description
_ObjectArray) and invokes the method using the specified parameters which
returns a ClrObject.
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1273
.Net Runtime Library for Delphi
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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.
Searches for the public method with the specified name invokes the method using the specified parameters.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1276
.Net Runtime Library for Delphi
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
1277
.Net Runtime Library for Delphi
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the specified public method whose parameters match the specified argument types and invokes the
method using the specified parameters.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
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.
Searches for the public method with the specified name invokes the method using the specified parameterswhich
returns ClrObject value.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1283
.Net Runtime Library for Delphi
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
1284
.Net Runtime Library for Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
1286
.Net Runtime Library for Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1287
.Net Runtime Library for Delphi
Syntax
Delphi
procedure RegisterEvent;
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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.
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
See Also
1288
.Net Runtime Library for Delphi
TClrBaseObject Class
CNClrLib.Host Namespace
Add an event to the instance using the specified event name and delegate.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Overload List
Name Description
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
See Also
1289
.Net Runtime Library for Delphi
TClrBaseObject Class
CNClrLib.Host Namespace
Add an event directly to the instance using the specified event name and delegate.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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.
Searches for the public field with the specified name and sets the value of a field supported by a given object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the specified field, using the specified binding constraints and sets the value of a field supported by a
given object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public field with the specified name and sets the clrobject value of a field supported by a given object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
Searches for the public property with the specified name and sets the property index value of a specified indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and sets the property index clrobject value of a specified
indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and sets the property value of a specified object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and sets the property index clrobject value of a specified
indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and sets the property index value of a specified indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and sets the property index value of a specified indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and sets the property index clrobject value of a specified
indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1296
.Net Runtime Library for Delphi
Searches for the public property with the specified name and sets the property index value of a specified indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and sets the property index clrobject value of a specified
indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and sets the property clrobject value of a specified object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1297
.Net Runtime Library for Delphi
Searches for the public property with the specified name and sets the property index value of a specified indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Searches for the public property with the specified name and sets the property index clrobject value of a specified
indexer object.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1298
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
procedure UnRegisterEvent;
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Overload List
Name Description
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Remove an event from the instance using the specified event name and delegate.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Overload List
Name Description
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
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Remove an event directly from the instance using the specified event name and delegate.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Properties
Name Description
1301
.Net Runtime Library for Delphi
Name Description
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.
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
1302
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
1303
.Net Runtime Library for Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrBaseObject Class
CNClrLib.Host Namespace
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
Constructors
Name Description
Destructors
Name Description
Methods
Show: Protected
Name Description
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
CurrentDomain Gets the current application domain for the current Thread.
1305
.Net Runtime Library for Delphi
Name Description
See Also
TClrHost Methods
TClrHost Properties
Syntax
Delphi
constructor Create;
See Also
TClrHost Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrHost Class
CNClrLib.Host Namespace
1306
.Net Runtime Library for Delphi
Methods
Show: Protected
Name Description
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.
Syntax
Delphi
See Also
TClrHost Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1307
.Net Runtime Library for Delphi
TClrHost Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrHost Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrHost Class
CNClrLib.Host Namespace
Properties
Name Description
CurrentDomain Gets the current application domain for the current Thread.
1308
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrHost Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrHost Class
CNClrLib.Host Namespace
Syntax
Delphi
1309
.Net Runtime Library for Delphi
See Also
TClrHost Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrHost Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrHost Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrHost Class
CNClrLib.Host Namespace
1310
.Net Runtime Library for Delphi
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
Name Description
1311
.Net Runtime Library for Delphi
Name Description
TBindingFlags_Set)
Destructors
Show: Inherited
Name Description
Methods
Name Description
1312
.Net Runtime Library for Delphi
Name Description
1313
.Net Runtime Library for Delphi
Name Description
TClrBaseObject.
1314
.Net Runtime Library for Delphi
Name Description
TClrBaseObject.
1315
.Net Runtime Library for Delphi
Name Description
1316
.Net Runtime Library for Delphi
Name Description
1317
.Net Runtime Library for Delphi
Name Description
1318
.Net Runtime Library for Delphi
Name Description
1319
.Net Runtime Library for Delphi
Name Description
1320
.Net Runtime Library for Delphi
Name Description
1321
.Net Runtime Library for Delphi
Name Description
1322
.Net Runtime Library for Delphi
Name Description
Properties
Show: Inherited
Name Description
See Also
Create Constructor
TClrObject Methods
Syntax
Delphi
1323
.Net Runtime Library for Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Methods
Name Description
1324
.Net Runtime Library for Delphi
Name Description
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
1325
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
1326
.Net Runtime Library for Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
1327
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
1328
.Net Runtime Library for Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
1329
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
1330
.Net Runtime Library for Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObject Class
CNClrLib.Host Namespace
1331
.Net Runtime Library for Delphi
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(_Type, ClrInt32) Creates a one-dimensional object array of the specified type name
and length, with zero-based indexing.
Destructors
Name Description
Methods
Name Description
1332
.Net Runtime Library for Delphi
Name Description
IndexOf Searches for the specified value and returns the index of its first
occurrence in the array.
LastIndexOf Searches for the specified value and returns the index of the last
occurrence within the array.
SetValue Sets a value to the element at the specified position in the array .
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.
See Also
Create Constructor
TClrObjectArray Methods
TClrObjectArray Properties
1333
.Net Runtime Library for Delphi
Overload List
Name Description
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
1334
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Name Description
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.
LastIndexOf Searches for the specified value and returns the index of the last
occurrence within the array.
SetValue Sets a value to the element at the specified position in the array .
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
procedure Clear;
See Also
1336
.Net Runtime Library for Delphi
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
1337
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1338
.Net Runtime Library for Delphi
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
procedure Reverse;
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
1339
.Net Runtime Library for Delphi
Syntax
Delphi
procedure Sort;
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
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.
1340
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrObjectArray Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
1341
.Net Runtime Library for Delphi
TClrObjectArray Class
CNClrLib.Host Namespace
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
Constructors
Name Description
Destructors
Name Description
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
ProtocolName Gets or sets the protocol used to access the described XML Web
services.
See Also
TClrWSDL Methods
TClrWSDL Properties
Syntax
Delphi
See Also
TClrWSDL Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrWSDL Class
CNClrLib.Host Namespace
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.
Syntax
Delphi
See Also
TClrWSDL Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrWSDL Class
CNClrLib.Host Namespace
Properties
Name Description
1344
.Net Runtime Library for Delphi
Name Description
ProtocolName Gets or sets the protocol used to access the described XML Web
services.
Syntax
Delphi
See Also
TClrWSDL Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrWSDL Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrWSDL Class
CNClrLib.Host Namespace
1345
.Net Runtime Library for Delphi
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
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
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.
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.
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
1347
.Net Runtime Library for Delphi
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
Syntax
Delphi
See Also
TClrActivator Class
CNClrLib.Host Namespace
7.1.1.8.3 Functions
The following table lists functions in this documentation.
Functions
Name Description
ClrLibraryLoaded Determine whether the runtime host has been loaded and
started.
1348
.Net Runtime Library for Delphi
Name Description
raised.
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
1349
.Net Runtime Library for Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
Enumerations
Name Description
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
1351
.Net Runtime Library for Delphi
Name Description
TClrBase This is the ultimate base class of all classes in the Host Class
Library.
1352
.Net Runtime Library for Delphi
Name Description
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrAChar = System.AnsiChar;
1353
.Net Runtime Library for Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrAString = System.AnsiString;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrBoolean = System.Boolean;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrByte = System.Byte;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
1354
.Net Runtime Library for Delphi
ClrChar = _Char;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrDateTime = System.TDateTime;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrDecimal = _Decimal;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrDouble = System.Double;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
1355
.Net Runtime Library for Delphi
Delphi
ClrGuid = _Guid;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrInt16 = System.SmallInt;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrInt32 = System.Integer;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrInt64 = System.Int64;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
1356
.Net Runtime Library for Delphi
Syntax
Delphi
ClrSByte = System.ShortInt;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrSingle = System.Single;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrString = System.String;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrUInt16 = System.Word;
File: CNClrLib.Host.pas
1357
.Net Runtime Library for Delphi
Namespace: CNClrLib.Host
Syntax
Delphi
ClrUInt32 = System.LongWord;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrUInt64 = ActiveX.Largeuint;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrUString = System.UnicodeString;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrVariant = System.OleVariant;
1358
.Net Runtime Library for Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrWChar = System.Char;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrWString = System.WideString;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
1359
.Net Runtime Library for Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
TClrBase = TInterfacedObject;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
1360
.Net Runtime Library for Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
1361
.Net Runtime Library for Delphi
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
1362
.Net Runtime Library for Delphi
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
1363
.Net Runtime Library for Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
1364
.Net Runtime Library for Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
1365
.Net Runtime Library for Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
1366
.Net Runtime Library for Delphi
Delphi
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrExtended = System.Extended;
File: CNClrLib.Host.pas
Namespace: CNClrLib.Host
Syntax
Delphi
ClrVariant = System.IDispatch;
1367
.Net Runtime Library for Delphi
Namespaces Description
1368
.Net Runtime Library for Delphi
Namespaces Description
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.
1369
.Net Runtime Library for Delphi
Namespaces Description
1370
.Net Runtime Library for Delphi
Namespaces Description
1371
.Net Runtime Library for Delphi
Namespaces Description
1372
.Net Runtime Library for Delphi
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
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
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('\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]);
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()');
dinosaurs.Clear();
Console.WriteLine_14('\nClear()');
finally
Console := nil;
dinosaurs:= nil;
end;
except
on E: Exception do
end;
end.
//
//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
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
openWith :=
CoGenericDictionary.CreateInstance(TClrAssembly.GetType('System.String
'),
TClrAssembly.GetType('System.String'));
openWith.Add('txt', 'notepad.exe');
openWith.Add('bmp', 'paint.exe');
openWith.Add('dib', 'paint.exe');
openWith.Add('rtf', 'wordpad.exe');
try
openWith.Add('txt', 'winword.exe');
except //(ArgumentException)
end;
1380
.Net Runtime Library for Delphi
// with a key.
openWith['rtf'] := 'winword.exe';
// If a key does not exist, setting the indexer for that key
openWith['doc'] := 'winword.exe';
try
except //(KeyNotFoundException)
end;
// When a program often has to try keys that turn out not to
else
1381
.Net Runtime Library for Delphi
begin
openWith.Add('ht', 'hypertrm.exe');
end;
Console.WriteLine();
openWith_Enum := openWith.GetEnumerator;
while openWith_Enum.MoveNext do
valueColl := openWith.Values;
valueCollEnum := valueColl.GetEnumerator;
Console.WriteLine();
while valueCollEnum.MoveNext do
keyColl := openWith.Keys;
keyCollEnum := keyColl.GetEnumerator;
Console.WriteLine();
while keyCollEnum.MoveNext do
1382
.Net Runtime Library for Delphi
Console.WriteLine_14('Remove(''doc'')');
openWith.Remove('doc');
finally
Console := nil;
end;
except
on E: Exception do
end;
end.
//
//
//
//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')
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
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
//====================================================================
====
//====================================================================
====
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);
1388
.Net Runtime Library for Delphi
//====================================================================
====
//====================================================================
====
//object that stores integer, float, string, etc., but all these
objects would only be stored as
//Objects are added using the Add() method of the ArrayList and
removed using its Remove() method.
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]);
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]);
//====================================================================
====
//====================================================================
====
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]);
//====================================================================
====
//====================================================================
====
//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
//====================================================================
====
stackObject := CoStack.CreateInstance;
stackObject.Push('Joydip');
stackObject.Push('Steve');
stackObject.Push('Jini');
Console.WriteLine_12(stackObject.Pop());
Console.ReadLine();
//====================================================================
====
//====================================================================
====
//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');
Console.WriteLine_12(queueObject.Dequeue());
Console.ReadLine();
//====================================================================
====
//====================================================================
====
// Or
// · And
1393
.Net Runtime Library for Delphi
// · Or
// · Not
// · Xor
//====================================================================
====
//====================================================================
====
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);
p := TClrInt32Helper.Parse(Console.ReadLine());
Console.WriteLine_12(hashTable[p]);
1394
.Net Runtime Library for Delphi
//object created in the above code. The code shown above can
also be written as shown below
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]);
//====================================================================
====
//====================================================================
====
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);
// Manashi
// Jini
// Joydip
// Piku
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
end;
end.
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
Example 1
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
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
myCulture := CoCultureInfo.CreateInstance('el');
myCString := 'Russian';
TypeDescriptor :=
CoTypeDescriptor.CreateInstance;
Console.WriteLine_14(TypeDescriptor.GetConverter(m
yCulture).ConvertTo(myCulture,
TClrAssembly.GetType(tcString)));
Console.WriteLine_14(TypeDescriptor.GetConverter(m
yCulture).ConvertFrom(myCString));
end.
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);
end;
end;
1402
.Net Runtime Library for Delphi
except
end;
end;
var
appSettings: _NameValueCollection;
ConfigManager: _ConfigurationManager;
I: Integer;
result: string;
begin
try
ConfigManager := CoConfigurationManager.CreateInstance;
appSettings := ConfigManager.AppSettings;
result := appSettings.Item[Key];
Console.WriteLine_14(result);
except
end;
end;
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;
settings.Add_1(key, value)
else
settings[Key].Value := value;
configFile.Save_1(ConfigurationSaveMode_Modified);
ConfigManager.RefreshSection(configFile.AppSettings.SectionInformation
.Name);
except
end;
end;
begin
try
Console := CoConsole.CreateInstance;
ReadAllSettings;
ReadSetting('Setting1');
ReadSetting('NotValid');
ReadAllSettings;
Console.ReadLine;
except
on E: Exception do
end;
end.
1404
.Net Runtime Library for Delphi
1405
.Net Runtime Library for Delphi
XML
1406
.Net Runtime Library for Delphi
<configuration>
<startup>
<supportedRuntime version="v4.0"
sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key="Setting1" value="May 5, 2014"/>
</appSettings>
</configuration>
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;
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;
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
end;
begin
exeName := TClrStringHelper.Format('{0}\{1}.exe',
environment.CurrentDirectory,
TClrStringHelper.Replace(sourceFile.Name, '.',
'_'));
cp := CoCompilerParameters.CreateInstance;
// a class library.
cp.GenerateExecutable := True;
cp.OutputAssembly := exeName;
cp.GenerateInMemory := False;
cp.TreatWarningsAsErrors := False;
1409
.Net Runtime Library for Delphi
cr := provider.CompileAssemblyFromFile(cp,
TClrArrayHelper.ToStringArray([ASourceName]));
begin
for I := 0 to cr.Errors.Count - 1 do
begin
Console.WriteLine;
end;
end
else
begin
end;
end;
end;
var
afile: _File;
afileName: string;
begin
try
Console := CoConsole.CreateInstance;
1410
.Net Runtime Library for Delphi
afileName := Console.ReadLine;
afile := CoFile.CreateInstance;
if afile.Exists(afileName) then
begin
CompileExecutable(afileName);
end
else
begin
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
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;
var
connection: _SqlConnection;
adapter: _SqlDataAdapter;
command: _SqlCommand;
dataSet: _DataSet;
productsAdapter: _SqlDataAdapter;
productsCommand: _SqlCommand;
parentColumn,
childColumn: _DataColumn;
relation: _DataRelation;
begin
connection := CoSqlConnection.CreateInstance(connectionString);
adapter := CoSqlDataAdapter.CreateInstance;
adapter.TableMappings.Add_2('Table', 'Suppliers');
1414
.Net Runtime Library for Delphi
connection.Open;
command := CoSqlCommand.CreateInstance(
connection);
command.CommandType := CommandType_Text;
adapter.SelectCommand := command;
dataSet := CoDataSet.CreateInstance('Suppliers');
adapter.Fill(dataSet);
productsAdapter := CoSqlDataAdapter.CreateInstance;
productsAdapter.TableMappings.Add_2('Table', 'Products');
productsCommand := CoSqlCommand.CreateInstance(
connection);
productsAdapter.SelectCommand := productsCommand;
productsAdapter.Fill(dataSet);
connection.Close();
1415
.Net Runtime Library for Delphi
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);
end;
begin
'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
table := CoDataTable.CreateInstance('ParentTable');
column := CoDataColumn.CreateInstance;
column.DataType := TClrAssembly.GetType('System.Int32');
column.ColumnName := 'id';
column.ReadOnly := true;
column.Unique := true;
table.Columns.Add(column);
1419
.Net Runtime Library for Delphi
column := CoDataColumn.CreateInstance;
column.DataType := TClrAssembly.GetType('System.String');
column.ColumnName := 'ParentItem';
column.AutoIncrement := false;
column.Caption := 'ParentItem';
column.ReadOnly := false;
column.Unique := false;
table.Columns.Add(column);
PrimaryKeyColumns := CoDataColumnArray.CreateInstance(1);
PrimaryKeyColumns[0] := table.Columns.Item_1['id'];
table.PrimaryKey := PrimaryKeyColumns;
dataSet := CoDataSet.CreateInstance;
dataSet.Tables.Add(table);
for I := 0 to 2 do
begin
row := table.NewRow;
row.Item_1['id'] := i;
table.Rows.Add(row);
end;
end;
1420
.Net Runtime Library for Delphi
procedure MakeChildTable;
var
table: _DataTable;
column: _DataColumn;
row: _DataRow;
I: Integer;
begin
table := CoDataTable.CreateInstance('childTable');
column := CoDataColumn.CreateInstance;
column.DataType := TClrAssembly.GetType('System.Int32');
column.ColumnName := 'ChildID';
column.AutoIncrement := true;
column.Caption := 'ID';
column.ReadOnly := true;
column.Unique := true;
table.Columns.Add(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);
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);
for I := 0 to 4 do
begin
row := table.NewRow;
row.Item_1['childID'] := i;
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['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['ParentID'] := 2;
table.Rows.Add(row);
end;
end;
procedure MakeDataRelation;
var
parentColumn,
childColumn: _DataColumn;
relation: _DataRelation;
begin
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
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;
var
command: _SqlCommand;
reader: _SqlDataReader;
begin
connection);
connection.Open();
1427
.Net Runtime Library for Delphi
reader := command.ExecuteReader;
if reader.HasRows then
begin
while reader.Read do
begin
end;
end
else
begin
end;
reader.Close();
end;
begin
'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.
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;
var
e: _GeoPositionStatusChangedEventArgs;
ageoPositionStatus: TGeoPositionStatus;
begin
e :=
CoGeoPositionStatusChangedEventArgs.Wrap(AEventArgs.EventArgs);
ageoPositionStatus :=
TGeoPositionStatus(OleEnumToOrd(GeoPositionStatusValues, e.Status));
case ageoPositionStatus of
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.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
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);
timespan := CoTimeSpanHelper.CreateInstance;
watcher.TryStart(false, timespan.FromMilliseconds(1000));
resolver := CoCivicAddressResolver.CreateInstance;
location := CoGeoCoordinate.Wrap(watcher.Position.Location);
begin
1433
.Net Runtime Library for Delphi
address := resolver.ResolveAddress(location);
begin
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.
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;
begin
Console.WriteLine_14(#13#10 + '+++++++++++');
1435
.Net Runtime Library for Delphi
Console.WriteLine;
OleEnumToOrd(PerformanceCounterTypeValues, s.CounterType)));
Console.WriteLine_14('++++++++++++++++++++++');
end;
//
++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//
++++++++
1436
.Net Runtime Library for Delphi
// intervals.
//
++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//
++++++++
var
begin
Exit(counterValue);
end;
var
PerformanceCounterCategory: _PerformanceCounterCategoryHelper;
counterDataCollection: _CounterCreationDataCollection;
averageCount64: _CounterCreationData;
averageCount64Base: _CounterCreationData;
begin
PerformanceCounterCategory :=
CoPerformanceCounterCategoryHelper.CreateInstance;
if not
PerformanceCounterCategory.Exists('AverageCounter64SampleCategory')
then
begin
counterDataCollection :=
CoCounterCreationDataCollection.CreateInstance;
averageCount64 := CoCounterCreationData.CreateInstance;
averageCount64.CounterType :=
PerformanceCounterType_AverageCount64;
1437
.Net Runtime Library for Delphi
averageCount64.CounterName := 'AverageCounter64Sample';
counterDataCollection.Add(averageCount64);
averageCount64Base := CoCounterCreationData.CreateInstance;
averageCount64Base.CounterType :=
PerformanceCounterType_AverageBase;
averageCount64Base.CounterName := 'AverageCounter64SampleBase';
counterDataCollection.Add(averageCount64Base);
PerformanceCounterCategory.Create_1('AverageCounter64SampleCategory',
PerformanceCounterCategoryType_SingleInstance,
counterDataCollection);
Exit(True);
end
else
begin
Console.WriteLine_14('Category exists -
AverageCounter64SampleCategory');
Exit(False);
end;
end;
procedure CreateCounters;
begin
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;
var
r: _Random;
j, value: Integer;
begin
r :=
CoRandom.CreateInstance(TClrDateTimeHelper.GetMillisecond(Now));
for j := 0 to 99 do
begin
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;
var
CounterSampleCalculator: _CounterSampleCalculator;
i: Integer;
begin
for i := 0 to samplesList.Count - 1 do
begin
OutputSample(CoCounterSample.Wrap(samplesList[i]));
OutputSample(CoCounterSample.Wrap(samplesList[i + 1]));
CounterSampleCalculator :=
CoCounterSampleCalculator.CreateInstance;
(CoCounterSample.Wrap(samplesList[i]),
CoCounterSample.Wrap(samplesList[i + 1])).ToString);
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.
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.
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('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;
for J := 0 to entry.Properties[key].Count - 1 do
begin
objCollection := entry.Properties[key][J];
end;
Console.WriteLine_14('===================================');
end;
mySearcher := CoDirectorySearcher.CreateInstance(entry);
mySearcher.Filter := '(objectClass=*)';
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.
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
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;
// a change in a service
query := CoWqlEventQuery.CreateInstance('__InstanceCreationEvent',
CoTimeSpan.CreateInstance(0,0,1),
1450
.Net Runtime Library for Delphi
watcher := CoManagementEventWatcher.CreateInstance;
watcher.Query := query.AsEventQuery;
watcher.Options.Timeout := CoTimeSpan.CreateInstance(0,0,5);
e := watcher.WaitForNextEvent;
CoManagementBaseObject.Wrap(e['TargetInstance'])['Name'],
CoManagementBaseObject.Wrap(e['TargetInstance'])['ExecutablePath']);
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
1452
.Net Runtime Library for Delphi
program Sample;
{$APPTYPE CONSOLE}
{$R *.res}
uses
SysUtils,
CNClrLib.Management,
CNClrLib.Core;
var
Console: _Console;
p: _ManagementPath;
begin
try
Console := CoConsole.CreateInstance;
p := CoManagementPath.CreateInstance('\\ComputerName\root' +
'\cimv2:Win32_LogicalDisk.DeviceID=''C:''');
// Should be True
// Should be "Win32_LogicalDisk"
// Should be "ComputerName\cimv2"
1453
.Net Runtime Library for Delphi
// Should be "ComputerName"
// Should be "ComputerName\root\cimv2:
// Win32_LogicalDisk.DeviceId="C:""
// Should be "Win32_LogicalDisk.DeviceID="C:""
except
on E: Exception do
begin
Console.WriteLine_14(E.message);
end;
end;
end.
1454
.Net Runtime Library for Delphi
1455
.Net Runtime Library for Delphi
process execution environment. These interfaces are defined as classes and interfaces in C#
Microsoft.SqlServer.Server Namespace.
1456
.Net Runtime Library for Delphi
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;
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');
settings := CoXmlReaderSettings.CreateInstance;
settings.NameTable := nt.AsXmlNameTable;
readerHelper := CoXmlReaderHelper.CreateInstance;
reader.MoveToContent;
reader.ReadToDescendant('book');
objectHelper := CoObjectHelper.CreateInstance;
begin
// Do additional processing.
end;
end.
1458
.Net Runtime Library for Delphi
1459