Exemple #1
0
        /// <summary>Returns all the available object properties found in the specified <seealso cref="LevelObjectCollection"/> from a starting hash set of available properties.</summary>
        /// <param name="collection">The collection whose all available object properties will be evaluated and returned.</param>
        /// <param name="startingDictionary">The starting dictionary of available properties that will be merged with the resulting hash set.</param>
        public static PropertyAccessInfoDictionary GetAllAvailableProperties(IEnumerable <GeneralObject> collection, PropertyAccessInfoDictionary startingDictionary)
        {
            var objectTypes = GetCollectionObjectTypeInfo(collection);

            PropertyAccessInfoDictionary result;

            if (collection != null)
            {
                result = new PropertyAccessInfoDictionary(startingDictionary);
            }
            else
            {
                result = new PropertyAccessInfoDictionary();
            }

            foreach (var t in objectTypes)
            {
                foreach (var p in t.Properties)
                {
                    result.Add(p.Value as PropertyAccessInfo);
                }
            }

            return(result);
        }
Exemple #2
0
        /// <summary>Returns the common properties found in the specified <seealso cref="LevelObjectCollection"/> from a starting list of common properties.</summary>
        /// <param name="collection">The collection whose common object properties will be evaluated and returned.</param>
        /// <param name="startingDictionary">The starting dictionary of common properties that will be merged with the resulting list.</param>
        public static PropertyAccessInfoDictionary GetCommonProperties(IEnumerable <GeneralObject> collection, PropertyAccessInfoDictionary startingDictionary)
        {
            var objectTypes = GetCollectionObjectTypeInfo(collection);

            KeyedPropertyInfoDictionary <int?> lockedDictionary;
            PropertyAccessInfoDictionary       result;

            if (collection != null)
            {
                result = new PropertyAccessInfoDictionary(lockedDictionary = startingDictionary);
            }
            else
            {
                result = new PropertyAccessInfoDictionary(lockedDictionary = objectTypes.First().Properties);
            }

            foreach (var t in objectTypes)
            {
                foreach (var p in lockedDictionary)
                {
                    if (!t.Properties.ContainsKey(p.Key))
                    {
                        result.Remove(p.Key);
                    }
                }
            }

            return(result);
        }