public static object TryGetValue(ResourceDictionary resourceDictionary, object key) { #if SILVERLIGHT return(resourceDictionary.Contains(key) ? resourceDictionary[key] : null); #else return(resourceDictionary.GetSetValueOrDefault(key)); #endif }