Message.RemoveField
Method
Visual Basic
Overloads Public SubRemoveField
(
ByVal messageField As MessageField)
Overloads Public SubRemoveField
(
ByVal fieldName As String)
Overloads Public SubRemoveField
(
ByVal fieldName As String,
ByVal fieldId As UInt16)
C#
public voidRemoveField
(
MessageField messageField );
public voidRemoveField
(
string fieldName );
public voidRemoveField
(
string fieldName,
ushort fieldId );
Purpose
Remove a field from a message.
Parameter |
Description |
|
The parameter is a message field object, which specifies either the field name, the field identifier, or both; see MessageField. |
|
Remove the field with this name. |
|
Remove the field with this identifier. |
Field Search Algorithm
This method uses this algorithm to find and remove a field within a message, as specified by a field identifier and a field name.
Procedure
1. | If the program supplied MessageField.NoSpecificId (zero) as the identifier, or omitted any identifier, then begin at step 3. |
If the program supplied a non-zero field identifier, then search for the field with that identifier. If the search succeeds, remove the field and return.
On the search does not find a field, continue to step 2.
2. | If the identifier search (in step 1) fails, and the program supplied a non-null field name, then search for a field with that name. |
On the search does not find a field, or if the program supplied null as the field name, throw an exception with the status code NotFound.
If the name search succeeds, but the actual identifier in the field is non-zero (so it does not match the identifier supplied) then throw an exception with the status code IDConflict.
If the search succeeds, remove the field and return.
3. | When the program supplied MessageField.NoSpecificId (zero) as the identifier, or omitted any identifier, then begin here. |
Search for a field with the specified name—even if that name is null.
If the search succeeds, remove the field and return.
If the search does not find a field, throw an exception with the status code NotFound.
If a message contains several fields with the same name, searching by name removes the first instance of the field with that name.