Share via


TBoundProperty.bool operator!=(PropertyType&) (Compact 7)

3/12/2014

The != overloaded operator determines whether the value contained in a TBoundProperty<PropertyType> object and another PropertyType value are different.

Syntax

bool operator!=(
PropertyType & value)

Parameters

  • value
    [in] Pointer to a PropertyType value that is the operand on the right in a C++ expression.

Return Value

Returns true if the values of its operand on the left and operand on the right are different. Otherwise, returns false.

Remarks

The following example code uses the != overloaded operator to determine whether a PropertyType value is different from an integer value of 2.

Important

For readability, the following code example does not contain security checking or error handling. Do not use the following code in a production environment.

#include "XamlRuntime.h"
#include "XRPropertyBag.h"

#define CHK_BOOL(x) { \
    if (!(x)) { \
        ASSERT(!"Assertion failed"); \
        return E_FAIL; \
    }}

void Check_relational_operator()
{
     // Create an XRValue that encapsulates an integer value that is 1.
     XRValue value1;
     value1.SetValue(1);

     // Define a TBoundProperty object that has PropertyType set to integer.
     TBoundProperty<int> propInt1;

     //Set the TBoundProperty value to the XRValue that encapsulates an integer.
     propInt1.Set(&value1);

     // Retrieve the new value as a PropertyType data type, which is an integer.
    int propValue = propInt1.Get();

     // Use the != operator to determine 
     // whether the PropertyType value is different from an integer value of 2.
     CHK_BOOL(propValue != 2);
}

Requirements

Header

XRPropertyBag.h

See Also

Reference

C++ Overloaded Operators for PropertyType
TBoundProperty.operator==(PropertyType&)
TBoundProperty<PropertyType>