Share via


Struct.exists(String) Method

Definition

Determines whether a particular item exists in a struct.

public:
 virtual bool exists(System::String ^ _fieldName);
public virtual bool exists (string _fieldName);
abstract member exists : string -> bool
override this.exists : string -> bool
Public Overridable Function exists (_fieldName As String) As Boolean

Parameters

_fieldName
String

The name of the item to check for.

Returns

true if the item exists in the struct; otherwise, false.

Remarks

The following example tests whether a particular item exists in a struct, and if not, it adds the item and assigns a value to it using the Struct.add method.

client server static void setProp( 
    Struct     properties, 
    str        name, 
    anytype   value 
    ) 
{ 
    if (! properties.exists(name)) 
    { 
        properties.add(name,nullValue(value)); 
    } 
    properties.value(name,value); 
}

Applies to