示例#1
0
        static void Main(string[] args)
        {
            DatabaseDictionary <int, Element <int, string> > IntKeyDB = new DatabaseDictionary <int, Element <int, string> >();
            Element <int, string> IKElement1 = new Element <int, string>();

            IKElement1.NAME = "The Beatles"; IKElement1.DESCRIPTION = "Rockband"; IKElement1.TIMESTAMP = DateTime.Now; IKElement1.RELATIONS = new List <int> {
                5, 2
            }; IKElement1.DATA = "Revolver";
            Element <int, string> IKElement2 = new Element <int, string>();

            IKElement2.NAME = "Pink Floyd"; IKElement2.DESCRIPTION = "Rockband"; IKElement2.TIMESTAMP = DateTime.Now; IKElement2.RELATIONS = new List <int> {
                1, 2
            }; IKElement2.DATA = "Wish you were here";
            IntKeyDB.AddPair(1, IKElement2);
            IntKeyDB.AddPair(2, IKElement1);
            Console.Write("Following key or keys contain THE BEATLES as the NAME in their values (Elements)\nKey: ");
            Console.Write("\n\nFollowing key or keys contain WISH YOU WERE HERE as the DATA in their values (Elements)\nKey: ");
            foreach (int a in IntKeyDB.FindKeysbyData("Wish you were here"))
            {
                Console.Write("{0} ", a.ToString());
            }
            Console.Write("\n\nFollowing key or keys have been updated in the database today till now\nKey: ");
            Console.WriteLine();
        }