Rhino.ScriptRuntime.NewArrayLiteral C# (CSharp) Method

NewArrayLiteral() public static method

public static NewArrayLiteral ( object objects, int skipIndices, Context cx, Scriptable scope ) : Scriptable
objects object
skipIndices int
cx Context
scope Scriptable
return Scriptable
		public static Scriptable NewArrayLiteral(object[] objects, int[] skipIndices, Context cx, Scriptable scope)
		{
			int SKIP_DENSITY = 2;
			int count = objects.Length;
			int skipCount = 0;
			if (skipIndices != null)
			{
				skipCount = skipIndices.Length;
			}
			int length = count + skipCount;
			if (length > 1 && skipCount * SKIP_DENSITY < length)
			{
				// If not too sparse, create whole array for constructor
				object[] sparse;
				if (skipCount == 0)
				{
					sparse = objects;
				}
				else
				{
					sparse = new object[length];
					int skip = 0;
					for (int i = 0, j = 0; i != length; ++i)
					{
						if (skip != skipCount && skipIndices[skip] == i)
						{
							sparse[i] = ScriptableConstants.NOT_FOUND;
							++skip;
							continue;
						}
						sparse[i] = objects[j];
						++j;
					}
				}
				return cx.NewArray(scope, sparse);
			}
			Scriptable array = cx.NewArray(scope, length);
			int skip_1 = 0;
			for (int i_1 = 0, j_1 = 0; i_1 != length; ++i_1)
			{
				if (skip_1 != skipCount && skipIndices[skip_1] == i_1)
				{
					++skip_1;
					continue;
				}
				ScriptableObject.PutProperty(array, i_1, objects[j_1]);
				++j_1;
			}
			return array;
		}
ScriptRuntime