Sage Modeling and Simulation Library

SmartPropertyBag..::..AddDelegate Method

Adds a delegate to the SPB under a specified key. When this entry is retrieved from the SPB, it will first be located by key, and then be evaluated by calling it, and the value returned from the delegate invocation will be returned to the entity calling into the SPB. Example:
C#
SPBDoubleDelegate spbdd = new SPBDoubleDelegate(this.GetAValue);
mySPB.AddDelegate("someValue",spbdd); // Add the delegate to the SPB.
double theValue = mySPB["someValue"]; // calls into 'this.GetAValue()' and returns the answer.

Namespace:  Highpoint.Sage.SimCore
Assembly:  Sage4 (in Sage4.dll)

Syntax


public void AddDelegate(
	string key,
	SmartPropertyBag..::..SPBDoubleDelegate val
)

Parameters

key
Type: String
The key by which the delegate's value will known and/or retrieved.
val
Type: Highpoint.Sage.SimCore..::..SmartPropertyBag..::..SPBDoubleDelegate
The delegate that will be stored in the SPB.