Exemplo n.º 1
0
        /// <summary>
        /// Initializes the current type.
        /// </summary>
        void InitializeType(SharedReflectionManager reflectionManager)
        {
            using (_ObjectParseCompletion)
            {
                List <SharedPropertyInfo> properties = new List <SharedPropertyInfo>();
                Dictionary <String, DependencyProperty> propertyLookup = DependencyType.GetDependencyType(Type, false).Properties.ToDictionary(p => p.Name);

                // Go through all declared properties and generate the property infos
                foreach (PropertyInfo item in Type.DeclaredProperties)
                {
                    propertyLookup.TryGetValue(item.Name, out DependencyProperty dependencyProperty);
                    properties.Add(new SharedPropertyInfo(reflectionManager, this, item, dependencyProperty, DefaultValue));
                }
                // Assign properties to the object
                _DeclaredProperties       = properties.ToImmutableArray();
                _DeclaredPropertiesLookup = _DeclaredProperties.ToImmutableDictionary(p => p.Name);

                // Set parsing to finished
                _ObjectParseCompletion.Set();
            }
            _ObjectParseCompletion = null;
        }