private static bool IsReadOnlyType(Type type)
{
// Check if the type is a ReadOnly type
// We can't check for the implementation of IReadOnlyCollection<T> because this was introduced in .Net 4.5
// however this library targets 4.0
if (type.Name.Contains("ReadOnly"))
{
// Looks like this is read only type
// This covers ReadOnlyCollection in .Net 4.0 and above
// and also covers IReadOnlyCollection<T> and IReadOnlyList<T> in .net 4.5 and above
return false;
}
return true;
}