Пример #1
0
        public static DOProperty_andAttribute[] getFromInstance(
            object doInstance_in
            )
        {
            DOProperty_andAttribute[] _dopropatt_out;
            PropertyInfo[]            _properties
                = doInstance_in.GetType().GetProperties(
                      BindingFlags.Public |
                      BindingFlags.Instance
                      );

            int _count = 0;

            for (int p = 0; p < _properties.Length; p++)
            {
                if (Attribute.IsDefined(
                        _properties[p],
                        typeof(DOPropertyAttribute)
                        ))
                {
                    _count++;
                }
            }

            _dopropatt_out = new DOProperty_andAttribute[_count];
            _count         = 0;
            for (int p = 0; p < _properties.Length; p++)
            {
                if (Attribute.IsDefined(
                        _properties[p],
                        typeof(DOPropertyAttribute)
                        ))
                {
                    _dopropatt_out[_count] = new DOProperty_andAttribute(
                        _properties[p],
                        (DOPropertyAttribute)(
                            Attribute.GetCustomAttributes(_properties[p])
                            )[0]
                        );

                    _count++;
                }
            }

            return(_dopropatt_out);
        }
Пример #2
0
		public static DOProperty_andAttribute[] getFromInstance(
			object doInstance_in
		) {
			DOProperty_andAttribute[] _dopropatt_out;
			PropertyInfo[] _properties
				= doInstance_in.GetType().GetProperties(
					BindingFlags.Public | 
					BindingFlags.Instance
				);

			int _count = 0;
			for (int p = 0; p < _properties.Length; p++) {
				if (Attribute.IsDefined(
					_properties[p],
					typeof(DOPropertyAttribute)
				)) {
					_count++;
				}
			}

			_dopropatt_out = new DOProperty_andAttribute[_count];
			_count = 0;
			for (int p = 0; p < _properties.Length; p++) {
				if (Attribute.IsDefined(
					_properties[p],
					typeof(DOPropertyAttribute)
				)) {
					_dopropatt_out[_count] = new DOProperty_andAttribute(
						_properties[p], 
						(DOPropertyAttribute)(
							Attribute.GetCustomAttributes(_properties[p])
						)[0]
					);

					_count++;
				}
			}

			return _dopropatt_out;
		}