public override IList <CustomAttributeData> GetCustomAttributesData() { return(CollectionServices.Empty <CustomAttributeData>()); }
public override int GetHashCode() { return(Name.GetHashCode() ^ DeclaringType.GetHashCode() ^ CollectionServices.GetArrayHashCode(GetParameterTypes())); }
public override object[] GetCustomAttributes(Type attributeType, bool inherit) { return(CollectionServices.IEnumerableToArray(AttributeUtils.FilterCustomAttributes(_attributes, attributeType), attributeType)); }
public override object[] GetCustomAttributes(bool inherit) { return(CollectionServices.IEnumerableToArray(_attributes, typeof(Attribute))); }
public override ParameterInfo[] GetParameters() { return(CollectionServices.Empty <ParameterInfo>()); }
public override object[] GetCustomAttributes(Type attributeType, bool inherit) { return(CollectionServices.Empty <object>()); }
private ICollection <object> GetNormalizedCollection(Type itemType, object instance) { Assumes.NotNull(itemType); object collectionObject = null; if (this._member.CanRead) { try { collectionObject = this._member.GetValue(instance); } catch (TargetInvocationException exception) { throw new ComposablePartException( CompositionErrorId.ReflectionModel_ImportCollectionGetThrewException, String.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_ImportCollectionGetThrewException, this._member.GetDisplayName()), this.Definition.ToElement(), exception.InnerException); } } if (collectionObject == null) { ConstructorInfo constructor = this.ImportType.ActualType.GetConstructor(new Type[0]); // If it contains a default public constructor create a new instance. if (constructor != null) { try { collectionObject = constructor.Invoke(new object[] { }); } catch (TargetInvocationException exception) { throw new ComposablePartException( CompositionErrorId.ReflectionModel_ImportCollectionConstructionThrewException, String.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_ImportCollectionConstructionThrewException, this._member.GetDisplayName(), this.ImportType.ActualType.FullName), this.Definition.ToElement(), exception.InnerException); } SetSingleMemberValue(instance, collectionObject); } } if (collectionObject == null) { throw new ComposablePartException( CompositionErrorId.ReflectionModel_ImportCollectionNull, String.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_ImportCollectionNull, this._member.GetDisplayName()), this.Definition.ToElement()); } return(CollectionServices.GetCollectionWrapper(itemType, collectionObject)); }
public override sealed Type[] GetGenericArguments() { return(CollectionServices.Empty <Type>()); }
private ICollection <object> GetNormalizedCollection(Type itemType, object instance) { if (itemType == null) { throw new ArgumentNullException(nameof(itemType)); } object collectionObject = null; if (_member.CanRead) { try { collectionObject = _member.GetValue(instance); } catch (TargetInvocationException exception) { throw new ComposablePartException( SR.Format( SR.ReflectionModel_ImportCollectionGetThrewException, _member.GetDisplayName()), Definition.ToElement(), exception.InnerException); } } if (collectionObject == null) { ConstructorInfo constructor = ImportType.ActualType.GetConstructor(Type.EmptyTypes); // If it contains a default public constructor create a new instance. if (constructor != null) { try { collectionObject = constructor.SafeInvoke(); } catch (TargetInvocationException exception) { throw new ComposablePartException( SR.Format( SR.ReflectionModel_ImportCollectionConstructionThrewException, _member.GetDisplayName(), ImportType.ActualType.FullName), Definition.ToElement(), exception.InnerException); } SetSingleMemberValue(instance, collectionObject); } } if (collectionObject == null) { throw new ComposablePartException( SR.Format( SR.ReflectionModel_ImportCollectionNull, _member.GetDisplayName()), Definition.ToElement()); } return(CollectionServices.GetCollectionWrapper(itemType, collectionObject)); }
public CollectionController() { collectionServices = new CollectionServices(); }
protected override Type[] GetParameterTypes() { return(CollectionServices.Empty <Type>()); }
public override object[] GetCustomAttributes(bool inherit) { return(CollectionServices.Empty <Attribute>()); }
public override sealed Type[] GetRequiredCustomModifiers() { return(CollectionServices.Empty <Type>()); }