public PropertyValueManaged(int id, Type valueType, object initialValue, Attribute[] attributes) { if ((initialValue != null) && (initialValue != DBNull.Value) && !valueType.IsInstanceOfType(initialValue)) { throw new Exception("The initial value supplied to create the property has the wrong type. It should be of type " + valueType); } mUnderlyingValue = initialValue; mUnderlyingType = valueType; Attributes = attributes; _propertyDescriptor = new ManagedPropertyDescriptor(this, attributes); }
public PropertyValueManaged(int id, Type valueType, object defaultValue, Attribute[] attributes) { if ((defaultValue != null) && (defaultValue.GetType() != valueType)) { throw new Exception("The initial value supplied to create the property has the wrong type. It should be of type " + valueType); } mUnderlyingValue = defaultValue; _targetInstance = this; _memberInfo = _targetInstance.GetType().GetProperty("UnderlyingValue", BindingFlags.Instance | BindingFlags.NonPublic); mUnderlyingType = valueType; Attributes = attributes; _propertyDescriptor = new ManagedPropertyDescriptor(this, attributes); }
public PropertyValueManaged(int id, Type valueType, object initialValue, Attribute[] attributes) { if ((initialValue != null) && (initialValue != DBNull.Value) && !valueType.IsInstanceOfType(initialValue)) throw new Exception("The initial value supplied to create the property has the wrong type. It should be of type " + valueType); mUnderlyingValue = initialValue; mUnderlyingType = valueType; Attributes = attributes; _propertyDescriptor = new ManagedPropertyDescriptor(this, attributes); }
public PropertyValueManaged(int id, Type valueType, object defaultValue, Attribute[] attributes) { if ((defaultValue != null) && (defaultValue.GetType() != valueType)) throw new Exception("The initial value supplied to create the property has the wrong type. It should be of type " + valueType); mUnderlyingValue = defaultValue; _targetInstance = this; _memberInfo = _targetInstance.GetType().GetProperty("UnderlyingValue", BindingFlags.Instance | BindingFlags.NonPublic); mUnderlyingType = valueType; Attributes = attributes; _propertyDescriptor = new ManagedPropertyDescriptor(this, attributes); }