当前位置: 首页>>代码示例>>C#>>正文


C# PhpArray.AddToEnd方法代码示例

本文整理汇总了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;
		}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:18,代码来源:Arrays.cs

示例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;
        }
开发者ID:dw4dev,项目名称:Phalanger,代码行数:32,代码来源:Arrays.cs

示例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;
        }
开发者ID:hansdude,项目名称:Phalanger,代码行数:42,代码来源:PDOStatement.cs

示例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;
        }
开发者ID:dw4dev,项目名称:Phalanger,代码行数:32,代码来源:SQLite.cs

示例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;
        }
开发者ID:jafin,项目名称:Phalanger,代码行数:36,代码来源:PDOStatement.cs


注:本文中的PHP.Core.PhpArray.AddToEnd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。