BExplorer.Shell.Interop.PropVariantNativeMethods.SafeArrayGetElement C# (CSharp) Method

SafeArrayGetElement() private method

private SafeArrayGetElement ( IntPtr psa, int &rgIndices ) : object
psa System.IntPtr
rgIndices int
return object
		internal extern static object SafeArrayGetElement(IntPtr psa, ref int rgIndices);

Usage Example

Example #1
0
        private static Array CrackSingleDimSafeArray(IntPtr psa)
        {
            uint cDims = PropVariantNativeMethods.SafeArrayGetDim(psa);

            if (cDims != 1)
            {
                throw new ArgumentException("", "psa");
            }

            int lBound = PropVariantNativeMethods.SafeArrayGetLBound(psa, 1U);
            int uBound = PropVariantNativeMethods.SafeArrayGetUBound(psa, 1U);

            int n = uBound - lBound + 1;             // uBound is inclusive

            object[] array = new object[n];
            for (int i = lBound; i <= uBound; ++i)
            {
                array[i] = PropVariantNativeMethods.SafeArrayGetElement(psa, ref i);
            }

            return(array);
        }