/// <summary> /// 从g.resources命名空间中获取流,它通常是生成类型为"Resource"时生成的资源 /// </summary> /// <param name="resNamespace">要保证命名空间和程序集名称相同</param> /// <param name="key"></param> /// <returns></returns> public static object GetGResources(Assembly ass, string key) { ResourceReader breader = GetGResourcesReader(ass); if (breader == null) { return(null); } object r = null; breader.Each(k => { DictionaryEntry de = (DictionaryEntry)k; if (key.ToLower() == de.Key.ToString().ToLower()) { r = ((DictionaryEntry)k).Value; return(false); } return(true); }); breader.Close(); return(r); }