C# 根据资源类反射出所有资源名称和类型

可以方法

 

  Type _Info = Type.GetType("WindowsApplication1.Properties.Resources", false);

 

            SortedList<string, string> _List = GetResourceNames(_Info);

 

 

具体方法

 

 

  /// <summary> /// 根据资源类获取资源名称和类型 [email protected] qq:116149 /// </summary> /// <param name="p_ResourcesType">资源类 Type _Info = Type.GetType("WindowsApplication1.Properties.Resources", false); </param> /// <returns></returns> public SortedList<string, string> GetResourceNames(Type p_ResourcesType) { SortedList<string, string> _ResourcesList = new SortedList<string, string>(); System.Reflection.PropertyInfo[] _PropertiesList = p_ResourcesType.GetProperties(BindingFlags.NonPublic | BindingFlags.Static); for (int i = 0; i != _PropertiesList.Length; i++) { if (_PropertiesList[i].Name == "Culture" || _PropertiesList[i].Name == "ResourceManager") continue; _ResourcesList.Add(_PropertiesList[i].Name, _PropertiesList[2].PropertyType.FullName); } return _ResourcesList; }

你可能感兴趣的:(String,qq,list,C#)