Share via


IRowVariableModel.AddVariable Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Adds a user variable to a model.

Namespace:  Microsoft.SolverFoundation.Services
Assembly:  Microsoft.Solver.Foundation (in Microsoft.Solver.Foundation.dll)

Syntax

'Declaration
Function AddVariable ( _
    key As Object, _
    <OutAttribute> ByRef vid As Integer _
) As Boolean
bool AddVariable(
    Object key,
    out int vid
)
bool AddVariable(
    Object^ key, 
    [OutAttribute] int% vid
)
abstract AddVariable : 
        key:Object * 
        vid:int byref -> bool 
function AddVariable(
    key : Object, 
    vid : int
) : boolean

Parameters

Return Value

Type: System.Boolean
true if the user variable is added to the model successfully; false if the model already includes a user variable that is referenced by key or if the model already includes a row that is referenced by key.

Remarks

The following table shows the vid values that result based on the status of key.

key in the model

Value of vid

The model already includes a user variable that is referenced by key.

vid is set to the variable index.

The model already includes a row that is referenced by key.

vid is set to -1.

A new user variable associated with key is added to the model.

vid is set to the new variable index.

.NET Framework Security

See Also

Reference

IRowVariableModel Interface

Microsoft.SolverFoundation.Services Namespace