Given a Type object return the programs instance if the RunUnit knows
about it. If create is true then GetInstance will create an instance of
programType if it doesn't already have one. Otherwise it will return
null should an instance not exist.
Namespace: MicroFocus.COBOL.RuntimeServices
Assembly: MicroFocus.COBOL.RuntimeServices (in MicroFocus.COBOL.RuntimeServices.dll) Version: 1.2.3.4
Syntax
[CLSCompliantAttribute(false)] public IObjectControl GetInstance( Type programType, bool create )
Parameters
- programType
- Type: SystemType
The type of the program to construct. - create
- Type: SystemBoolean
Whether to create an instance if one doesn't already exist.
Return Value
Type: IObjectControlAn instance of programType or null.
Implements
IRunUnitGetInstance(Type, Boolean)Examples
var myRunUnit = new RunUnit(); try { var myProgram1 = myRunUnit.GetInstance(typeof(Program1), true) as Program1; myProgram1.Program1("Dobson", 36); } finally { // Destroy the run unit myRunUnit.StopRun(); }
See Also