hessiancsharp.io.CArrayDeserializer.ReadList C# (CSharp) Méthode

ReadList() public méthode

Reads the array.
public ReadList ( AbstractHessianInput abstractHessianInput, int intLength ) : Object
abstractHessianInput AbstractHessianInput HessianInput
intLength int Length of data
Résultat Object
        public override Object ReadList(AbstractHessianInput abstractHessianInput, int intLength)
        {
            if (intLength >= 0)
            {
                // mw bugfix
                //Object[] arrResult = createArray(intLength);
                Array arrResult = createArray(intLength);

                abstractHessianInput.AddRef(arrResult);

                if (m_componentType != null)
                {
                    for (int i = 0; i < arrResult.Length; i++)
                        arrResult.SetValue(abstractHessianInput.ReadObject(m_componentType), i);
                }
                else
                {
                    for (int i = 0; i < arrResult.Length; i++)
                        arrResult.SetValue(abstractHessianInput.ReadObject(), i);
                }

                abstractHessianInput.ReadListEnd();
                return arrResult;
            }
            else
            {
                List<Object> colList = new List<Object>();
                abstractHessianInput.AddRef(colList);
                if (m_componentType != null)
                {
                    while (!abstractHessianInput.IsEnd())
                        colList.Add(abstractHessianInput.ReadObject(m_componentType));
                }
                else
                {
                    while (!abstractHessianInput.IsEnd())
                        colList.Add(abstractHessianInput.ReadObject());
                }

                abstractHessianInput.ReadListEnd();

                //Object[] arrResult = createArray(colList.Count);
                Array arrResult = createArray(colList.Count);
                for (int i = 0; i < colList.Count; i++)
                    arrResult.SetValue(colList[i], i);
                return arrResult;
            }
        }