1: /// <summary>
2: /// Returns all assemblies and their properties
3: /// </summary>
4: /// <returns>An HTML formatted string that contains the assemblies and their information</returns>
5: public static string DumpAllAssembliesAndProperties()
6: { 7: StringBuilder Builder = new StringBuilder();
8: Assembly[] Assemblies = AppDomain.CurrentDomain.GetAssemblies();
9: foreach (Assembly Assembly in Assemblies)
10: { 11: Builder.Append("<strong>").Append(Assembly.GetName().Name).Append("</strong><br />"); 12: Builder.Append(DumpProperties(Assembly)).Append("<br /><br />"); 13: }
14: return Builder.ToString();
15: }
16:
17: /// <summary>
18: /// Dumps the properties names and current values
19: /// from an object
20: /// </summary>
21: /// <param name="Object">Object to dunp</param>
22: /// <returns>An HTML formatted table containing the information about the object</returns>
23: public static string DumpProperties(object Object)
24: { 25: StringBuilder TempValue = new StringBuilder();
26: TempValue.Append("<table><thead><tr><th>Property Name</th><th>Property Value</th></tr></thead><tbody>"); 27: Type ObjectType = Object.GetType();
28: PropertyInfo[] Properties = ObjectType.GetProperties();
29: foreach (PropertyInfo Property in Properties)
30: { 31: TempValue.Append("<tr><td>").Append(Property.Name).Append("</td><td>"); 32: ParameterInfo[] Parameters = Property.GetIndexParameters();
33: if (Property.CanRead && Parameters.Length == 0)
34: { 35: try
36: { 37: object Value = Property.GetValue(Object, null);
38: TempValue.Append(Value == null ? "null" : Value.ToString());
39: }
40: catch { } 41: }
42: TempValue.Append("</td></tr>"); 43: }
44: TempValue.Append("</tbody></table>"); 45: return TempValue.ToString();
46: }