class ImageData { internal int Width { get; private set;} internal int Height { get; private set; } internal ImageData( int width, int height) { Width = width; Height = height; } } static class TestImage { internal static void Go() { Dictionary<string, ImageData> images = new Dictionary<string,ImageData>(); images.Add("image1", new ImageData(10, 20)); images.Add("image2", new ImageData(30, 40)); string s = "image1"; bool found = false; ImageData imagedata; if (images.TryGetValue(s, out imagedata)) { found = true; Console.WriteLine("Found {0} : Width {1} and Height {2}", found, imagedata.Width, imagedata.Height); } } }