CogVerificationParamsExpectedOutputsContainer Add Method (String, Object)Cognex VisionPro 9.5
Adds an expected output with the given key and expectedValue to the record.

Namespace: Cognex.VisionPro.Inspection
Assembly: Cognex.VisionPro.Inspection (in Cognex.VisionPro.Inspection.dll) Version: 69.0.0.0 (69.0.0.0)
Syntax

public void Add(
	string key,
	Object expectedValue
)

Parameters

key
Type: System String
The key to be added to the Record's ExpectedOutput parameters. The key has to be unique
expectedValue
Type: System Object
The value to be assigned with the given key
Exceptions

ExceptionCondition
ExceptionThrown if the key is not unique.
Examples

Imports Cognex.VisionPro
Imports Cognex.VisionPro.Database
Imports Cognex.VisionPro.Inspection

Private Sub AddProperty()
        Dim mInputDatabase As New CogVerificationDatabase(New CogDatabaseDirectory("C:\SampleDatabase"))
        mInputDatabase.Connect()

        Dim mCurrentRecord As CogVerificationData = mInputDatabase.Fetch(0)

        ' Add additional property to the record with the name "Area" and a value of 3.1415
        mCurrentRecord.Params.ExpectedOutputs.Add("Area", 3.1415)

        ' Change the additional property "Area"
        mCurrentRecord.Params.ExpectedOutputs.Record.SubRecords("Area").Content = 2.7182

        ' Update the record in the database
        mInputDatabase.Replace(mCurrentRecord)

        mInputDatabase.Disconnect()
End Sub
using Cognex.VisionPro;
using Cognex.VisionPro.Database;
using Cognex.VisionPro.Inspection;

private AddProperty()
{
    CogVerificationDatabase mInputDatabase = new CogVerificationDatabase(new CogDatabaseDirectory(@"C:\SampleDatabase"));
    mInputDatabase.Connect();

    CogVerificationData mCurrentRecord = mInputDatabase.Fetch(0);

    // Add additional property to the record with the name "Area" and a value of 3.1415
    mCurrentRecord.Params.ExpectedOutputs.Add("Area", 3.1415);

    // Change the additional property "Area"
    mCurrentRecord.Params.ExpectedOutputs.Record.SubRecords["Area"].Content = 2.7182;

    // Update the record in the database
    mInputDatabase.Replace(mCurrentRecord);

    mInputDatabase.Disconnect();
}
See Also