Example #1
0
        private bool FindIndexer(Type targetType)
        {
            // Get the default members
            MemberInfo[] members = targetType.GetDefaultMembers();

            List <MethodInfo> methods = new List <MethodInfo>();

            // Use the first one that's valid for our indexer type
            foreach (MemberInfo mi in members)
            {
                PropertyInfo pi = mi as PropertyInfo;
                if ((pi != null))
                {
                    methods.Add(pi.GetGetMethod(true));
                }
            }

            FunctionCallElement func = new FunctionCallElement("Indexer", methods.ToArray(), _myIndexerElements);

            func.Resolve(MyServices);
            _myIndexerElement = func;

            return(true);
        }
Example #2
0
        private void EmitIndexer(FleeILGenerator ilg, IServiceProvider services)
        {
            FunctionCallElement func = (FunctionCallElement)_myIndexerElement;

            func.EmitFunctionCall(this.NextRequiresAddress, ilg, services);
        }