Exemplo n.º 1
0
        static void WriteInternal(string pageName, string groupName, string name, MyLifetime lifetime, int value)
        {
            Debug.Assert(pageName != null && groupName != null && name != null, "Invalid dictionary keys.");

            GroupToNameDictionary page;
            if (!m_records.TryGetValue(pageName, out page))
            {
                page = new GroupToNameDictionary();
                m_records.Add(pageName, page);
                m_orderedPages.Add(pageName);
            }

            NameToRecordDictionary group;
            if (!page.TryGetValue(groupName, out group))
            {
                group = new NameToRecordDictionary();
                page.Add(groupName, group);
            }

            MyRecord record;
            if (!group.TryGetValue(name, out record))
            {
                record = new MyRecord();
                group.Add(name, record);
            }

            record.Lifetime = lifetime;
            record.Value = value;
        }
Exemplo n.º 2
0
        static void WriteInternal(string pageName, string groupName, string name, MyLifetime lifetime, int value)
        {
            Debug.Assert(pageName != null && groupName != null && name != null, "Invalid dictionary keys.");

            GroupToNameDictionary page;

            if (!m_records.TryGetValue(pageName, out page))
            {
                page = new GroupToNameDictionary();
                m_records.Add(pageName, page);
                m_orderedPages.Add(pageName);
            }

            NameToRecordDictionary group;

            if (!page.TryGetValue(groupName, out group))
            {
                group = new NameToRecordDictionary();
                page.Add(groupName, group);
            }

            MyRecord record;

            if (!group.TryGetValue(name, out record))
            {
                record = new MyRecord();
                group.Add(name, record);
            }

            record.Lifetime = lifetime;
            record.Value    = value;
        }