Data structure for SMS RRS feed

  • Question

  • I'm adding SMS feature to our application program.

    This program is PC side and will send/receive message to/from cell phone.

    I'm designing data structure but still I have not idea how to make it.

    First, My program should create a List element for a texting(chatting) session.

    And each list element should have a cell phone# as a key, type(incoming/outgoing) and multiple messages.

    How could I make data structure for this?

    I have no idea how to add multiple(variable) messages into each List elements.

    (some chatting can end with one message, 2, 3... 100 or more)

    This List element will removed when PC side close the chatting window.

    Can anybody give me some idea?

    • Edited by Jeff0803 Tuesday, May 28, 2019 2:37 AM
    Tuesday, May 28, 2019 2:31 AM


  • I'm not exactly sure what you mean, but it sounds like you want a list of strings. Maybe a class like so.

    using System.Collections.Generic; // This is needed for List.
    public class ChatSession
       public string PhoneNo{get;} // Or maybe an integer, rather than a string.
       public bool IsIncoming{get;} // = true for incoming, false for outgoing.
       List<string> Messages{get;}
       // Constructor.
       public ChatSession(string phone, bool incoming)
          PhoneNumber = phone;
          IsIncoming = incoming;
          Messages = new List<string>();

    Use like thus.

    ChatSession session = new ChatSession("555 555 5555", false);
    // etc. etc. More code goes here.
    session.Messages.Add("How are you going?");
    session.Messages.Add("Going to the footy Friday?");
    // And so on.

    • Marked as answer by Jeff0803 Sunday, June 2, 2019 5:15 AM
    Tuesday, May 28, 2019 4:13 AM