Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SensorPlLine1Creator.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SensorPlLine1Creator.cs (.../SensorPlLine1Creator.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SensorPlLine1Creator.cs (.../SensorPlLine1Creator.cs) (revision 4053) @@ -53,7 +53,7 @@ return value.Value; } - string message = string.Format("Polder level at river for the location '{0}' was not set or initialized", SensorLocation.LocationName); + string message = $"Polder level at river for the location '{SensorLocation.LocationName}' was not set or initialized"; throw new PlLinesCreatorException(message); } @@ -388,7 +388,7 @@ return value.Value; } - string message = string.Format("Water level at river for the location '{0}' was not set or initialized", SensorLocation.LocationName); + string message = $"Water level at river for the location '{SensorLocation.LocationName}' was not set or initialized"; throw new PlLinesCreatorException(message); } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/BishopGridCreator.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/BishopGridCreator.cs (.../BishopGridCreator.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/BishopGridCreator.cs (.../BishopGridCreator.cs) (revision 4053) @@ -113,7 +113,7 @@ { if (!(distance > 0)) { - throw new ArgumentException(string.Format("Vertical distance should be > 0 but is {0}", distance)); + throw new ArgumentException($"Vertical distance should be > 0 but is {distance}"); } double topOfBottomLayer = soilProfile1D.Layers.Last().TopLevel; Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/UniqueNameProvider.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/UniqueNameProvider.cs (.../UniqueNameProvider.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/UniqueNameProvider.cs (.../UniqueNameProvider.cs) (revision 4053) @@ -61,7 +61,7 @@ string newName = item.Name; while (NameExists(collection, item, newName)) { - newName = newName.Replace(string.Format("({0})", indexer), string.Format("({0})", ++indexer)); + newName = newName.Replace($"({indexer})", $"({++indexer})"); } item.Name = newName; Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/Sensors/Sensor.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/Sensors/Sensor.cs (.../Sensor.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/Sensors/Sensor.cs (.../Sensor.cs) (revision 4053) @@ -317,8 +317,7 @@ { string name = string.IsNullOrWhiteSpace(Name) ? "name_not_set" : Name; - return string.Format("[ID: {0}, Name: {1}, Depth: {2}, Type: {3}, RelativeLocation: {4}]", - ID, name, Depth, SensorType, RelativeLocation); + return $"[ID: {ID}, Name: {name}, Depth: {Depth}, Type: {SensorType}, RelativeLocation: {RelativeLocation}]"; } private List ParseStringToPlLineTypes(string value) Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/Segment.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/Segment.cs (.../Segment.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/Segment.cs (.../Segment.cs) (revision 4053) @@ -123,11 +123,11 @@ { if (spp.SoilProfile1D != null) { - sb.Append(String.Format("(1D) {0} ({1}%) ", spp.SoilProfile1D.Name, spp.Probability)); + sb.Append($"(1D) {spp.SoilProfile1D.Name} ({spp.Probability}%) "); } else { - sb.Append(String.Format("(2D) {0} ({1}%) ", spp.StiFileName, spp.Probability)); + sb.Append($"(2D) {spp.StiFileName} ({spp.Probability}%) "); } //#Bka: should be adapted for WtiStability where 2D profiles are used. } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/UpliftVanGridCreator.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/UpliftVanGridCreator.cs (.../UpliftVanGridCreator.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/UpliftVanGridCreator.cs (.../UpliftVanGridCreator.cs) (revision 4053) @@ -127,7 +127,7 @@ { if (!(distance > 0)) { - throw new ArgumentException(String.Format("Vertical distance should be > 0 but is {0}", distance)); + throw new ArgumentException($"Vertical distance should be > 0 but is {distance}"); } double topOfBottomLayer = soilProfile1D.Layers.Last().TopLevel; Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 4053) @@ -573,7 +573,7 @@ relevantAquiferLayer = actualSoilProfile.InBetweenAquiferLayer; // Intermediate sand layer break; default: - throw new PlLinesCreatorException(String.Format("Invalid PL line type:{0} for creation of PL Line 3 or 4", type)); + throw new PlLinesCreatorException($"Invalid PL line type:{type} for creation of PL Line 3 or 4"); } // Note : DAM already handles a missing (null) InBetweenAquiferLayer itself so do not throw for that. @@ -1086,8 +1086,7 @@ } else { - throw new PlLinesCreatorException(String.Format("Gauge PL line {0} refers to an unknown gauge named '{1}' at X coordinate #{2}.", - gaugePlLine.PlLineType.ToString(), gaugePlLinePoint.GaugeIDX, pointIndex)); + throw new PlLinesCreatorException($"Gauge PL line {gaugePlLine.PlLineType.ToString()} refers to an unknown gauge named '{gaugePlLinePoint.GaugeIDX}' at X coordinate #{pointIndex}."); } } @@ -1098,28 +1097,26 @@ { if ((!gauge.Value.HasValue) || (gauge.Value == GaugeMissVal)) { - throw new PlLinesCreatorException(String.Format("Value of gauge {0} at location {1} in gauge PL line of type {2} is undefined.", - gauge.Name, location.Name, gaugePlLine.PlLineType.ToString())); + throw new PlLinesCreatorException($"Value of gauge {gauge.Name} at location {location.Name} in gauge PL line of type {gaugePlLine.PlLineType.ToString()} is undefined."); } localZ = gauge.Value; } else { - throw new PlLinesCreatorException(String.Format("Gauge PL line {0} refers to an unknown gauge named '{1}' at Z coordinate #{2}.", - gaugePlLine.PlLineType.ToString(), gaugePlLinePoint.GaugeIDZ, pointIndex)); + throw new PlLinesCreatorException($"Gauge PL line {gaugePlLine.PlLineType.ToString()} refers to an unknown gauge named '{gaugePlLinePoint.GaugeIDZ}' at Z coordinate #{pointIndex}."); } } } if (!localX.HasValue) { - throw new PlLinesCreatorException(String.Format("Gauge PL line {0}'s X coordinate #{1} is undefined.", gaugePlLine.PlLineType.ToString(), pointIndex)); + throw new PlLinesCreatorException($"Gauge PL line {gaugePlLine.PlLineType.ToString()}'s X coordinate #{pointIndex} is undefined."); } if (!localZ.HasValue) { - throw new PlLinesCreatorException(String.Format("Gauge PL line {0}'s value #{1} is undefined.", gaugePlLine.PlLineType.ToString(), pointIndex)); + throw new PlLinesCreatorException($"Gauge PL line {gaugePlLine.PlLineType.ToString()}'s value #{pointIndex} is undefined."); } if (!leftMostXAtRiverLevel.HasValue || localX > leftMostXAtRiverLevel) @@ -1795,7 +1792,7 @@ double dikeTopAtRiverHeight = surfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Z; if (waterLevelRiver > dikeTopAtRiverHeight) { - throw new PlLinesCreatorException(String.Format("Phreatic water level should have an intersection with the dike at least once (phreatic line higher ({0:F2} m) than surface line ({1:F2}))", waterLevelRiver, dikeTopAtRiverHeight)); + throw new PlLinesCreatorException($"Phreatic water level should have an intersection with the dike at least once (phreatic line higher ({waterLevelRiver:F2} m) than surface line ({dikeTopAtRiverHeight:F2}))"); } } @@ -1807,7 +1804,7 @@ double dikeTopPolder = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z; if (WaterLevelPolder > dikeTopPolder) { - throw new PlLinesCreatorException(String.Format("Waterlevel ({0:0.00}) in polder higher than dike top at polder ({1:0.00}) in surfaceline {2}", WaterLevelPolder, dikeTopPolder, SurfaceLine.Name)); + throw new PlLinesCreatorException($"Waterlevel ({WaterLevelPolder:0.00}) in polder higher than dike top at polder ({dikeTopPolder:0.00}) in surfaceline {SurfaceLine.Name}"); } } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs (.../MacroStabilityIoTests.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs (.../MacroStabilityIoTests.cs) (revision 4053) @@ -355,7 +355,7 @@ foreach (Soil expectedSoil in expectedSoils.Soils) { Soil actualSoil = actualSoils.Soils.SingleOrDefault(soil => soil.Name.Equals(expectedSoil.Name)); - Assert.IsNotNull(actualSoil, string.Format("Soil {0} not found", expectedSoil.Name)); + Assert.IsNotNull(actualSoil, $"Soil {expectedSoil.Name} not found"); var compare = new CompareLogic { Config = Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/Dike.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/Dike.cs (.../Dike.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/Dike.cs (.../Dike.cs) (revision 4053) @@ -233,8 +233,7 @@ { if (location.Scenarios.Count > 1) { - throw new DikeException(string.Format( - "For Operational (DamLive), location {0} has {1} scenarios but only one is allowed!", location.Name, location.Scenarios.Count)); + throw new DikeException($"For Operational (DamLive), location {location.Name} has {location.Scenarios.Count} scenarios but only one is allowed!"); } if (location.SensorLocation != null) @@ -243,9 +242,7 @@ { if (sensorArray.RelativeLocation < 0) { - throw new DikeException(string.Format( - "For Operational (DamLive), location {0} has sensor which are not relative to the starting point.", - location.Name)); + throw new DikeException($"For Operational (DamLive), location {location.Name} has sensor which are not relative to the starting point."); } } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/Geometry2DSectionAssembler.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/Geometry2DSectionAssembler.cs (.../Geometry2DSectionAssembler.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/Geometry2DSectionAssembler.cs (.../Geometry2DSectionAssembler.cs) (revision 4053) @@ -203,7 +203,7 @@ var layerElement = new XElement(tnsa + XMLAttributes.XmlElementLayer); layersElement.Add(layerElement); - layerElement.Add(new XAttribute(XMLAttributes.XmlAttributeID, String.Format("{0}", layer.Name))); + layerElement.Add(new XAttribute(XMLAttributes.XmlAttributeID, $"{layer.Name}")); layerElement.Add(new XAttribute(XMLAttributes.XmlAttributeSoilID, layer.Soil.Name)); layerElement.Add(new XAttribute(XMLAttributes.XmlAttributeTopLevel, layer.TopLevel)); } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs (.../SurfaceLine2Extensions.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs (.../SurfaceLine2Extensions.cs) (revision 4053) @@ -668,17 +668,13 @@ GeometryPoint dikeTopAtRiver = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); if (level > dikeTopAtRiver.Z) { - throw new SurfaceLineException(String.Format( - "Level ({0:F2} m) should NOT be higher than surface line ({1:F2}))", - level, dikeTopAtRiver.Z)); + throw new SurfaceLineException($"Level ({level:F2} m) should NOT be higher than surface line ({dikeTopAtRiver.Z:F2}))"); } } private static void ThrowWhenLevelBelowDikeToeDike(double levelDikeToeRiverSide, double riverLevel) { - throw new SurfaceLineException(String.Format( - "River level ({0:F2} m) should be higher than dike toe at river side ({1:F2}))", - riverLevel, levelDikeToeRiverSide)); + throw new SurfaceLineException($"River level ({riverLevel:F2} m) should be higher than dike toe at river side ({levelDikeToeRiverSide:F2}))"); } #endregion Private methods Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/SoilGeometryProbability.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/SoilGeometryProbability.cs (.../SoilGeometryProbability.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/SoilGeometryProbability.cs (.../SoilGeometryProbability.cs) (revision 4053) @@ -123,7 +123,7 @@ soilProfile1D = SoilProfile2D.GetSoilProfile1D(xCoordinate); break; default: - throw new NotSupportedException(String.Format("{0} not supported", SoilProfileType)); + throw new NotSupportedException($"{SoilProfileType} not supported"); } return soilProfile1D; Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/DamFailureMechanismeCalculationSpecification.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/DamFailureMechanismeCalculationSpecification.cs (.../DamFailureMechanismeCalculationSpecification.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/DamFailureMechanismeCalculationSpecification.cs (.../DamFailureMechanismeCalculationSpecification.cs) (revision 4053) @@ -185,12 +185,12 @@ public override string ToString() { var description = ""; - description += String.Format("{0}", FailureMechanismSystemType); + description += $"{FailureMechanismSystemType}"; if ((FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside) || (FailureMechanismSystemType == FailureMechanismSystemType.StabilityOutside)) { //interface? - description += String.Format(" ({0})", FailureMechanismParametersMStab.MStabParameters.Model); + description += $" ({FailureMechanismParametersMStab.MStabParameters.Model})"; } return description; Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/PlLinesHelper.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/PlLinesHelper.cs (.../PlLinesHelper.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/PlLinesHelper.cs (.../PlLinesHelper.cs) (revision 4053) @@ -64,8 +64,7 @@ plLines = CreatePlLinesForStabilitySensors(location, sensorPlLineCreatorSettings); break; default: - throw new NotImplementedException(string.Format(@"Pl-line creation method '{0}' is not implemented", - location.ModelParametersForPlLines.PlLineCreationMethod)); + throw new NotImplementedException($@"Pl-line creation method '{location.ModelParametersForPlLines.PlLineCreationMethod}' is not implemented"); } return plLines; Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillEngineFromMacroStabilityWrapperInput.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillEngineFromMacroStabilityWrapperInput.cs (.../FillEngineFromMacroStabilityWrapperInput.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillEngineFromMacroStabilityWrapperInput.cs (.../FillEngineFromMacroStabilityWrapperInput.cs) (revision 4053) @@ -112,9 +112,7 @@ { if (kernelUniformLoads.Count > 1) { - throw new ArgumentException(string.Format( - "Trafficload cannot be constructed because there are too many uniform loads defined ({0}", - kernelUniformLoads.Count)); + throw new ArgumentException($"Trafficload cannot be constructed because there are too many uniform loads defined ({kernelUniformLoads.Count}"); } UniformLoad kernelUniformLoad = kernelUniformLoads.First(); Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/ObjectExtensions.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/ObjectExtensions.cs (.../ObjectExtensions.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/ObjectExtensions.cs (.../ObjectExtensions.cs) (revision 4053) @@ -407,7 +407,7 @@ if (type.IsValueType && !IsNullable(type)) { throw new ArgumentNullException( - string.Format("The value can't be null because parameter type {0} is a value type", type)); + $"The value can't be null because parameter type {type} is a value type"); } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/AssemblyExtensions.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/AssemblyExtensions.cs (.../AssemblyExtensions.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/AssemblyExtensions.cs (.../AssemblyExtensions.cs) (revision 4053) @@ -38,8 +38,7 @@ Assembly assembly = Assembly.Load(assemblyName); if (assembly == null) { - throw new ArgumentException(string.Format("The assembly with name '{0}' couldnt be loaded", - assemblyName)); + throw new ArgumentException($"The assembly with name '{assemblyName}' couldnt be loaded"); } return assembly.GetEmbeddedFile(assemblyName + "." + fileName); @@ -81,7 +80,7 @@ } Assembly assembly = type.Assembly; - string resource = string.Format("{0}.{1}.{2}", type.Namespace, folder, resourceName); + string resource = $"{type.Namespace}.{folder}.{resourceName}"; Stream stream = assembly.GetManifestResourceStream(resource); if (stream == null) Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCorePipingCalculationTests.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCorePipingCalculationTests.cs (.../MultiCorePipingCalculationTests.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCorePipingCalculationTests.cs (.../MultiCorePipingCalculationTests.cs) (revision 4053) @@ -98,7 +98,7 @@ DesignResult multiCoreResult = outputMultiCore.Results.CalculationResults.Where(x => x.LocationName.Equals(oneCoreResult.LocationName) && x.ProfileName.Equals(oneCoreResult.ProfileName)).FirstOrDefault(); if (multiCoreResult == null) { - string diffString = String.Format("No mutlicore result in location '{0}', soilprofile '{1}'", oneCoreResult.LocationName, oneCoreResult.ProfileName); + string diffString = $"No mutlicore result in location '{oneCoreResult.LocationName}', soilprofile '{oneCoreResult.ProfileName}'"; differencesStringBuilder.AppendLine(diffString); differences.Add(diffString); } @@ -124,7 +124,7 @@ if (Math.Abs(safetyFactorSingleCore - safetyFactorMultiCore) > tolerance) { - string diffString = String.Format("Different result in location '{0}', soilprofile '{1}': 1 core = {2}, multicore = {3}", oneCoreResult.LocationName, oneCoreResult.ProfileName, oneCoreResult.PipingDesignResults.BlighFactor, multiCoreResult.PipingDesignResults.BlighFactor); + string diffString = $"Different result in location '{oneCoreResult.LocationName}', soilprofile '{oneCoreResult.ProfileName}': 1 core = {oneCoreResult.PipingDesignResults.BlighFactor}, multicore = {multiCoreResult.PipingDesignResults.BlighFactor}"; differencesStringBuilder.AppendLine(diffString); differences.Add(diffString); } @@ -136,6 +136,6 @@ private string DetermineOutputFilename(string prefix, string modelType, int coreCount, string extension = ".xml") { - return String.Format("{0}_{1}_{2}core_OutputFile{3}", prefix, modelType, coreCount, extension); + return $"{prefix}_{modelType}_{coreCount}core_OutputFile{extension}"; } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/ConversionHelper.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/ConversionHelper.cs (.../ConversionHelper.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/ConversionHelper.cs (.../ConversionHelper.cs) (revision 4053) @@ -119,7 +119,7 @@ { if (searchAlgorithm != SearchAlgorithm.Grid && searchAlgorithm != SearchAlgorithm.Genetic && searchAlgorithm != SearchAlgorithm.Beeswarm) { - throw new ArgumentException(String.Format("Unsupported search algorithm: {0}", searchAlgorithm)); + throw new ArgumentException($"Unsupported search algorithm: {searchAlgorithm}"); } var translationTable = new Dictionary @@ -190,7 +190,7 @@ // For the Macrostability kernel, the only supported options for now are Bishop and UpliftVan. if (mStabModelType != MStabModelType.UpliftVan && mStabModelType != MStabModelType.Bishop) { - throw new ArgumentException(string.Format("Unsupported MStabModelType: {0}", mStabModelType)); + throw new ArgumentException($"Unsupported MStabModelType: {mStabModelType}"); } var translationTable = new Dictionary @@ -214,7 +214,7 @@ // For the Macrostability kernel, the only supported options for now are Bishop and UpliftVan. if (mStabModelType != MStabModelType.Bishop && mStabModelType != MStabModelType.UpliftVan) { - throw new ArgumentException(string.Format("Unsupported MStabModelType: {0}", mStabModelType)); + throw new ArgumentException($"Unsupported MStabModelType: {mStabModelType}"); } var translationTable = new Dictionary @@ -360,7 +360,7 @@ } else { - throw new FormatException(string.Format("Cannot determine DilatancyType; Dilatancy = {0}, FrictionAngle = {1}", soil.Dilatancy, soil.FrictionAngle)); + throw new FormatException($"Cannot determine DilatancyType; Dilatancy = {soil.Dilatancy}, FrictionAngle = {soil.FrictionAngle}"); } return damSoil; @@ -394,7 +394,7 @@ damShearStrengthModel == ShearStrengthModel.SuGradient || damShearStrengthModel == ShearStrengthModel.SuMeasured || damShearStrengthModel == ShearStrengthModel.CPhiOrSuCalculated) { - throw new ArgumentException(string.Format("Cannot convert dam ShearStrengthModel: {0}", damShearStrengthModel)); + throw new ArgumentException($"Cannot convert dam ShearStrengthModel: {damShearStrengthModel}"); } var translationTable = new Dictionary Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/Assemblers/Geometry2DSectionAssemblerTest.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/Assemblers/Geometry2DSectionAssemblerTest.cs (.../Geometry2DSectionAssemblerTest.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/Assemblers/Geometry2DSectionAssemblerTest.cs (.../Geometry2DSectionAssemblerTest.cs) (revision 4053) @@ -136,8 +136,8 @@ select element).Single(); // Database - Assert.AreEqual(geometry2DSectionParameters.SoilGeometry2DName, inputElement.AttributeAs(Geometry2DSectionAssembler.XmlAttributeSoilGeometry2DFilename), String.Format("{0}", Geometry2DSectionAssembler.XmlAttributeSoilGeometry2DFilename)); - Assert.AreEqual(geometry2DSectionParameters.XCoordinateSection, inputElement.AttributeAs(Geometry2DSectionAssembler.XmlAttributeXCoordinateSection), String.Format("{0}", Geometry2DSectionAssembler.XmlAttributeXCoordinateSection)); + Assert.AreEqual(geometry2DSectionParameters.SoilGeometry2DName, inputElement.AttributeAs(Geometry2DSectionAssembler.XmlAttributeSoilGeometry2DFilename), $"{Geometry2DSectionAssembler.XmlAttributeSoilGeometry2DFilename}"); + Assert.AreEqual(geometry2DSectionParameters.XCoordinateSection, inputElement.AttributeAs(Geometry2DSectionAssembler.XmlAttributeXCoordinateSection), $"{Geometry2DSectionAssembler.XmlAttributeXCoordinateSection}"); // Profile IEnumerable soilProfileCollectionElements = from element in doc.Root.Descendants() @@ -148,14 +148,14 @@ XElement soilProfileElement = soilProfileCollectionElements.Single(); - Assert.IsNotNull(soilProfileElement.Attribute(XMLAttributes.XmlAttributeName), String.Format("{0}", XMLAttributes.XmlAttributeName)); - Assert.AreEqual(geometry2DSectionParameters.SoilProfile.Name, soilProfileElement.AttributeAs(XMLAttributes.XmlAttributeName), String.Format("{0}", XMLAttributes.XmlAttributeName)); - Assert.IsNotNull(soilProfileElement.Attribute(XMLAttributes.XmlAttributeXCoordinate), String.Format("{0}", XMLAttributes.XmlAttributeXCoordinate)); - Assert.IsNotNull(soilProfileElement.Attribute(XMLAttributes.XmlAttributeYCoordinate), String.Format("{0}", XMLAttributes.XmlAttributeYCoordinate)); - Assert.IsNotNull(soilProfileElement.Attribute(XMLAttributes.XmlAttributePhreaticLevel), String.Format("{0}", XMLAttributes.XmlAttributePhreaticLevel)); - Assert.IsNotNull(soilProfileElement.Attribute(XMLAttributes.XmlAttributeHasPhreaticLevel), String.Format("{0}", XMLAttributes.XmlAttributeHasPhreaticLevel)); - Assert.IsNotNull(soilProfileElement.Attribute(XMLAttributes.XmlAttributeBottomLevel), String.Format("{0}", XMLAttributes.XmlAttributeBottomLevel)); - Assert.AreEqual(geometry2DSectionParameters.SoilProfile.BottomLevel, soilProfileElement.AttributeAs(XMLAttributes.XmlAttributeBottomLevel), cTolerance, String.Format("{0}", XMLAttributes.XmlAttributeBottomLevel)); + Assert.IsNotNull(soilProfileElement.Attribute(XMLAttributes.XmlAttributeName), $"{XMLAttributes.XmlAttributeName}"); + Assert.AreEqual(geometry2DSectionParameters.SoilProfile.Name, soilProfileElement.AttributeAs(XMLAttributes.XmlAttributeName), $"{XMLAttributes.XmlAttributeName}"); + Assert.IsNotNull(soilProfileElement.Attribute(XMLAttributes.XmlAttributeXCoordinate), $"{XMLAttributes.XmlAttributeXCoordinate}"); + Assert.IsNotNull(soilProfileElement.Attribute(XMLAttributes.XmlAttributeYCoordinate), $"{XMLAttributes.XmlAttributeYCoordinate}"); + Assert.IsNotNull(soilProfileElement.Attribute(XMLAttributes.XmlAttributePhreaticLevel), $"{XMLAttributes.XmlAttributePhreaticLevel}"); + Assert.IsNotNull(soilProfileElement.Attribute(XMLAttributes.XmlAttributeHasPhreaticLevel), $"{XMLAttributes.XmlAttributeHasPhreaticLevel}"); + Assert.IsNotNull(soilProfileElement.Attribute(XMLAttributes.XmlAttributeBottomLevel), $"{XMLAttributes.XmlAttributeBottomLevel}"); + Assert.AreEqual(geometry2DSectionParameters.SoilProfile.BottomLevel, soilProfileElement.AttributeAs(XMLAttributes.XmlAttributeBottomLevel), cTolerance, $"{XMLAttributes.XmlAttributeBottomLevel}"); // Created no PL line so characteristic layers are unassigned Assert.IsNotNull(soilProfileElement.Attribute(XMLAttributes.XmlAttributeBottomSandLayerID), XMLAttributes.XmlAttributeBottomSandLayerID); Assert.IsNotNull(soilProfileElement.Attribute(XMLAttributes.XmlAttributeInBetweenSandLayerID), XMLAttributes.XmlAttributeInBetweenSandLayerID); @@ -179,12 +179,12 @@ { layerElementEnumerator.MoveNext(); XElement layerElement = layerElementEnumerator.Current; - Assert.IsNotNull(layerElement.Attribute(XMLAttributes.XmlAttributeID), String.Format("{0}", String.Format("ID of layer #{0}", geometry2DSectionParameters.SoilProfile.Layers.IndexOf(layer)))); - Assert.AreEqual(layer.Name, layerElement.AttributeAs(XMLAttributes.XmlAttributeID), String.Format("ID of layer #{0}", geometry2DSectionParameters.SoilProfile.Layers.IndexOf(layer))); - Assert.IsNotNull(layerElement.Attribute(XMLAttributes.XmlAttributeSoilID), String.Format("{0}", String.Format("SoilID of layer #{0}", geometry2DSectionParameters.SoilProfile.Layers.IndexOf(layer)))); - Assert.AreEqual(layer.Soil.Name, layerElement.AttributeAs(XMLAttributes.XmlAttributeSoilID), String.Format("SoilID of layer #{0}", geometry2DSectionParameters.SoilProfile.Layers.IndexOf(layer))); - Assert.IsNotNull(layerElement.Attribute(XMLAttributes.XmlAttributeTopLevel), String.Format("{0}", String.Format("TopLevel of layer #{0}", geometry2DSectionParameters.SoilProfile.Layers.IndexOf(layer)))); - Assert.AreEqual(layer.TopLevel, layerElement.AttributeAs(XMLAttributes.XmlAttributeTopLevel), String.Format("TopLevel of layer #{0}", geometry2DSectionParameters.SoilProfile.Layers.IndexOf(layer))); + Assert.IsNotNull(layerElement.Attribute(XMLAttributes.XmlAttributeID), $"{$"ID of layer #{geometry2DSectionParameters.SoilProfile.Layers.IndexOf(layer)}"}"); + Assert.AreEqual(layer.Name, layerElement.AttributeAs(XMLAttributes.XmlAttributeID), $"ID of layer #{geometry2DSectionParameters.SoilProfile.Layers.IndexOf(layer)}"); + Assert.IsNotNull(layerElement.Attribute(XMLAttributes.XmlAttributeSoilID), $"{$"SoilID of layer #{geometry2DSectionParameters.SoilProfile.Layers.IndexOf(layer)}"}"); + Assert.AreEqual(layer.Soil.Name, layerElement.AttributeAs(XMLAttributes.XmlAttributeSoilID), $"SoilID of layer #{geometry2DSectionParameters.SoilProfile.Layers.IndexOf(layer)}"); + Assert.IsNotNull(layerElement.Attribute(XMLAttributes.XmlAttributeTopLevel), $"{$"TopLevel of layer #{geometry2DSectionParameters.SoilProfile.Layers.IndexOf(layer)}"}"); + Assert.AreEqual(layer.TopLevel, layerElement.AttributeAs(XMLAttributes.XmlAttributeTopLevel), $"TopLevel of layer #{geometry2DSectionParameters.SoilProfile.Layers.IndexOf(layer)}"); } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/DtoHelperServices.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/DtoHelperServices.cs (.../DtoHelperServices.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/DtoHelperServices.cs (.../DtoHelperServices.cs) (revision 4053) @@ -319,7 +319,7 @@ } catch { - throw new DtoPropertyMapException(string.Format("Error reading property {0} of type {1}", pInfo.Name, pInfo.ReflectedType.Name)); + throw new DtoPropertyMapException($"Error reading property {pInfo.Name} of type {pInfo.ReflectedType.Name}"); } if (val != null) Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Design/DesignScenario.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Design/DesignScenario.cs (.../DesignScenario.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Design/DesignScenario.cs (.../DesignScenario.cs) (revision 4053) @@ -391,42 +391,7 @@ /// public override string ToString() { - return String.Format("Location={0}, ID={1} RiverLevel={2} " + - "RiverLevelLow={3} " + - "DikeTableHeight={4} " + - "SafetyFactorStabilityInnerSlope={5} " + - "RequiredSafetyFactorStabilityOuterSlope={6} " + - "PlLineOffsetBelowDikeTopAtRiver={7} " + - "PlLineOffsetBelowDikeToeAtPolder={8} " + - "PlLineOffsetBelowDikeTopAtPolder={9} " + - "PlLineOffsetBelowShoulderBaseInside={10} " + - "UsePlLineOffsetBelowDikeCrestMiddle {11} " + - "PlLineOffsetBelowDikeCrestMiddle {12} " + - "UsePlLineOffsetFactorBelowShoulderCrest {13} " + - "PlLineOffsetFactorBelowShoulderCrest {14} " + - "HeadPl2={15} " + - "HeadPl3={16} " + - "HeadPl4={17} " + - "PolderLevel={18} ", - Location.Name, - LocationScenarioID, - RiverLevel, - RiverLevelLow.HasValue ? RiverLevelLow.ToString() : "?", - DikeTableHeight.HasValue ? DikeTableHeight.ToString() : "?", - ModelFactors.RequiredSafetyFactorStabilityInnerSlope, - ModelFactors.RequiredSafetyFactorStabilityOuterSlope, - PlLineOffsetBelowDikeTopAtRiver, - PlLineOffsetBelowDikeToeAtPolder, - PlLineOffsetBelowDikeTopAtPolder, - PlLineOffsetBelowShoulderBaseInside, - UsePlLineOffsetBelowDikeCrestMiddle.HasValue ? UsePlLineOffsetBelowDikeCrestMiddle.ToString() : "?", - PlLineOffsetBelowDikeCrestMiddle.HasValue ? PlLineOffsetBelowDikeCrestMiddle.ToString() : "?", - UsePlLineOffsetFactorBelowShoulderCrest.HasValue ? UsePlLineOffsetFactorBelowShoulderCrest.ToString() : "?", - PlLineOffsetFactorBelowShoulderCrest.HasValue ? PlLineOffsetFactorBelowShoulderCrest.ToString() : "?", - HeadPl2.HasValue ? HeadPl2.ToString() : "?", - HeadPl3.HasValue ? HeadPl3.ToString() : "?", - HeadPl4.HasValue ? HeadPl4.ToString() : "?", - PolderLevel); + return $"Location={Location.Name}, ID={LocationScenarioID} RiverLevel={RiverLevel} " + $"RiverLevelLow={(RiverLevelLow.HasValue ? RiverLevelLow.ToString() : "?")} " + $"DikeTableHeight={(DikeTableHeight.HasValue ? DikeTableHeight.ToString() : "?")} " + $"SafetyFactorStabilityInnerSlope={ModelFactors.RequiredSafetyFactorStabilityInnerSlope} " + $"RequiredSafetyFactorStabilityOuterSlope={ModelFactors.RequiredSafetyFactorStabilityOuterSlope} " + $"PlLineOffsetBelowDikeTopAtRiver={PlLineOffsetBelowDikeTopAtRiver} " + $"PlLineOffsetBelowDikeToeAtPolder={PlLineOffsetBelowDikeToeAtPolder} " + $"PlLineOffsetBelowDikeTopAtPolder={PlLineOffsetBelowDikeTopAtPolder} " + $"PlLineOffsetBelowShoulderBaseInside={PlLineOffsetBelowShoulderBaseInside} " + $"UsePlLineOffsetBelowDikeCrestMiddle {(UsePlLineOffsetBelowDikeCrestMiddle.HasValue ? UsePlLineOffsetBelowDikeCrestMiddle.ToString() : "?")} " + $"PlLineOffsetBelowDikeCrestMiddle {(PlLineOffsetBelowDikeCrestMiddle.HasValue ? PlLineOffsetBelowDikeCrestMiddle.ToString() : "?")} " + $"UsePlLineOffsetFactorBelowShoulderCrest {(UsePlLineOffsetFactorBelowShoulderCrest.HasValue ? UsePlLineOffsetFactorBelowShoulderCrest.ToString() : "?")} " + $"PlLineOffsetFactorBelowShoulderCrest {(PlLineOffsetFactorBelowShoulderCrest.HasValue ? PlLineOffsetFactorBelowShoulderCrest.ToString() : "?")} " + $"HeadPl2={(HeadPl2.HasValue ? HeadPl2.ToString() : "?")} " + $"HeadPl3={(HeadPl3.HasValue ? HeadPl3.ToString() : "?")} " + $"HeadPl4={(HeadPl4.HasValue ? HeadPl4.ToString() : "?")} " + $"PolderLevel={PolderLevel} "; } /// Index: DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Factories/FactoryForDamProjectData.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Factories/FactoryForDamProjectData.cs (.../FactoryForDamProjectData.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Factories/FactoryForDamProjectData.cs (.../FactoryForDamProjectData.cs) (revision 4053) @@ -164,7 +164,7 @@ dike.InputTimeSerieCollection = new TimeSerieCollection(); for (var i = 0; i < timeSeriesCount; i++) { - string locationId = String.Format("location{0}", i); + string locationId = $"location{i}"; TimeSerie timeSerie = dike.InputTimeSerieCollection.AddNewSeries(locationId); timeSerie.ParameterId = (i % 2 == 0) ? idWaterLevel : idWaterPressure; timeSerie.ForecastDateTime = DateTime.Now; @@ -173,12 +173,12 @@ timeSerie.EndDateTime = new DateTime(2012, 12, 31, 1, 0, 0); timeSerie.MissVal = -9999.0; timeSerie.LongName = timeSerie.LocationId + "long"; - timeSerie.StationName = String.Format("station{0}", i); + timeSerie.StationName = $"station{i}"; timeSerie.Units = "m"; - timeSerie.SourceOrganisation = String.Format("organisation{0}", i); - timeSerie.SourceSystem = String.Format("system{0}", i); - timeSerie.FileDescription = String.Format("filedescription{0}", i); - timeSerie.Region = String.Format("region{0}", i); + timeSerie.SourceOrganisation = $"organisation{i}"; + timeSerie.SourceSystem = $"system{i}"; + timeSerie.FileDescription = $"filedescription{i}"; + timeSerie.Region = $"region{i}"; if ((i % 2 == 0)) { timeSerie.TimeStep.Multiplier = 3600; @@ -203,8 +203,8 @@ DateTime = new DateTime(2012, 12, 31, 1, j * 10, 0), Value = j, Flag = 1, - BasisFileName = String.Format("BasisFileName{0}", i), - RelativeCalculationPathName = String.Format("RelativeCalculationPathName{0}", i), + BasisFileName = $"BasisFileName{i}", + RelativeCalculationPathName = $"RelativeCalculationPathName{i}", StochastValue = stochastValue }); } @@ -272,7 +272,7 @@ { var soil = new Soil { - Name = String.Format("Soil {0}", i) + Name = $"Soil {i}" }; //soil.SoilType = SoilType.Loam; @@ -329,7 +329,7 @@ for (var i = 0; i < surfaceLineCount; i++) { var surfaceLine = new SurfaceLine2(); - surfaceLine.Name = String.Format("SurfaceLine {0}", i); + surfaceLine.Name = $"SurfaceLine {i}"; surfaceLine.CharacteristicPoints.Geometry = surfaceLine.Geometry; AddPointsToSurfaceLines(surfaceLine); surfaceLine.Geometry.SyncCalcPoints(); Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCoreMacroStabilityTests.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCoreMacroStabilityTests.cs (.../MultiCoreMacroStabilityTests.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCoreMacroStabilityTests.cs (.../MultiCoreMacroStabilityTests.cs) (revision 4053) @@ -62,7 +62,7 @@ inputString = XmlAdapter.ChangeValueInXml(inputString, "AnalysisType", analysisType.ToString()); // Calculate one core - string calcDir = String.Format("TestStabInwards_{0}_{1}_{2}Core", mStabModelType.ToString(), analysisType.ToString(), 1); + string calcDir = $"TestStabInwards_{mStabModelType.ToString()}_{analysisType.ToString()}_{1}Core"; string outputFilename = DetermineOutputFilename(fileNameOutputPrefix, mStabModelType.ToString(), analysisType.ToString(), 1); string outputString; EngineInterface engineInterface; @@ -101,7 +101,7 @@ Output outputOneCore = DamXmlSerialization.LoadOutputFromXmlString(outputString); // Calculate multicore - calcDir = String.Format("TestStabInwards_{0}_{1}_{2}Core", mStabModelType.ToString(), analysisType.ToString(), multiCoreCount); + calcDir = $"TestStabInwards_{mStabModelType.ToString()}_{analysisType.ToString()}_{multiCoreCount}Core"; outputFilename = DetermineOutputFilename(fileNameOutputPrefix, mStabModelType.ToString(), analysisType.ToString(), multiCoreCount); // Following line to force multicore calculation to be performed always. // Outcomment it to prevent multicore calculation to be performed if it as already done in a previous run, to speed up the test. @@ -149,15 +149,15 @@ x.StabilityDesignResults.StabilityModelType == oneCoreResult.StabilityDesignResults.StabilityModelType); if (multiCoreResult == null) { - string diffString = String.Format("No multicore result in location '{0}', soilprofile '{1}'", oneCoreResult.LocationName, oneCoreResult.ProfileName); + string diffString = $"No multicore result in location '{oneCoreResult.LocationName}', soilprofile '{oneCoreResult.ProfileName}'"; differencesStringBuilder.AppendLine(diffString); differences.Add(diffString); } else { if (Math.Abs(oneCoreResult.StabilityDesignResults.SafetyFactor - multiCoreResult.StabilityDesignResults.SafetyFactor) > tolerance) { - string diffString = String.Format("Different result in location '{0}', soilprofile '{1}': 1 core = {2}, multicore = {3}", oneCoreResult.LocationName, oneCoreResult.ProfileName, oneCoreResult.StabilityDesignResults.SafetyFactor, multiCoreResult.StabilityDesignResults.SafetyFactor); + string diffString = $"Different result in location '{oneCoreResult.LocationName}', soilprofile '{oneCoreResult.ProfileName}': 1 core = {oneCoreResult.StabilityDesignResults.SafetyFactor}, multicore = {multiCoreResult.StabilityDesignResults.SafetyFactor}"; differencesStringBuilder.AppendLine(diffString); differences.Add(diffString); } @@ -169,6 +169,6 @@ private string DetermineOutputFilename(string prefix, string modelType, string analysisType, int coreCount, string extension = ".xml") { - return String.Format("{0}_{1}_{2}_{3}core_OutputFile{4}", prefix, modelType, analysisType, coreCount, extension); + return $"{prefix}_{modelType}_{analysisType}_{coreCount}core_OutputFile{extension}"; } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/EmbeddedResourceNotFoundException.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/EmbeddedResourceNotFoundException.cs (.../EmbeddedResourceNotFoundException.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Assemblers/EmbeddedResourceNotFoundException.cs (.../EmbeddedResourceNotFoundException.cs) (revision 4053) @@ -37,7 +37,7 @@ /// The assembly. /// Name of the resource. public EmbeddedResourceNotFoundException(Assembly assembly, string resourceName) - : this(string.Format("Could not locate embedded resource '{0}' in assembly '{1}'", resourceName, assembly.GetName())) {} + : this($"Could not locate embedded resource '{resourceName}' in assembly '{assembly.GetName()}'") {} /// /// Initializes a new instance of the class. Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesOperational/OperationalCalculator.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesOperational/OperationalCalculator.cs (.../OperationalCalculator.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesOperational/OperationalCalculator.cs (.../OperationalCalculator.cs) (revision 4053) @@ -98,7 +98,7 @@ } damProjectData.CalculationMessages.Add(new LogMessage(LogMessageType.Info, null, - string.Format("There are {0} locations with sensor data", locationCount))); + $"There are {locationCount} locations with sensor data")); if (!locations.Any()) { damProjectData.CalculationMessages.Add(new LogMessage(LogMessageType.Error, null, "No location to process.")); @@ -151,7 +151,7 @@ else { damProjectData.CalculationMessages.Add(new LogMessage(LogMessageType.Warning, null, - String.Format("In location '{0}' missing values are found in timestep {1}", location.Name, entry.DateTime))); + $"In location '{location.Name}' missing values are found in timestep {entry.DateTime}")); } entryIndex++; @@ -231,11 +231,7 @@ damKernelInput.DamFailureMechanismeCalculationSpecification = damFailureMechanismCalculationSpecification; damKernelInput.RiverLevelHigh = Double.NaN; damKernelInput.RiverLevelLow = null; - damKernelInput.FilenamePrefix = String.Format("Dik(dike)_Loc({0})_Stp({1})_Mdl({2})_{3}", - location.Name, - timeStepIndex, - damFailureMechanismCalculationSpecification.StabilityModelType, - DateToTimeStamp(timeSerieEntry.DateTime)); + damKernelInput.FilenamePrefix = $"Dik(dike)_Loc({location.Name})_Stp({timeStepIndex})_Mdl({damFailureMechanismCalculationSpecification.StabilityModelType})_{DateToTimeStamp(timeSerieEntry.DateTime)}"; SynchronizeLocationDataWithScenarioData(designScenario, location); IKernelDataInput kernelDataInput; IKernelDataOutput kernelDataOutput; @@ -476,8 +472,7 @@ if (values[timeStep][location].ContainsKey(sensor)) { - string message = string.Format("Values for sensor with id {0} and name {1} and location {2} and time step {3} already exists. Check the time series data.", - sensor.ID, sensor.Name, location.Name, timeStep); + string message = $"Values for sensor with id {sensor.ID} and name {sensor.Name} and location {location.Name} and time step {timeStep} already exists. Check the time series data."; throw new OperationalCalculatorException(message); } @@ -496,8 +491,7 @@ { // TODO log info string message = - string.Format("Sensor with name '{0}' and parameter id '{1}' not found in the input time series", - sensor.Name, TimeSerie.WaterPressureParameterId); + $"Sensor with name '{sensor.Name}' and parameter id '{TimeSerie.WaterPressureParameterId}' not found in the input time series"; throw new OperationalCalculatorException(message); } @@ -534,8 +528,7 @@ { // TODO log info string message = - string.Format("Sensor with name '{0}' and parameter id '{1}' not found in the input time series", - string.Join(", ", sensorsNotFound.ToArray()), TimeSerie.WaterPressureParameterId); + $"Sensor with name '{string.Join(", ", sensorsNotFound.ToArray())}' and parameter id '{TimeSerie.WaterPressureParameterId}' not found in the input time series"; throw new OperationalCalculatorException(message); } Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/FillXmlOutputFromDamTests.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/FillXmlOutputFromDamTests.cs (.../FillXmlOutputFromDamTests.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/FillXmlOutputFromDamTests.cs (.../FillXmlOutputFromDamTests.cs) (revision 4053) @@ -299,7 +299,7 @@ damProjectData.OutputTimeSerieCollection = new TimeSerieCollection(); for (var i = 0; i < timeSeriesCount; i++) { - string locationId = String.Format("location{0}", i); + string locationId = $"location{i}"; TimeSerie timeSerie = damProjectData.OutputTimeSerieCollection.AddNewSeries(locationId); timeSerie.ParameterId = (i % 2 == 0) ? idPipingBligh : idStabilityInsideFactor; timeSerie.ForecastDateTime = DateTime.Now; @@ -308,12 +308,12 @@ timeSerie.EndDateTime = new DateTime(2012, 12, 31, 1, 0, 0); timeSerie.MissVal = -9999.0; timeSerie.LongName = timeSerie.LocationId + "long"; - timeSerie.StationName = String.Format("station{0}", i); + timeSerie.StationName = $"station{i}"; timeSerie.Units = "m"; - timeSerie.SourceOrganisation = String.Format("organisation{0}", i); - timeSerie.SourceSystem = String.Format("system{0}", i); - timeSerie.FileDescription = String.Format("filedescription{0}", i); - timeSerie.Region = String.Format("region{0}", i); + timeSerie.SourceOrganisation = $"organisation{i}"; + timeSerie.SourceSystem = $"system{i}"; + timeSerie.FileDescription = $"filedescription{i}"; + timeSerie.Region = $"region{i}"; timeSerie.TimeStep.Multiplier = 3600; timeSerie.TimeStep.Unit = TimeStepUnit.Second; for (var j = 0; j < timeEntriesCount; j++) @@ -323,7 +323,7 @@ DateTime = new DateTime(2012, 12, 31, 1, j * 10, 0), Value = 1 + j * 0.1, Flag = 1, - BasisFileName = String.Format("BasisFileName{0}", i) + BasisFileName = $"BasisFileName{i}" }); } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 4053) @@ -252,7 +252,7 @@ damKernelInput.DamFailureMechanismeCalculationSpecification = damFailureMechanismeCalculationSpecification; damKernelInput.RiverLevelHigh = designScenario.RiverLevel; damKernelInput.RiverLevelLow = designScenario.RiverLevelLow; - damKernelInput.FilenamePrefix = String.Format("Loc({0})_Sce({1})", location.Name, designScenario.LocationScenarioID); + damKernelInput.FilenamePrefix = $"Loc({location.Name})_Sce({designScenario.LocationScenarioID})"; AnalysisType analysisType = DamProjectCalculationSpecification.SelectedAnalysisType; SynchronizeScenarioDataWithLocationData(designScenario, location); IKernelDataInput kernelDataInput; Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/Gauges/Gauge.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/Gauges/Gauge.cs (.../Gauge.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/Gauges/Gauge.cs (.../Gauge.cs) (revision 4053) @@ -33,6 +33,6 @@ public override string ToString() { - return String.Format("{0} @ Location {1} | Local X={2}", Name, Location != null ? Location.Name : "?", LocalX); + return $"{Name} @ Location {(Location != null ? Location.Name : "?")} | Local X={LocalX}"; } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilSurfaceProfileTests.cs =================================================================== diff -u -r4052 -r4053 --- DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilSurfaceProfileTests.cs (.../SoilSurfaceProfileTests.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilSurfaceProfileTests.cs (.../SoilSurfaceProfileTests.cs) (revision 4053) @@ -726,7 +726,7 @@ int nrOfExpectedCurves = expectedCurves.Count(); Assert.That(actualCurves.Count(), Is.EqualTo(nrOfExpectedCurves)); - IEnumerable actualCurveString = actualCurves.Select(c => string.Format("Coordinate ({0}, {1}) --> ({2}, {3})", c.HeadPoint.X, c.HeadPoint.Z, c.EndPoint.X, c.EndPoint.Z)); + IEnumerable actualCurveString = actualCurves.Select(c => $"Coordinate ({c.HeadPoint.X}, {c.HeadPoint.Z}) --> ({c.EndPoint.X}, {c.EndPoint.Z})"); foreach (GeometryCurve expectedCurve in expectedCurves) {