本文整理匯總了C#中Mono.CSharp.Constant.GetValueAsLiteral方法的典型用法代碼示例。如果您正苦於以下問題:C# Constant.GetValueAsLiteral方法的具體用法?C# Constant.GetValueAsLiteral怎麽用?C# Constant.GetValueAsLiteral使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mono.CSharp.Constant
的用法示例。
在下文中一共展示了Constant.GetValueAsLiteral方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Visit
public override object Visit(Constant constant)
{
if (constant.GetValue() == null)
return new NullReferenceExpression(Convert(constant.Location));
string literalValue;
var literalConstant = constant as ILiteralConstant;
literalValue = literalConstant != null ? new string(literalConstant.ParsedValue) : constant.GetValueAsLiteral();
object val = constant.GetValue();
if (val is bool)
literalValue = (bool)val ? "true" : "false";
var result = new PrimitiveExpression(val, Convert(constant.Location), literalValue);
return result;
}
示例2: Visit
public override object Visit (Constant constant)
{
var result = new PrimitiveExpression (constant.GetValue (), Convert (constant.Location), constant.GetValueAsLiteral ().Length);
return result;
}
示例3: Visit
public override object Visit (Constant constant)
{
if (constant.GetValue () == null)
return new NullReferenceExpression (Convert (constant.Location));
string literalValue;
if (constant is ILiteralConstant) {
literalValue = new string (((ILiteralConstant)constant).ParsedValue);
} else {
literalValue = constant.GetValueAsLiteral ();
}
var result = new PrimitiveExpression (constant.GetValue (), Convert (constant.Location), literalValue);
return result;
}
示例4: Visit
public override object Visit (Constant constant)
{
if (constant.GetValue () == null)
return new NullReferenceExpression (Convert (constant.Location));
var result = new PrimitiveExpression (constant.GetValue (), Convert (constant.Location), constant.GetValueAsLiteral ().Length);
return result;
}