C# Класс Pchp.Core.PhpResource

Base class for PHP Resources - both built-in and extension-resources. Resources rely on GC Finalization - override FreeManaged for cleanup. When printing a resource variable in PHP, "Resource id #x" prints out.
Наследование: IDisposable, IPhpConvertible
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
_resourceId int
_typeName string

Private Properties

Свойство Тип Описание
IPhpConvertible Convert.NumberInfo
IPhpConvertible bool
IPhpConvertible double
IPhpConvertible long
IPhpConvertible object
IPhpConvertible string
PhpResource Pchp.Core
RegisterInternalInstance int

Открытые методы

Метод Описание
Dispose ( ) : void

Disposes the resource.

Dispose ( bool disposing ) : void

Cleans-up the resource.

When disposing non-deterministically, only unmanaged resources should be freed. FreeUnmanaged

PhpResource ( string resourceTypeName ) : Pchp.Core

Create a new instance of a given Type and Name. The instance Id is auto-incrementing starting from 1.

ToString ( ) : string

Returns a string that represents the current PhpResource.

Защищенные методы

Метод Описание
FreeManaged ( ) : void

Override this virtual method in your descendants to perform cleanup of Managed resources - those having a Finalizer of their own.

Note that when Disposing explicitly, both FreeManaged and FreeUnmanaged are called.

FreeUnmanaged ( ) : void

Override this virtual method to cleanup the contained unmanaged objects.

Note that when Dispose(false) is called from the Finalizer, the order of finalization is random. In other words, contained managed objects may have been already finalized - don't reference them.

PhpResource ( int resourceId, string resourceTypeName ) : Pchp.Core

Create a new instance with the given Id.

Приватные методы

Метод Описание
IPhpConvertible ( PhpNumber &number ) : Convert.NumberInfo
IPhpConvertible ( ) : bool
IPhpConvertible ( ) : double
IPhpConvertible ( ) : long
IPhpConvertible ( ) : object
IPhpConvertible ( Context ctx ) : string
PhpResource ( ) : Pchp.Core

Creates a new invalid resource.

RegisterInternalInstance ( ) : int

Allocate a unique identifier for a resource.

Internal resources are given even numbers while resources allocated by extensions get odd numbers to minimize the communication between internal and external resource managers.

Описание методов

Dispose() публичный Метод

Disposes the resource.
public Dispose ( ) : void
Результат void

Dispose() публичный Метод

Cleans-up the resource.
When disposing non-deterministically, only unmanaged resources should be freed. FreeUnmanaged
public Dispose ( bool disposing ) : void
disposing bool Whether the resource is disposed deterministically.
Результат void

FreeManaged() защищенный Метод

Override this virtual method in your descendants to perform cleanup of Managed resources - those having a Finalizer of their own.
Note that when Disposing explicitly, both FreeManaged and FreeUnmanaged are called.
protected FreeManaged ( ) : void
Результат void

FreeUnmanaged() защищенный Метод

Override this virtual method to cleanup the contained unmanaged objects.
Note that when Dispose(false) is called from the Finalizer, the order of finalization is random. In other words, contained managed objects may have been already finalized - don't reference them.
protected FreeUnmanaged ( ) : void
Результат void

PhpResource() защищенный Метод

Create a new instance with the given Id.
protected PhpResource ( int resourceId, string resourceTypeName ) : Pchp.Core
resourceId int Unique resource identifier (odd for external resources).
resourceTypeName string The type to be reported to use when dumping a resource.
Результат Pchp.Core

PhpResource() публичный Метод

Create a new instance of a given Type and Name. The instance Id is auto-incrementing starting from 1.
public PhpResource ( string resourceTypeName ) : Pchp.Core
resourceTypeName string The type to be reported to use when dumping a resource.
Результат Pchp.Core

ToString() публичный Метод

Returns a string that represents the current PhpResource.
public ToString ( ) : string
Результат string

Описание свойств

_resourceId защищенное свойство

Unique resource identifier (even for internal resources, odd for external ones).
Internal resources are given even numbers while resources allocated by extensions get odd numbers to minimize the communication between internal and external resource managers.
protected int _resourceId
Результат int

_typeName защищенное свойство

Type resource name - string to be reported to user when dumping a resource.
protected string _typeName
Результат string