當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。