Skip to content

Commit 2e903f9

Browse files
land-grab-in-space: fix
1 parent 2cb6b76 commit 2e903f9

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

exercises/concept/land-grab-in-space/LandGrabInSpaceTests.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,13 @@ public void GetLongestSideReverseInsertionOrder()
7474
private Plot CreatePlot(Coord coord1, Coord coord2, Coord coord3, Coord coord4)
7575
{
7676
Type plotType = typeof(Plot);
77-
Type[] types = new Type[] { typeof(Coord), typeof(Coord), typeof(Coord), typeof(Coord) };
78-
ConstructorInfo constructorInfoObj = plotType.GetConstructor(types);
77+
Type[] types = [typeof(Coord), typeof(Coord), typeof(Coord), typeof(Coord)];
78+
ConstructorInfo? constructorInfoObj = plotType.GetConstructor(types);
7979
if (constructorInfoObj != null)
8080
{
81-
return (Plot)constructorInfoObj.Invoke(new object[] { coord1, coord2, coord3, coord4 });
81+
return (Plot)constructorInfoObj.Invoke([coord1, coord2, coord3, coord4]);
8282
}
8383

84-
else
85-
{
86-
throw new InvalidOperationException("You need to implement a constructor for the struct Plot. The constructor must take 4 co-ordinates. No such constructor can be found.");
87-
}
84+
throw new InvalidOperationException("You need to implement a constructor for the struct Plot. The constructor must take 4 co-ordinates. No such constructor can be found.");
8885
}
8986
}

0 commit comments

Comments
 (0)