本文整理汇总了C#中mdr.AsString方法的典型用法代码示例。如果您正苦于以下问题:C# mdr.AsString方法的具体用法?C# mdr.AsString怎么用?C# mdr.AsString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mdr
的用法示例。
在下文中一共展示了mdr.AsString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToString
public static string ToString(ref mdr.DValue arg)
{
//TODO: it seems eventually, this is the right implementation, but for now, we use the special implementation
//mdr.DValue output;
//if (Operations.Internals.CallToStringProperty(Operations.Convert.ToObject.Run(ref arg), out output))
// return output.AsString();
//else
// return Operations.Convert.ToString.Run(ref arg);
string s;
if (!mdr.ValueTypesHelper.IsObject(arg.ValueType))
{
s = Operations.Convert.ToString.Run(ref arg);
}
else
{
var argObj = arg.AsDObject(); //TODO: should we call ToObject(arg) here instead?!
var toString = argObj.GetField("toString");
if (toString.ValueType == mdr.ValueTypes.Function)
{
var cf = new mdr.CallFrame();
cf.Function = toString.AsDFunction();
cf.Signature = mdr.DFunctionSignature.EmptySignature;
cf.This = argObj;
cf.Arguments = null;
cf.Function.Call(ref cf);
s = Operations.Convert.ToString.Run(ref cf.Return);
}
else
{
s = arg.AsString();
}
}
return s;
}