MarkLogic XCC/.Net Library |

# Request.SetNewVariable Method (String, String, ValueType, Object)

Convenience method that creates a new XdmVariable, binds it to this Request and then returns the new XdmVariable object. This method is equivalent to:

                XdmVariable temp = ValueFactory.newVariable (
                ValueFactory.newXName (namespace, localname),
                ValueFactory.newValue (type, value));
                request.setVariable (temp);
                return temp;

[Visual Basic]
Function SetNewVariable( _
ByVal ns As String, _
ByVal localname As String, _
ByVal type As ValueType, _
ByVal val As Object _
) As XdmVariable
[C#]
XdmVariable SetNewVariable(
string ns,
string localname,
ValueType type,
object val
);

#### Parameters

ns
  A namespace String, or null for the default namespace.
localname
  The local name as a String.
type
  An instance of ValueType that indicates which specific subclass of XdmValue to instantiate.
val
  An object that contains the value. The concrete type that should be passed is dependent on the ValueType instance provided as the "type" parameter.

#### Return Value

The newly construct XdmVariable instance.

#### See Also

Request Interface | Marklogic.Xcc Namespace | Request.SetNewVariable Overload List