本文整理汇总了C#中PHP.Core.PhpArray.AddToEnd方法的典型用法代码示例。如果您正苦于以下问题:C# PhpArray.AddToEnd方法的具体用法?C# PhpArray.AddToEnd怎么用?C# PhpArray.AddToEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHP.Core.PhpArray
的用法示例。
在下文中一共展示了PhpArray.AddToEnd方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Values
public static PhpArray Values(PhpArray array)
{
if (array == null)
{
PhpException.ArgumentNull("array");
return null;
}
// references are not dereferenced:
PhpArray result = new PhpArray(array.Count);
using (var enumerator = array.GetFastEnumerator())
while (enumerator.MoveNext())
result.AddToEnd(enumerator.CurrentValue);
// result is inplace deeply copied on return to PHP code:
result.InplaceCopyOnReturn = true;
return result;
}
示例2: Keys
public static PhpArray Keys(PhpArray array, object searchValue, bool strict)
{
if (array == null)
{
PhpException.ArgumentNull("array");
return null;
}
PhpArray result = new PhpArray();
if (!strict)
{
using (var enumerator = array.GetFastEnumerator())
while (enumerator.MoveNext())
{
if (PhpComparer.CompareEq(enumerator.CurrentValue, searchValue))
result.AddToEnd(enumerator.CurrentKey.Object);
}
}
else
{
using (var enumerator = array.GetFastEnumerator())
while (enumerator.MoveNext())
{
if (Operators.StrictEquality(enumerator.CurrentValue, searchValue))
result.AddToEnd(enumerator.CurrentKey.Object);
}
}
// no need to make a deep copy since keys are immutable objects (strings, ints):
return result;
}
示例3: fetchAll
public object fetchAll(ScriptContext context, [Optional]object fetch_style/*=null*/, [Optional]object fetch_argument/*=null*/, [Optional]object ctor_args/*=null*/)
{
PhpArray arr = new PhpArray();
PDOFetchType fetch;
if (fetch_style == null || fetch_style == Arg.Default)
fetch = PDOFetchType.PDO_FETCH_BOTH;
else
fetch = (PDOFetchType)(int)fetch_style;
// TODO: fetch bitwise combinations (group, unique, ...)
if (fetch == PDOFetchType.PDO_FETCH_COLUMN)
{
int column = (fetch_argument == null || fetch_argument == Arg.Default) ? 0 : Core.Convert.ObjectToInteger(fetch_argument);
while (true)
{
var ret = this.fetch(context, (int)PDOFetchType.PDO_FETCH_NUM) as PhpArray;
if (ret == null)
break;
arr.AddToEnd(ret[column]);
}
}
else
{
while (true)
{
object ret = this.fetch(context, (int)fetch);
if ((ret is bool && ((bool)ret) == false) || ret == null)
{
break;
}
else
{
arr.AddToEnd(ret);
}
}
}
return arr;
}
示例4: FetchAll
public static PhpArray FetchAll(PhpResource resultIdentifier, object result_type, object decode_binary)
{
PhpSQLiteDbResult res = PhpSQLiteDbResult.ValidResult(resultIdentifier);
if (res == null)
{
return null;
}
SQLite.QueryResultKeys resType = QueryResultKeys.Both;
if (result_type != null)
{
int val = PHP.Core.Convert.ObjectToInteger(result_type);
if (val != 0)
{
resType = (SQLite.QueryResultKeys)val;
}
}
bool intKey = (resType & SQLite.QueryResultKeys.Numbers) == SQLite.QueryResultKeys.Numbers;
bool strKey = (resType & SQLite.QueryResultKeys.ColumnNames) == SQLite.QueryResultKeys.ColumnNames;
PhpArray arr = new PhpArray();
PhpArray line = null;
while ((line = res.FetchArray(intKey, strKey)) != null)
{
arr.AddToEnd(line);
}
if (arr.Count == 0)
{
return null;
}
return arr;
}
示例5: fetchAll
public object fetchAll(ScriptContext context, object fetch_style, object fetch_argument, object ctor_args)
{
PhpArray arr = new PhpArray();
PDOFetchType fetch;
if (fetch_style == null)
{
fetch = PDOFetchType.PDO_FETCH_BOTH;
}
else
{
fetch = (PDOFetchType)fetch_style;
}
while (true)
{
switch (fetch)
{
case PDOFetchType.PDO_FETCH_BOTH:
case PDOFetchType.PDO_FETCH_ASSOC:
case PDOFetchType.PDO_FETCH_NUM:
break;
default:
throw new NotImplementedException();
}
object ret = this.fetch(context, fetch);
if ((ret is bool && ((bool)ret) == false) || ret == null)
{
break;
}
else
{
arr.AddToEnd(ret);
}
}
return arr;
}