Data Structures C# Dictionary and user has a property that is a list
You neither need TryGetValue nor ContainsKey if you don't care about the existence of the User in the Dictionary&lt;TKey, TValue&gt; which seems to be the case, because you want to either add  or update the User in the dict.  

You can simply use the Item property setter to achieve this and after changing the method name to AddOrUpdate (based on the NET naming guidelines) your former method will look like so  

public static void AddOrUpdate(Dictionary&lt;int, User&gt; dic, int key, User user)
{
    //sets a new user data and just replaces it in the dictionary
    //var used = new User { ID = "id1", Name = "Harry" };
    var used = new User{ ID = "id3", Name = "Henry" ,AddressBook = new List&lt;ContactNumber&gt;(){new ContactNumber(3111),new ContactNumber(4444)}};

    dic[key] = used;

}  


This is because internally the Dictionary.Add() method calls Insert() with true for the add parameter like so  


public void Add(TKey key, TValue value) {
    Insert(key, value, true);
}  



and the Item property looks like so  


public TValue this[TKey key] {
    get {
        int i = FindEntry(key);
        if (i &gt;= 0) return entries[i].value;
        ThrowHelper.ThrowKeyNotFoundException();
        return default(TValue);
    }
    set {
        Insert(key, value, false);
    }
}



where the add parameter of the Insert() method call is false.