Home Forums Support What's the best way to send a collection of objects?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #4084

    Hi, I’m new NetworkComms.net and so far, I really like it.

    I need to send a collection of objects. Basically a file list.

    So I created a FileDetails object
    public class FileDetails
    public string FileName { get; set; }


    but I don’t know the best way to send a List<FileDetails> or honestly ANY way to send them.

    I tried

    public List<FileDetails> _files;
    [ProtoMember(4, OverwriteList = true)]
    private IEnumerable<FileDetails> Files
    get { return _files; }
    _files = new List<FileDetails>();

    but when I sent the message, the connection at the other end closes.

    I looked thru your sample code and didn’t find a collection inside a message anywhere.

    Can you point me in the right direction?



    I found the answer. Don’t use collections, use plain old arrays ([])

    here’s an example:
    public FileDetails[] Files;

    hope it helps others. 🙂

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.