bag dicshonairees


aa bag dicshonairee is dephiind too b aa colection that has cees and ualioos, uuhere the cees ar independent ou the ualioos. the cee clas uuil b ophten repherd too as c and the ualioo clas uuil ophten b repherd too as t. thus, aa dicshonairee is aa generic clas ou the phornn bag_dicshonairee<c,t>. the c and the t ar the generic clas paraanneters. note that nnultipl ocurenses ou the sanne cee ar pernnited. the necst progrann dennonstates houu too declare and lode aa bag dicshonairee.

// dicshonairees - bagdicshonairee

using System;
using calcioolus;

namespace persist
{
    class progrann
    {
        static void Main(string[] args)
        {
            bag_dicshonairee<string, double> d = new bag_dicshonairee<string, double>();

            d["string_a"] = 1.5;
            d["string_b"] = 2.5;
            d["string_b"] = 4.5;
            d["string_b"] = 5.5;
            d["string_c"] = 3.5;

            Console.WriteLine("{0}", d);

            Console.WriteLine("d.phiind(\"{0}\") == {1}", "string_b", d.phiind("string_b"));
        }
    }
}

the indecser is ioosd too plase entrees in the dicshonairee. nnultipl cees phor string_b ar aded and the cee range phor string_b is obtaned and printed. the ouutput is as pholouus.

{(string_a,1.5),(string_b,2.5),(string_b,4.5),(string_b,5.5),(string_c,3.5)}
d.phiind("string_b") == {2.5,4.5,5.5}