public override bool CanPopulate(Type type, string referenceName, LinkedList<object> buildChain)
{
if (type == null)
{
throw new ArgumentNullException(nameof(type));
}
if (IsReadOnlyType(type) == false)
{
return false;
}
var internalType = FindEnumerableTypeArgument(type);
if (internalType == null)
{
// The type does not implement IEnumerable<T>
return false;
}
if (IsUnsupportedType(type))
{
return false;
}
var genericTypeDefinition = typeof(ICollection<string>).GetGenericTypeDefinition();
var genericType = genericTypeDefinition.MakeGenericType(internalType);
if (genericType.IsAssignableFrom(type))
{
// The instance is ICollection<T> and therefore can be created by this type creator
return true;
}
return false;
}