Beispiel #1
0
        /// <summary>
        /// Gets all the members of this type.
        /// Causes the underlying Assembly to be loaded if it is not already.
        /// </summary>
        public IEnumerable <IMemberData> GetMembers()
        {
            if (members == null)
            {
                var props            = Load().GetPropertiesTap();
                List <IMemberData> m = new List <IMemberData>(props.Length);
                foreach (var mem in props)
                {
                    try
                    {
                        if (mem.GetMethod != null && mem.GetMethod.GetParameters().Length > 0)
                        {
                            continue;
                        }

                        if (mem.SetMethod != null && mem.SetMethod.GetParameters().Length != 1)
                        {
                            continue;
                        }
                    }
                    catch
                    {
                        continue;
                    }

                    m.Add(MemberData.Create(mem));
                }

                foreach (var mem in Load().GetMethodsTap())
                {
                    if (mem.GetAttribute <BrowsableAttribute>()?.Browsable ?? false)
                    {
                        var member = MemberData.Create(mem);
                        m.Add(member);
                    }
                }
                members = m.ToArray();
            }
            return(members);
        }
Beispiel #2
0
 /// <summary> Creates an immutable instance of this class. </summary>
 public ResourceReference(object obj, PropertyInfo prop)
 {
     Instance = obj;
     Property = prop;
     Member   = MemberData.Create(prop);
 }