Beispiel #1
0
        private SerializableType Build(Type type)
        {
            var properties = type.GetTypeInfo().GetProperties(PropertyFlags);

            UInt32 nextIndex = 1;

            var serializableProperties = new Dictionary <string, SerializableProperty>();

            foreach (var property in properties)
            {
                if (!_inspector.CanBeSerialized(type, property))
                {
                    continue;
                }
                if (serializableProperties.ContainsKey(property.Name))
                {
                    throw InvalidGraphException.DuplicateProperties(type, property);
                }

                var metadata = _inspector.AcquirePropertyMetadata(type, property, ref nextIndex);

                var ser = new SerializableProperty(property, metadata, Provider);
                serializableProperties.Add(property.Name, ser);
            }
            return(new SerializableType(type, serializableProperties));
        }