Collapse All Expand All

C#

Clarion Library 6.1.1
AgentInitializer..::..InitializeDrive<(Of <(<'T>)>)> Method
AgentInitializer Class Example See Also Send Feedback

[This is preliminary documentation and is subject to change.]

Initializes a Drive of the specified type (to be placed in the bottom level of the MS upon being committed)

Namespace: Clarion
Assembly: ClarionLibrary (in ClarionLibrary.dll) Version: 6.1.1.0 (6.1.1.0)

# Syntax

C#
    public static T InitializeDrive<T>(
    	Agent destination,
    	IDriveFactory<T> factory,
    	params Object[] parameters
    )
    where T : Drive

#### Parameters

destination
  Type: Clarion.Framework..::..Agent
  The agent in whom the drive is being attached

factory
  Type: Clarion.Framework.Templates..::..IDriveFactory<(Of <(<'T>)>)>
  The factory to use to generate the drive

parameters
  Type: array<System..::..Object>[]()[][]
  (optional) Any parameters that may be needed by the factory in order to initialize the drive.
  To find-out the list of required and optional parameters, please consult the documentation of the factory for the drive being generated

# Type Parameters

T
  The type of drive that is to be initialized

#### Return Value

A drive of the type specified initialized within the agent specified

# Remarks

Remember that the Drive class is basically just a "wrapper" around an ImplicitComponent, so don't forget to initialize one for the drive that is returned by this method. An example of how to do this can be found in the "Examples" section (below).

Caution
Don't forget that the drive being initialized by this method MUST be committed to the agent in which it was initialized! Failure to do so WILL result in an error!

# Examples

CopyC#

    FoodDrive foodDrive = AgentInitializer.InitializeDrive(John, FoodDrive.Factory, .5);

    BPNetwork comp = AgentInitializer.InitializeDriveComponent(foodDrive, BPNetwork.Factory);

    //Elided code further initializing the drive and drive component

    foodDrive.Commit(comp);

    John.Commit(foodDrive);

# See Also

AgentInitializer Class
Clarion Namespace