Click or drag to resize

ObjectWithExternalInterfaceAddInterfaceClassReference(IObjectWithExternalInterface, String, Boolean, Boolean, String) Method

Adds an InterfaceClass reference to this ObjectWithExternalInterface using the provided CAEX path, referencing an InterfaceClass object. The InterfaceClass reference is added as a ExternalInterfaceType object.

Namespace: Aml.Engine.CAEX.Extensions
Assembly: Aml.Engine (in Aml.Engine.dll) Version: 3.2
Syntax
public static ExternalInterfaceType AddInterfaceClassReference(
	this IObjectWithExternalInterface ObjectWithExternalInterface,
	string interfaceClassReference,
	bool addUnique = true,
	bool addInstance = false,
	string name = ""
)

Parameters

ObjectWithExternalInterface  IObjectWithExternalInterface
the CAEX object with external interfaces
interfaceClassReference  String
The CAEX path referencing a InterfaceClass to be assigned to the ObjectWithExternalInterface.
addUnique  Boolean  (Optional)
if set to true the reference is not added, if the same reference already exists.
addInstance  Boolean  (Optional)
if set to true, the reference is created as an instance of the InterfaceClass, identified by the provided interfaceClassReference, containing all ExternalInterfaces and Attributes of the InterfaceClass.
name  String  (Optional)
Provides the name for the new external interface. If no name is provided, the name is taken from the referenced class.

Return Value

ExternalInterfaceType
The new added InterfaceClass reference.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IObjectWithExternalInterface. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullExceptioninterfaceClassReference
Remarks
The default behaviour is, that only a reference to the interface class is added and no instance of the class containing all Attributes and ExternalInterface objects. If an instance is required, set the optional parameter 'addInstance' to true or use the CreateClassInstance and the CAEXSequenceOfCAEXObjects Insert(CAEXWrapper, bool) methods,
Example
This sample shows how to call the AddInterfaceClassReference(IObjectWithExternalInterface, String, Boolean, Boolean, String) method using a standard InterfaceClass path defined in the AutomationMLInterfaceClassLib
C#
var myIH = myDocument.CAEXFile.InstanceHierarchy.Append ("myIH");
var myIE = myIH.InternalElement.Append("myIH");
myIE.AddInterfaceClassReference (AutomationMLInterfaceClassLib.AutomationMLBaseInterface);
See Also