本文整理汇总了C#中Value.Dereference方法的典型用法代码示例。如果您正苦于以下问题:C# Value.Dereference方法的具体用法?C# Value.Dereference怎么用?C# Value.Dereference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Value
的用法示例。
在下文中一共展示了Value.Dereference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValueNode
/// <summary>
/// Constructor used by the factory method Create()
/// </summary>
/// <param name="val"></param>
/// <exception cref="System.Management.Automation.GetValueException">
/// Can be thrown by InvokeToString()
/// </exception>
public ValueNode(Value val)
{
this.expression = val.Expression;
canSetText = false;
if (val.Type.IsInteger) {
canSetText =
(val.Expression is LocalVariableIdentifierExpression) ||
(val.Expression is ParameterIdentifierExpression) ||
(val.Expression is ArrayIndexerExpression) ||
(val.Expression is MemberReferenceExpression && ((MemberReferenceExpression)val.Expression).MemberInfo is FieldInfo);
}
this.Image = IconService.GetBitmap("Icons.16x16." + GetImageName(val));
this.Name = val.Expression.CodeTail;
if (DebuggingOptions.Instance.ShowValuesInHexadecimal && val.Type.IsInteger) {
fullText = String.Format("0x{0:X}", val.PrimitiveValue);
} else if (val.Type.IsPointer) {
fullText = String.Format("0x{0:X}", val.PointerAddress);
} else {
fullText = val.AsString;
}
if (val.Type != null) {
this.Type = val.Type.Name;
} else {
this.Type = String.Empty;
}
// Note that these return enumerators so they are lazy-evaluated
this.ChildNodes = null;
if (val.IsNull) {
} else if (val.Type.IsClass || val.Type.IsValueType) {
this.ChildNodes = Utils.GetChildNodesOfObject(this.Expression, val.Type);
} else if (val.Type.IsArray) {
this.ChildNodes = Utils.GetChildNodesOfArray(this.Expression, val.ArrayDimensions);
} else if (val.Type.IsPointer) {
Value deRef = val.Dereference();
if (deRef != null) {
this.ChildNodes = new AbstractNode [] { new ValueNode(deRef) };
}
}
if (DebuggingOptions.Instance.ICorDebugVisualizerEnabled) {
AbstractNode info = ICorDebug.GetDebugInfoRoot(val.Process, val.CorValue);
this.ChildNodes = PrependNode(info, this.ChildNodes);
}
// Do last since it may expire the object
if ((val.Type.IsClass || val.Type.IsValueType) && !val.IsNull) {
fullText = val.InvokeToString();
}
this.Text = (fullText.Length > 256) ? fullText.Substring(0, 256) + "..." : fullText;
}