Exemple #1
0
        //===
        #region protected void InitializeStaticFields(...);
        protected void InitializeStaticFields(
            ref PropertyInfo[] properties_in,
            ref ClaSSPropertyAttribute[] attributes_in
            )
        {
            PropertyInfo[] _properties = inheritloopback_ref_.GetType().GetProperties(
                BindingFlags.Public |
                BindingFlags.Instance |
                BindingFlags.NonPublic
                );
            int _c = 0;

            for (int p = 0; p < _properties.Length; p++)
            {
                if (
                    Attribute.IsDefined(
                        _properties[p],
                        typeof(ClaSSPropertyAttribute)
                        )                 // all properties that have ClaSSPropertyAttribute attribute defined
                    )
                {
                    _c++;
                }
            }
            PropertyInfo[]           _properties2 = new PropertyInfo[_c];
            ClaSSPropertyAttribute[] _attribute2  = new ClaSSPropertyAttribute[_c];

            _c = 0;
            for (int p = 0; p < _properties.Length; p++)
            {
                if (
                    Attribute.IsDefined(
                        _properties[p],
                        typeof(ClaSSPropertyAttribute)                         // all properties that have ClaSSPropertyAttribute attribute defined
                        )
                    )
                {
                    _properties2[_c] = _properties[p];
                    _attribute2[_c]  = ((ClaSSPropertyAttribute[])Attribute.GetCustomAttributes(
                                            _properties[p],
                                            typeof(ClaSSPropertyAttribute)     // only ClaSSPropertyAttribute attributes, note that propertie can have more than one attribute defined
                                            ))[0];
                    _c++;
                }
            }

            // thread safe(r):
            properties_in = _properties2;
            attributes_in = _attribute2;
        }
Exemple #2
0
		public PropertyInfo Property_find(string name_in, ClaSSPropertyAttribute.eType type_in) {
			return classstateapi_.Property_find(name_in, type_in);
		}
Exemple #3
0
		public PropertyInfo Property_find(string name_in, ClaSSPropertyAttribute.eType type_in) {
			int _index = PropertyIndex_find(name_in, type_in);
			return (_index != -1) ? Properties[_index] : null;
		}
Exemple #4
0
		public int PropertyIndex_find(string name_in, ClaSSPropertyAttribute.eType type_in) {
			for (int a = 0; a < Attributes.Length; a++) {
				if (
					(Attributes[a].Name == name_in)
					&&
					(Attributes[a].Type == type_in)
				) {
					return a;
				}
			}

			return -1;
		}
Exemple #5
0
		//---
		#region public object Property_get(string name_in, ClaSSPropertyAttribute.eType type_in);
		public object Property_get(string name_in, ClaSSPropertyAttribute.eType type_in) {
			PropertyInfo _property = Property_find(name_in, type_in);
			if (_property == null) {
				return null;
			} else {
				return _property.GetValue(this, null);
			}
		}
Exemple #6
0
		//===
		#region protected void InitializeStaticFields(...);
		protected void InitializeStaticFields(
			ref PropertyInfo[] properties_in, 
			ref ClaSSPropertyAttribute[] attributes_in
		) {
			PropertyInfo[] _properties = inheritloopback_ref_.GetType().GetProperties(
				BindingFlags.Public | 
				BindingFlags.Instance | 
				BindingFlags.NonPublic
			);
			int _c = 0;
			for (int p = 0; p < _properties.Length; p++) {
				if (
					Attribute.IsDefined(
						_properties[p], 
						typeof(ClaSSPropertyAttribute)
					) // all properties that have ClaSSPropertyAttribute attribute defined
				) {
					_c++;
				}
			}
			PropertyInfo[] _properties2 = new PropertyInfo[_c];
			ClaSSPropertyAttribute[] _attribute2 = new ClaSSPropertyAttribute[_c];

			_c = 0;
			for (int p = 0; p < _properties.Length; p++) {
				if (
					Attribute.IsDefined(
						_properties[p], 
						typeof(ClaSSPropertyAttribute) // all properties that have ClaSSPropertyAttribute attribute defined
					)
				) {
					_properties2[_c] = _properties[p];
					_attribute2[_c] = ((ClaSSPropertyAttribute[])Attribute.GetCustomAttributes(
						_properties[p], 
						typeof(ClaSSPropertyAttribute) // only ClaSSPropertyAttribute attributes, note that propertie can have more than one attribute defined
					))[0];
					_c++;
				}
			}

			// thread safe(r):
			properties_in = _properties2;
			attributes_in = _attribute2;
		}