public TypeValue(TypeMirror instance) { Contract.Requires(instance != null); var props = from p in instance.GetAllProperties() where p.HasSimpleGetter() && (p.GetGetMethod(true) != null && p.GetGetMethod(true).IsStatic) || (p.GetSetMethod() != null && p.GetSetMethod().IsStatic) select p; var fields = from f in instance.GetAllFields() where f.IsStatic select f; m_instance = instance; Length = props.Count() + fields.Count(); }
public static VariableItem GetChild(ThreadMirror thread, VariableItem parentItem, TypeMirror parent, int index) { var props = (from p in parent.GetAllProperties() where p.HasSimpleGetter() && (p.GetGetMethod(true) != null && p.GetGetMethod(true).IsStatic) || (p.GetSetMethod(true) != null && p.GetSetMethod(true).IsStatic) select p).ToArray(); if (index < props.Length) { PropertyInfoMirror prop = props[index]; MethodMirror method = parent.ResolveProperty(prop.Name); Value child = parent.InvokeMethod(thread, method, new Value[0], InvokeOptions.DisableBreakpoints | InvokeOptions.SingleThreaded); return new VariableItem(thread, prop.Name, parentItem, prop, child, index); } else { var fields = from f in parent.GetAllFields() where f.IsStatic select f; FieldInfoMirror field = fields.ElementAt(index - props.Length); Value child; if (field.HasCustomAttribute("System.ThreadStaticAttribute")) child = field.DeclaringType.GetValue(field, thread); else child = field.DeclaringType.GetValue(field); return new VariableItem(thread, field.Name, parentItem, index, child, index); } }