本文整理汇总了C#中System.Reference.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Reference.ToString方法的具体用法?C# Reference.ToString怎么用?C# Reference.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reference
的用法示例。
在下文中一共展示了Reference.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReferenceListItem
// TODO: Find a *much* nicer way of dealing with this. :X
public ReferenceListItem(Reference reference, Display display, Resource context)
{
this.Reference = reference;
string displayStr;
switch (display)
{
case Display.NoMod:
displayStr = reference.ToString(false, context);
break;
case Display.WithMod:
displayStr = reference.ToString(true, context);
break;
case Display.SourcedNoMod:
displayStr = reference.ToStringSourced(false, context);
break;
case Display.SourcedIncoming:
displayStr = "[INCOMING] " + reference.ToStringSourced(false, context);
break;
default:
throw new ArgumentException("display");
}
this.AddText(displayStr);
SetBackground(reference.Valid ? ItemStatus.Okay : ItemStatus.Error);
this.CommandBindings.Add(new System.Windows.Input.CommandBinding(
System.Windows.Input.ApplicationCommands.Copy,
(o, e) => System.Windows.Clipboard.SetText(string.Concat(reference.Origin.Location, " : ", reference.Target.Location))
));
this.ContextMenu = new ContextMenu();
var items = this.ContextMenu.Items;
items.Add(new MenuItem { Header = "_Copy...", Command = System.Windows.Input.ApplicationCommands.Copy, CommandTarget = this });
items.Add(CreateItem(Reference.Definition, "_Definition: "));
// Add the origin unless it's the same
if (Reference.Definition != reference.Origin)
items.Add(CreateItem(Reference.Origin, "_Origin: "));
// Add the definition *unless* it's either.
if (Reference.Definition != Reference.Target && Reference.Origin != Reference.Target)
items.Add(CreateItem(Reference.Target, "_Target: "));
}
示例2: execute
internal object execute(Node n, ExecutionContext x)
{
int i, j;
List<Node> aNode;
ExecutionContext sEcon;
JSObjectBase jaa;
JSObjectBase f, tVal;
object r, s, u = null, v = null;
Node tNode = null, rNode = null, uNode = null;
bool matchDefault = false;
bool switchLoop;
if (TraceExec)
System.Console.Write("Execute[" + n.ToString() + " => ");
try
{
switch (n.type)
{
case TokenType.Function:
if (n.functionForm != StatementForm.DECLARED_FORM)
{
if (n.name == null || n.name == "" || n.functionForm == StatementForm.STATEMENT_FORM)
{
v = new FunctionObject(GLOBAL, n, x.scope);
if (n.functionForm == StatementForm.STATEMENT_FORM)
x.scope.jobject.SetItem(GLOBAL, n.name, new JSSimpleProperty(n.name, v));
}
else
{
tVal = new JSObject();
ExecutionContext tmp = x.scope;
x.scope = new ExecutionContext();
x.scope.jobject = tVal;
x.scope.parent = tmp;
try
{
v = new FunctionObject(GLOBAL, n, x.scope);
tVal.SetItem(GLOBAL, n.name, new JSSimpleProperty(n.name, v, true, true));
}
finally
{
x.scope = x.scope.parent;
}
}
}
break;
case TokenType.SCRIPT:
tVal = x.scope.jobject;
aNode = n.funDecls;
for (i = 0, j = aNode.Count; i < j; i++)
{
s = aNode[i].name;
f = new FunctionObject(GLOBAL, aNode[i], x.scope);
tVal.SetItem(GLOBAL, s.ToString(), new JSSimpleProperty(s.ToString(), f, x.type != CodeType.EVAL_CODE));
}
aNode = n.varDecls;
for (i = 0, j = aNode.Count; i < j; i++)
{
uNode = aNode[i];
s = uNode.name;
if (uNode.readOnly && tVal.HasOwnProperty(s.ToString()))
{
throw new TypeError
("Redeclaration of const " + s, uNode.filename, uNode.lineno);
}
if (uNode.readOnly || !tVal.HasOwnProperty(s.ToString()))
{
tVal.SetItem(GLOBAL, s.ToString(), new JSSimpleProperty(s.ToString(), JSUndefined.Undefined, x.type != CodeType.EVAL_CODE, uNode.readOnly));
}
}
// FALL THROUGH
for (i = 0, j = n.Count; i < j; i++)
execute(n[i], x);
break;
case TokenType.BLOCK:
for (i = 0, j = n.Count; i < j; i++)
execute(n[i], x);
break;
case TokenType.If:
if (JSObject.ToBool(GLOBAL, execute(n.condition, x)))
execute(n.thenPart, x);
else if (n.elsePart != null)
execute(n.elsePart, x);
break;
case TokenType.Switch:
s = execute(n.discriminant, x);
aNode = n.cases;
Node tt;
switchLoop = false;
for (i = 0, j = aNode.Count; ; i++)
{
if (i == j)
{
if (n.defaultIndex >= 0)
{
//.........这里部分代码省略.........