Skip to content

Commit b745768

Browse files
committed
Avoid unnecessarily defensive IsList() checks
In both `SetCollectionValueAsync()` and `InitializeCollection`, the `IsList()` check is redundant since it has already been checked in the calling `GetParameterAsync()` or `SetPropertyAsync()` respectively. As such, there's no value in checking it _again_ since these are private methods with known entry points.
1 parent 76f1e6f commit b745768

1 file changed

Lines changed: 0 additions & 12 deletions

File tree

OnTopic/Mapping/TopicMappingService.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -688,13 +688,6 @@ private static bool IsList(Type targetType) =>
688688
\-----------------------------------------------------------------------------------------------------------------------*/
689689
Contract.Requires(targetType, nameof(targetType));
690690

691-
/*------------------------------------------------------------------------------------------------------------------------
692-
| Escape clause if preconditions are not met
693-
\-----------------------------------------------------------------------------------------------------------------------*/
694-
if (!IsList(targetType)) {
695-
return (IList?)null;
696-
}
697-
698691
/*------------------------------------------------------------------------------------------------------------------------
699692
| Attempt to create specific type
700693
\-----------------------------------------------------------------------------------------------------------------------*/
@@ -763,11 +756,6 @@ MappedTopicCache cache
763756
Contract.Requires(configuration, nameof(configuration));
764757
Contract.Requires(cache, nameof(cache));
765758

766-
/*------------------------------------------------------------------------------------------------------------------------
767-
| Escape clause if preconditions are not met
768-
\-----------------------------------------------------------------------------------------------------------------------*/
769-
if (!IsList(configuration.Property.PropertyType)) return;
770-
771759
/*------------------------------------------------------------------------------------------------------------------------
772760
| Ensure target list is created
773761
\-----------------------------------------------------------------------------------------------------------------------*/

0 commit comments

Comments
 (0)