Exemplo n.º 1
0
        /// <summary>
        ///     When you enumerate a object, the offset within the object is returned.  This offset might represent
        ///     nested fields (obj.Field1.Field2).    GetFieldOffset returns the first of these field (Field1),
        ///     and 'remaining' offset with the type of Field1 (which must be a struct type).   Calling
        ///     GetFieldForOffset repeatedly until the childFieldOffset is 0 will retrieve the whole chain.
        /// </summary>
        /// <param name="fieldOffset">The field offset.</param>
        /// <param name="inner">if set to <c>true</c> [inner].</param>
        /// <param name="childField">The child field.</param>
        /// <param name="childFieldOffset">The child field offset.</param>
        /// <returns>true if successful.  Will fail if it 'this' is an array type</returns>
        public bool GetFieldForOffset(int fieldOffset, bool inner, out IClrInstanceField childField,
                                      out int childFieldOffset)
        {
            var res = ClrType.GetFieldForOffset(fieldOffset, inner, out var outChildField, out childFieldOffset);

            childField = Converter.Convert(outChildField);
            return(res);
        }