public ConstantValue GetPropertyValue(string name) { PropertyInfo property = attrib.GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.Public); if (property != null && ReflectorAttributeUtils.IsAttributeProperty(Reflector.Wrap(property))) { return(ConstantValue.FromNative(property.GetValue(attrib, null))); } throw new ArgumentException(String.Format("The attribute does not have a writable instance property named '{0}'.", name)); }
/// <inheritdoc /> public ConstantValue GetPropertyValue(string name) { if (name == null) { throw new ArgumentNullException("name"); } foreach (KeyValuePair <StaticPropertyWrapper, ConstantValue> entry in PropertyArguments) { if (entry.Key.Name == name) { return(entry.Value); } } IPropertyInfo property = Type.GetProperty(name, BindingFlags.Public | BindingFlags.Instance); if (property != null && ReflectorAttributeUtils.IsAttributeProperty(property)) { return(ConstantValue.FromNative(ReflectionUtils.GetDefaultValue(property.ValueType.TypeCode))); } throw new ArgumentException(String.Format("The attribute does not have a writable instance property named '{0}'.", name)); }