private void PopulateProperties() { if (knownProps != null) { return; } knownProps = new Dictionary <string, PropertyCache>(); PropertyInfo[] props = this.GetType().GetProperties(); foreach (var property in props) { CAFieldAttribute attr = (CAFieldAttribute)property.GetCustomAttributes(typeof(CAFieldAttribute), true).FirstOrDefault(); var propertyType = property.PropertyType; if (attr != null) { var propCache = new PropertyCache() { Info = property, IsContainer = false, }; if (propertyType.IsGenericType) { var genericTypeDef = propertyType.GetGenericTypeDefinition(); if (genericTypeDef == typeof(ReadOnlyCollection <>)) // For subArray implementation { propCache.IsContainer = true; } if (genericTypeDef == typeof(ArrayContainer <>)) // For array implementation { propCache.IsContainer = true; } } knownProps.Add(attr.Name.ToUpper(), propCache); } } }
private void PopulateProperties( ) { if (knownProps != null) { return; } knownProps = new Dictionary <string, PropertyInfo>(); PropertyInfo[] properties = this.GetType().GetProperties(); foreach (var propertyInfo in properties) { CAFieldAttribute fieldAttribute = (CAFieldAttribute)propertyInfo.GetCustomAttributes( typeof(CAFieldAttribute), true ).FirstOrDefault(); if (fieldAttribute != null) { knownProps.Add( fieldAttribute.Name.ToUpper(), propertyInfo ); } } }