Table of Contents

Class ComponentBase

Namespace
Stride.Core
Assembly
Stride.Core.dll

Base class for a framework Component.

[DataContract]
public abstract class ComponentBase : DisposeBase, IDisposable, IComponent, IReferencable, ICollectorHolder
Inheritance
object
ComponentBase
Implements
Derived
Inherited Members
Extension Methods

Remarks

A Component is an object that can have a Name and other meta-information (see Tags), and that can hold references to other sub-Components that depend on it.

Components have reference-counting lifetime management, so calling Dispose() does not immediately releases its underlying resources, but instead decreases an internal reference count. When that reference count reaches zero, it then calls Destroy() automatically, where the underlying resources can then be released safely.

When Destroy() is called, not only the resources associated with the Component itself should be released, but it cascades the releasing of resources to its contained sub-Components.

Constructors

ComponentBase()

Initializes a new instance of the ComponentBase class.

protected ComponentBase()

ComponentBase(string?)

Initializes a new instance of the ComponentBase class.

protected ComponentBase(string? name)

Parameters

name string

The name attached to the Component, or null to use the type's name.

Fields

Tags

The properties attached to the Component.

public PropertyContainer Tags

Field Value

PropertyContainer

Properties

Name

Gets or sets the name of the Component.

public virtual string Name { get; set; }

Property Value

string

The name that identifies the Component. It can be null to denote it has no specific name.

Methods

Destroy()

Disposes the object's resources.

protected override void Destroy()

Remarks

Override in a derived class to implement disposal logic specific to it.

This method is automatically called whenever a call to Dispose() (or to Release()) has decreased the internal reference count to zero, meaning no other objects (hopefully) hold a reference to this one and its resources can be safely released.

OnNameChanged()

Called when the Name property has changed.

protected virtual void OnNameChanged()

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

See Also