本文整理汇总了C#中Jurassic.Library.ObjectInstance.SetPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectInstance.SetPropertyValue方法的具体用法?C# ObjectInstance.SetPropertyValue怎么用?C# ObjectInstance.SetPropertyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jurassic.Library.ObjectInstance
的用法示例。
在下文中一共展示了ObjectInstance.SetPropertyValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Assign
public static ObjectInstance Assign(ScriptEngine engine, ObjectInstance target, params object[] sources)
{
foreach (var rawSource in sources)
{
// Ignore undefined or null sources.
if (rawSource == null || rawSource == Undefined.Value || rawSource == Null.Value)
continue;
var source = TypeConverter.ToObject(engine, rawSource);
// Copy the enumerable properties from the source object.
foreach (var property in source.Properties)
if (property.IsEnumerable == true)
target.SetPropertyValue(property.Key, property.Value, throwOnError: true);
}
return target;
}
示例2: SetLength
/// <summary>
/// Sets the number of items in the array.
/// </summary>
/// <param name="thisObj"> The array that is being operated on. </param>
/// <param name="value"> The new value of the length property. </param>
private static void SetLength(ObjectInstance thisObj, uint value)
{
if (thisObj is ArrayInstance)
((ArrayInstance)thisObj).Length = value;
else
thisObj.SetPropertyValue("length", (double)value, true);
}