Working with an API that can handle multiple connections (i.e. sessions), each of these sessions has a uniqueID (sessionID) and keeps track of all inbound and outbound messages via sequence numbers.
Class1
public void Method1(SessionID sessionID, Message message)
{
var ID = sessionID;
var foo = message.InSeqNo;
}
public void Method2(SessionID sessionID, Message message)
{
var ID = SessionID;
var bar = message.OutSeqNo;
}
I’m curious how would you recommend storing this data together so each instance can be displayed independently based on its sessionID.
There is no need to store previous numbers because they are only displayed.
None of the SessionIDs will change and each sequence number will update independently.
The best thing I can think of is using two separate fields like Dictionary<sessionID, number>, .Clear each field on update, re-add with new values, then join the two via LINQ and display the information.
Why not a single class that contains the inbound and outbound sequence numbers for a particular ID?
Dictionary Sessions = new Dictionary();
To update a session’s InSeqNo, then:
Or am I missing something fundamental in your question?