Microsoft.CSharp.RuntimeBinder.Semantics.TypeArray.CopyItems C# (CSharp) Method

CopyItems() public method

public CopyItems ( int i, int c, CType dest ) : void
i int
c int
dest CType
return void
        public void CopyItems(int i, int c, CType[] dest)
        {
            for (int j = 0; j < c; ++j)
            {
                dest[j] = _items[i + j];
            }
        }
    }

Usage Example

Esempio n. 1
0
        protected bool TryGetExpandedParams(TypeArray @params, int count, out TypeArray ppExpandedParams)
        {
            CType[] prgtype;
            if (count < @params.size - 1)
            {
                // The user has specified less arguments than our parameters, but we still
                // need to return our set of types without the param array. This is in the 
                // case that all the parameters are optional.
                prgtype = new CType[@params.size - 1];
                @params.CopyItems(0, @params.size - 1, prgtype);
                ppExpandedParams = GetGlobalSymbols().AllocParams(@params.size - 1, prgtype);
                return true;
            }

            prgtype = new CType[count];
            @params.CopyItems(0, @params.size - 1, prgtype);

            CType type = @params.Item(@params.size - 1);
            CType elementType = null;

            if (!type.IsArrayType())
            {
                ppExpandedParams = null;
                // If we don't have an array sym, we don't have expanded parameters.
                return false;
            }

            // At this point, we have an array sym.
            elementType = type.AsArrayType().GetElementType();

            for (int itype = @params.size - 1; itype < count; itype++)
            {
                prgtype[itype] = elementType;
            }

            ppExpandedParams = GetGlobalSymbols().AllocParams(prgtype);

            return true;
        }