Index: Core/Common/src/Core.Common.Util/EnumTypeConverter.cs
===================================================================
diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -r73c16172f7ad09035b4c4eba030adccb1aa330c9
--- Core/Common/src/Core.Common.Util/EnumTypeConverter.cs (.../EnumTypeConverter.cs) (revision ac96d7c315129af851634ed5a4a6800b59ede718)
+++ Core/Common/src/Core.Common.Util/EnumTypeConverter.cs (.../EnumTypeConverter.cs) (revision 73c16172f7ad09035b4c4eba030adccb1aa330c9)
@@ -46,15 +46,19 @@
var valueString = value as string;
if (valueString != null)
{
- foreach (FieldInfo fieldInfo in EnumType.GetFields().Where(fieldInfo => valueString == GetDisplayName(fieldInfo, fieldInfo.Name)))
+ FieldInfo fieldInfo = EnumType.GetFields().FirstOrDefault(info => valueString == GetDisplayName(info, info.Name));
+
+ if (fieldInfo == null)
{
- return Enum.Parse(EnumType, fieldInfo.Name);
+ throw new FormatException(string.Format(CultureInfo.CurrentCulture,
+ Resources.ConvertFrom_Only_following_values_are_accepted_ParameterValues_0_,
+ string.Join(", ", EnumType.GetFields(BindingFlags.Public | BindingFlags.Static)
+ .Select(fi => GetDisplayName(fi, fi.Name)))));
}
- throw new FormatException(string.Format(CultureInfo.CurrentCulture,
- Resources.ConvertFrom_Only_following_values_are_accepted_ParameterValues_0_,
- string.Join(", ", EnumType.GetFields(BindingFlags.Public | BindingFlags.Static)
- .Select(fi => GetDisplayName(fi, fi.Name)))));
+
+ return Enum.Parse(EnumType, fieldInfo.Name);
}
+
return base.ConvertFrom(context, culture, value);
}
@@ -64,6 +68,7 @@
{
return base.ConvertTo(context, culture, value, destinationType);
}
+
string valueString = value.ToString();
FieldInfo fieldInfo = EnumType.GetField(valueString);
return fieldInfo != null ? GetDisplayName(fieldInfo, valueString) : string.Empty;
Index: Core/Common/src/Core.Common.Util/NullableEnumConverter.cs
===================================================================
diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -r73c16172f7ad09035b4c4eba030adccb1aa330c9
--- Core/Common/src/Core.Common.Util/NullableEnumConverter.cs (.../NullableEnumConverter.cs) (revision ac96d7c315129af851634ed5a4a6800b59ede718)
+++ Core/Common/src/Core.Common.Util/NullableEnumConverter.cs (.../NullableEnumConverter.cs) (revision 73c16172f7ad09035b4c4eba030adccb1aa330c9)
@@ -47,14 +47,18 @@
{
throw new NotSupportedException("Cannot convert from (null).");
}
+
var valueString = value as string;
if (valueString != null)
{
- foreach (FieldInfo fieldInfo in UnderlyingType.GetFields().Where(fieldInfo => valueString == GetDisplayName(fieldInfo)))
+ FieldInfo fieldInfo = UnderlyingType.GetFields().FirstOrDefault(info => valueString == GetDisplayName(info));
+
+ if (fieldInfo != null)
{
return Enum.Parse(UnderlyingType, fieldInfo.Name);
}
}
+
return base.ConvertFrom(context, culture, value);
}
Index: Core/Components/src/Core.Components.GraphSharp/Data/PointedTreeElementVertex.cs
===================================================================
diff -u -rf46ba440e51db6e6cb1c02375b6afa771eb94570 -r73c16172f7ad09035b4c4eba030adccb1aa330c9
--- Core/Components/src/Core.Components.GraphSharp/Data/PointedTreeElementVertex.cs (.../PointedTreeElementVertex.cs) (revision f46ba440e51db6e6cb1c02375b6afa771eb94570)
+++ Core/Components/src/Core.Components.GraphSharp/Data/PointedTreeElementVertex.cs (.../PointedTreeElementVertex.cs) (revision 73c16172f7ad09035b4c4eba030adccb1aa330c9)
@@ -47,23 +47,15 @@
/// The line width of the vertex.
/// The type of the vertex.
/// Indicator whether the vertex is selectable.
- /// Thrown when
- /// or is null.
+ /// Thrown when is null.
public PointedTreeElementVertex(string content, Color fillColor, Color lineColor, int lineWidth,
PointedTreeVertexType type, bool isSelectable)
{
if (content == null)
{
throw new ArgumentNullException(nameof(content));
}
- if (fillColor == null)
- {
- throw new ArgumentNullException(nameof(fillColor));
- }
- if (lineColor == null)
- {
- throw new ArgumentNullException(nameof(lineColor));
- }
+
Content = content;
FillColor = new SolidColorBrush(fillColor);
LineColor = new SolidColorBrush(lineColor);
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/RingtoetsMapControl.cs
===================================================================
diff -u -rfcad48d7beb394e1ac15cfe4289a7381e05aa883 -r73c16172f7ad09035b4c4eba030adccb1aa330c9
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/RingtoetsMapControl.cs (.../RingtoetsMapControl.cs) (revision fcad48d7beb394e1ac15cfe4289a7381e05aa883)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/RingtoetsMapControl.cs (.../RingtoetsMapControl.cs) (revision 73c16172f7ad09035b4c4eba030adccb1aa330c9)
@@ -81,9 +81,7 @@
backgroundDataObserver.Observable = backgroundData;
mapControl.Data = data;
- mapControl.BackgroundMapData = backgroundData != null
- ? BackgroundDataConverter.ConvertFrom(backgroundData)
- : null;
+ mapControl.BackgroundMapData = BackgroundDataConverter.ConvertFrom(backgroundData);
}
///