Пример #1
0
        public IEnumerable <DynamicInstance> GetStaticFields(Func <ClrStaticField, bool> fieldsFilter, bool includeParents = false)
        {
            var appDomain = Heap.Runtime.AppDomains[0];

            IEnumerable <ClrStaticField> fields = includeParents ? GetAllStaticFields(Type) : Type.StaticFields;

            return(fields.Where(fieldsFilter).Select(sf => DynamicInstance.FromField(sf.GetValue(appDomain), sf, Heap)));
        }
Пример #2
0
        public override bool TryGetMember(GetMemberBinder binder, out object result)
        {
            var field = Type.GetFieldByName(binder.Name);

            if (field != null)
            {
                var fieldValue = field.GetValue(Address, Type.IsValueClass);

                result = DynamicInstance.FromField(fieldValue, field, Heap);

                return(true);
            }

            return(base.TryGetMember(binder, out result));
        }