Repeating Groups
The OnixS.SimpleBinaryEncoding.IGroup
interface provides iterator access to repeating group entries.
This interface extends OnixS.SimpleBinaryEncoding.IFieldSet
interface providing access to the current
repeating group entry fields.
Encoding Example
const int PartyDetailsGroupSize = 2;
const int NoPartyDetailsTag = 1671;
const int PartyDetailIDTag = 1691;
const int PartyDetailRoleTag = 1693;
// Set the PartyDetails group size and get the corresponding Group instance.
IGroup details = request.SetGroup(NoPartyDetailsTag, PartyDetailsGroupSize);
// Move to the first entry
details.MoveNext();
// Set field values of the first repeating group entry.
details.SetString(PartyDetailIDTag, "004");
details.SetEnum(PartyDetailRoleTag, PartyDetailRole.ExecutingFirm);
// Move to the second entry
details.MoveNext();
// Set field values of the second repeating group entry.
details.SetString(PartyDetailIDTag, "CSET_TEST");
details.SetEnum(PartyDetailRoleTag, PartyDetailRole.CustomerAccount);
details.Reset();
while (details.MoveNext())
{
Console.WriteLine($"partyDetailId={details.GetString(PartyDetailIDTag)}; partyDetailRole={details.GetEnum<PartyDetailRole>(PartyDetailRoleTag)}");
}
Decoding Example
var decodedGroup = request.GetGroup(NoPartyDetailsTag);
// group iteration by using MoveNext()
while (decodedGroup.MoveNext())
{
Console.WriteLine("PartyDetailID = " + decodedGroup.GetString(PartyDetailIDTag));
Console.WriteLine("PartyDetailRole = " + decodedGroup.GetEnum<PartyDetailRole>(PartyDetailRoleTag));
}
// by GetEnumerator
foreach (var groupEntry in decodedGroup)
{
Console.WriteLine("PartyDetailID = " + groupEntry.GetString(PartyDetailIDTag));
Console.WriteLine("PartyDetailRole = " + groupEntry.GetEnum<PartyDetailRole>(PartyDetailRoleTag));
}