本文整理匯總了C#中PHP.Core.PhpArray.SetArrayItemRef方法的典型用法代碼示例。如果您正苦於以下問題:C# PhpArray.SetArrayItemRef方法的具體用法?C# PhpArray.SetArrayItemRef怎麽用?C# PhpArray.SetArrayItemRef使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHP.Core.PhpArray
的用法示例。
在下文中一共展示了PhpArray.SetArrayItemRef方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SetItemRef
public static void SetItemRef(PhpReference value, string key, ref object var)
{
Debug.Assert(!(var is PhpReference));
Debug.Assert(!(var is PhpArrayString), "ensures and end-of-chain operators only");
PhpArray array;
// PhpArray:
if ((array = var as PhpArray) != null)
{
// a reference in "value" is directly assigned to the array's item:
array.SetArrayItemRef(key, value);
return;
}
// null, empty string or empty string of bytes
if (IsEmptyForEnsure(var))
{
// a reference in "value" is directly assigned to the array's item:
PhpArray var_array = new PhpArray();
var_array.SetArrayItemRef(key, value);
var = var_array;
return;
}
SetItemRefEpilogue(value, key, ref var);
}
示例2: GetItemRef
public static PhpReference/*!*/ GetItemRef(string key, ref object var)
{
Debug.Assert(!(var is PhpReference));
Debug.Assert(!(var is PhpArrayString), "ensures and end-of-chain operators only");
// PhpArray:
if (var != null && var.GetType() == typeof(PhpArray)) // fast check for PhpArray, not derived types
return ((PhpArray)var).GetArrayItemRef(key);
// creates a new reference and adds it to an a new array:
if (IsEmptyForEnsure(var))
{
PhpArray array;
var = array = new PhpArray(0, 1);
PhpReference result = new PhpReference();
array.SetArrayItemRef(key, result);
return result;
}
return GetItemRefEpilogue(key, ref var);
}