コード例 #1
0
        private static List <PropertyData> GetProperties(Type type)
        {
            var properties = new List <PropertyData>();

            foreach (PropertyInfo propertyInfo in type.GetProperties())
            {
                PacketIndexAttribute packetIndexAttribute = propertyInfo.GetCustomAttribute <PacketIndexAttribute>();
                if (packetIndexAttribute == null)
                {
                    continue;
                }

                properties.Add(new PropertyData
                {
                    PropertyType         = propertyInfo.PropertyType,
                    PacketIndexAttribute = packetIndexAttribute,
                    Setter = FastReflection.GetPropertySetter(type, propertyInfo),
                    Getter = FastReflection.GetPropertyGetter(type, propertyInfo)
                });
            }

            return(properties);
        }