public override ITarget Fetch(Type type) { if (!type.IsArray) { throw new ArgumentException($"This target container only supports array types - {type} is not an array type"); } var result = base.Fetch(type); if (result != null && !result.UseFallback) { return(result); } // check the array rank - if it's greater than 1, then we can't do anything if (type.GetArrayRank() != 1) { throw new ArgumentException($"Arrays of rank 2 cannot be injected automatically - {type} has a rank of {type.GetArrayRank()}"); } // TODO: see also EnumerableTargetContainer's Fetch method // TODO: look at subclassing a version of this which 'knows' about the // overriding container so that we can get rid of the forking here. if (Root is OverridingTargetContainer overridingContainer) { // if the result = overridingContainer.Parent.Fetch(type); if (!(result is ArrayTarget) && !(result?.UseFallback ?? true)) { return(result); } } return(ArrayTarget.Create(type)); }