locked
updating a member of an object from a dictionary RRS feed

  • Question

  • User379720387 posted

    myConnectedClients dictionary has a series of IP:PORT, and myClient objects

    At one point I need to set keyvalHasExistingManual

    public class myClient
        {
            public IClient keyvalClient { get; set; }
            public string keyvalLocType { get; set; }
            public bool keyvalHasExistingManual { get; set; }
        }
    
    private Dictionary<string, myClient> myConnectedClients = new Dictionary<string, myClient>();

    How does one update just keyvalHasExistingManual?

    Monday, April 1, 2019 6:38 PM

Answers

  • User475983607 posted

    It's a dictionary so you have fetch the object by the key.

    myConnectedClients["127.0.0.3:80"].keyvalHasExistingManual = false;

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 1, 2019 7:50 PM