public static IndexedClrPropertyReferenceStep GetReferenceStep(ITypeResolver typeResolver, Type declaringType, int index, bool throwOnFailure)
        {
            Type[] typeArray = new Type[] { typeof(int) };
            string str       = "Item";

            System.Reflection.PropertyInfo property = declaringType.GetProperty(str, BindingFlags.Instance | BindingFlags.Public, null, null, typeArray, null);
            if (property == null)
            {
                if (typeof(IList).IsAssignableFrom(declaringType))
                {
                    property = typeof(IList).GetProperty(str, BindingFlags.Instance | BindingFlags.Public, null, null, typeArray, null);
                }
                if (property == null)
                {
                    if (throwOnFailure)
                    {
                        CultureInfo currentCulture = CultureInfo.CurrentCulture;
                        string      typeDoesNotDeclareAnIndexer = ExceptionStringTable.TypeDoesNotDeclareAnIndexer;
                        object[]    name = new object[] { declaringType.Name };
                        throw new ArgumentException(string.Format(currentCulture, typeDoesNotDeclareAnIndexer, name), "declaringType");
                    }
                    return(null);
                }
            }
            IType             type             = typeResolver.GetType(declaringType);
            IType             propertyTypeId   = PlatformTypeHelper.GetPropertyTypeId(typeResolver, property);
            IPlatformMetadata platformMetadata = typeResolver.PlatformMetadata;

            object[] objArray = new object[] { index };
            ClrPropertyImplementationBase localClrPropertyImplementation = new LocalClrPropertyImplementation(platformMetadata, property, null, objArray);

            return(new IndexedClrPropertyReferenceStep(type, str, propertyTypeId, localClrPropertyImplementation, index));
        }
        public sealed override bool ShouldSerializeMethod(object objToInspect)
        {
            LocalClrPropertyImplementation clrImplementation = this.implementation.ClrImplementation as LocalClrPropertyImplementation;

            if (clrImplementation == null || !(clrImplementation.ShouldSerializeMethod != null))
            {
                return(true);
            }
            return((bool)clrImplementation.ShouldSerializeMethod.Invoke(objToInspect, new object[0]));
        }