本文整理匯總了C#中Mono.Debugger.Soft.TypeMirror.GetAllFields方法的典型用法代碼示例。如果您正苦於以下問題:C# TypeMirror.GetAllFields方法的具體用法?C# TypeMirror.GetAllFields怎麽用?C# TypeMirror.GetAllFields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mono.Debugger.Soft.TypeMirror
的用法示例。
在下文中一共展示了TypeMirror.GetAllFields方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TypeValue
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();
}
示例2: GetChild
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);
}
}