Compartir a través de


Struct.remove(String) Method

Definition

Removes an item from a struct.

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

Parameters

_fieldName
String

The name of the item you want to remove.

Returns

true if the item was found (and removed); otherwise, false.

Remarks

The name you specify for the fieldName parameter must be the name of the item as it was specified in the instantiation of the struct or the name of the item as it was added using the Struct.add method. The name must be enclosed in quotes (" ").

The following example creates a struct with two items in it and prints a description of these items. One of the items is then removed by using the remove method.

{ 
    Struct s = new Struct ("str name; int age"); 
    // Values are assigned to the two items 
    s.value("name", "John"); 
    s.value("age", 34); 
    // Prints a description of the items in the struct 
    print s.definitionString(); 
    pause; 
    // Removes the name field 
    s.remove("name"); 
    // Describes remaining items in the struct 
    print s.definitionString(); 
    pause; 
}

Applies to