BinaryOccurrence.Optional

Updated on

BinaryOccurrence.Optional (0) is an enumeration that specifies how many times the item is expected to appear in the group. It is a member of the BinaryOccurrence.Type and specifies the item appearing zero or one time in the input.

Examples

// The following example returns {11, {22, 22}, null, {}}
let
    b = #binary( { 1, 11, 2, 22, 2, 22, 5, 55, 1, 11 } ),
    f = BinaryFormat.Group( 
           BinaryFormat.Byte,
           {
               {1, BinaryFormat.Byte, BinaryOccurrence.Required},
               {2, BinaryFormat.Byte, BinaryOccurrence.Repeating},
               {3, BinaryFormat.Byte, BinaryOccurrence.Optional},
               {4, BinaryFormat.Byte, BinaryOccurrence.Repeating}
           },
           ( extra ) => BinaryFormat.Byte
        )
in
    f( b )

Other related enumerations are:

Applies to

Here’s a list of functions that work with BinaryOccurrence.Type:

Contribute » | Contributors: Rick de Groot

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy