Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/SubMechanismIllustrationPointProperties.cs
===================================================================
diff -u -r71120734f3b9d5c38815221bb43be01eb2aa56b7 -r390c486bb4cd693ae2f2eaf82a30efcb51480048
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/SubMechanismIllustrationPointProperties.cs (.../SubMechanismIllustrationPointProperties.cs) (revision 71120734f3b9d5c38815221bb43be01eb2aa56b7)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/SubMechanismIllustrationPointProperties.cs (.../SubMechanismIllustrationPointProperties.cs) (revision 390c486bb4cd693ae2f2eaf82a30efcb51480048)
@@ -36,6 +36,8 @@
[TypeConverter(typeof(ExpandableObjectConverter))]
public class SubMechanismIllustrationPointProperties : IllustrationPointProperties
{
+ private readonly SubMechanismIllustrationPoint subMechanismIllustrationPoint;
+
///
/// Creates a new instance of .
///
@@ -44,14 +46,17 @@
/// String containing the name of the closing situation. If empty
/// the property will not be visible.
/// Thrown when any input parameter is null.
- /// Thrown when the illustration point node is not of type .
+ /// Thrown when is not of type .
public SubMechanismIllustrationPointProperties(
IllustrationPointNode illustrationPointNode, string windDirection, string closingSituation) : base(illustrationPointNode, windDirection, closingSituation)
{
- if (!(data.Data is SubMechanismIllustrationPoint))
+ var illustrationPoint = data.Data as SubMechanismIllustrationPoint;
+ if (illustrationPoint == null)
{
- throw new ArgumentException("illustrationPointNode type has to be SubMechanismIllustrationPoint");
+ throw new ArgumentException($"{nameof(illustrationPointNode)} type has to be {nameof(SubMechanismIllustrationPoint)}");
}
+
+ subMechanismIllustrationPoint = illustrationPoint;
}
[PropertyOrder(4)]
@@ -64,7 +69,7 @@
{
get
{
- return ((SubMechanismIllustrationPoint) data.Data).Stochasts.ToArray();
+ return subMechanismIllustrationPoint.Stochasts.ToArray();
}
}
@@ -78,7 +83,7 @@
{
get
{
- return ((SubMechanismIllustrationPoint) data.Data).Stochasts.ToArray();
+ return subMechanismIllustrationPoint.Stochasts.ToArray();
}
}
@@ -92,7 +97,7 @@
{
get
{
- return ((SubMechanismIllustrationPoint) data.Data).Stochasts.ToArray();
+ return subMechanismIllustrationPoint.Stochasts.ToArray();
}
}
}