Q: how to build flat API with indexer against dictionary backing Ok, am I just not seeing how to do this or is there a fundamental problem with the approach?
Given the following desired public API:
[Fact]
public void GroupManagerCanAddNewGroupWithConnectionId()
{
    var groupName = "ThisNewGroup";
    var connectionId = "ThisNewConnection";

    var sut = new GroupManager();
    sut.Add(groupName, connectionId);

    Assert.Contains(groupName, sut.Groups);
    Assert.Contains(connectionId, sut.Groups[groupName]);
}

How do I achieve something like the following, which clearly is not legal as it does not compile:
private readonly ConcurrentDictionary<string, HashSet<string>> groups =
    new ConcurrentDictionary<string, HashSet<string>>();

public IEnumerable<string> Groups { get { return this.groups.Keys; } }
public IEnumerable<string> Groups[string i] { get { return this.groups[i]; } }

public void Add(string groupName, string connectionSring)
{
   groups.AddOrUpdate(
        groupName,
        new HashSet<string>(new string[1] { connectionSring }),
        (conn, list) => { list.Add(conn); return list; });
}


A: Use an indexer in your class for accessing a dictionary by a key
public IEnumerable<string> this[string key]
{
    get
    {
        return groups[key];
    }
}


A: I knew it could be done.  I added a wrapper class to manage access and then defined access by inheriting from IEnumerable and providing a property indexer.  Then my group manager class became simple.  Now my test passes.
public class GroupManager
{
    private readonly GroupStore groups = new GroupStore();

    public GroupStore Groups { get { return this.groups; } }

    public void Add(string groupName, string connectionSring)
    {
        groups.Add(groupName, connectionSring);
    }
}

public class GroupStore : IEnumerable<string>
{
    private readonly ConcurrentDictionary<string, HashSet<string>> groupStore = new ConcurrentDictionary<string, HashSet<string>>();

    public IEnumerable<string> this[string index] { get { return this.groupStore[index]; } }

    public IEnumerator<string> GetEnumerator()
    {
        return groupStore.Keys.GetEnumerator();
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
        return (IEnumerator)GetEnumerator();
    }

    public void Add(string groupName, string connectionSring)
    {
        //groupStore.AddOrUpdate(...);
    }
}

