Dictionary.Lookup C# (CSharp) Method

Lookup() public static method

public static Lookup ( String animal ) : string
animal String
return string
	public static string Lookup(String animal)
	{
		switch(animal)
		{
			case "Dog":
				return "Domestic animal related to a wolf that's fond of chasing cats";
			case "Cat":
				return "Carnivourous, domesticated mammal that's fond of rats and mice";
			case "Mouse":
				return "Small rodent often seen running away from a cat";
			default:
				return "Unknown animal";

		}
	}
}

Usage Example

        public void DictionaryLookup()
        {
            var dicResult = Dictionary.Lookup(DictionaryDirectory.EnRu, "time");

            var def0 = dicResult.Definitions[0];
            var def1 = dicResult.Definitions[1];

            Assert.AreEqual("time", def0.Text);
            Assert.AreEqual(6, def0.Translations.Count);
            var tr = def0.Translations[0];

            Assert.AreEqual("noun", tr.PartOfSpeech);
            Assert.AreEqual("время", tr.Text);

            Assert.AreEqual("раз", tr.Synonyms[0].Text);
            Assert.AreEqual("момент", tr.Synonyms[1].Text);

            Assert.AreEqual("period", tr.Meanings[0].Text);
            Assert.AreEqual("once", tr.Meanings[1].Text);
            Assert.AreEqual("moment", tr.Meanings[2].Text);
            Assert.AreEqual("pore", tr.Meanings[3].Text);

            Assert.AreEqual("daylight saving time", tr.Examples[0].Text);
            Assert.AreEqual("летнее время", tr.Examples[0].Translations[0].Text);
            Assert.AreEqual("take some time", tr.Examples[1].Text);
            Assert.AreEqual("занять некоторое время", tr.Examples[1].Translations[0].Text);
            Assert.AreEqual("real time mode", tr.Examples[2].Text);
            Assert.AreEqual("режим реального времени", tr.Examples[2].Translations[0].Text);

            Assert.AreEqual("verb", def1.PartOfSpeech);
            Assert.AreEqual("taɪm", def1.Transcription);
            Assert.AreEqual("time", def1.Text);
            Assert.AreEqual("verb", def1.Translations[0].PartOfSpeech);
            Assert.AreEqual("приурочивать", def1.Translations[0].Text);
        }
All Usage Examples Of Dictionary::Lookup
Dictionary