diff --git a/HashingTool/ViewModel/UserControl/XMLFileSelector.cs b/HashingTool/ViewModel/UserControl/XMLFileSelector.cs index bfcf55f7a8d1c393938461ade154afa28ebf0538..30d3d6be33af60b0ad2dca905997508f73f2cea9 100644 --- a/HashingTool/ViewModel/UserControl/XMLFileSelector.cs +++ b/HashingTool/ViewModel/UserControl/XMLFileSelector.cs @@ -290,7 +290,7 @@ namespace HashingTool.ViewModel.UserControl ? Environment.NewLine + e.Exception.InnerException.Message : "") : e.ValidationEventArgs.Message, - e.ValidationEventArgs == null ? 0 : e.ValidationEventArgs.Exception.LineNumber)); + e.ValidationEventArgs?.Exception.LineNumber ?? 0)); } } ); diff --git a/VectoCommon/VectoCommon/Utils/Validation.cs b/VectoCommon/VectoCommon/Utils/Validation.cs index 7eed7002cd068f04442989191880ec289861040f..ebfe5f6b5d21df369c3ba563e091211e249aaae4 100644 --- a/VectoCommon/VectoCommon/Utils/Validation.cs +++ b/VectoCommon/VectoCommon/Utils/Validation.cs @@ -185,11 +185,11 @@ namespace TUGraz.VectoCommon.Utils var validationService = validationContext.GetService(typeof(VectoValidationModeServiceContainer)) as VectoValidationModeServiceContainer; - var mode = validationService != null ? validationService.Mode : ExecutionMode.Declaration; + var mode = validationService?.Mode ?? ExecutionMode.Declaration; var gbxType = validationService != null ? validationService.GearboxType : GearboxType.MT; var isEmsCycle = validationService != null && validationService.IsEMSCycle; - var jobType = validationService != null ? validationService.JobType : VectoSimulationJobType.ConventionalVehicle; - var emPos = validationService != null ? validationService.EMPowertrainPosition : (PowertrainPosition?)null; + var jobType = validationService?.JobType ?? VectoSimulationJobType.ConventionalVehicle; + var emPos = validationService?.EMPowertrainPosition; var enumerable = value as IEnumerable; if (enumerable != null) { @@ -411,7 +411,7 @@ namespace TUGraz.VectoCommon.Utils } var validationService = validationContext.GetService(typeof(VectoValidationModeServiceContainer)) as VectoValidationModeServiceContainer; - var mode = validationService != null ? validationService.Mode : (ExecutionMode?)null; + var mode = validationService?.Mode; var emsMode = validationService != null && validationService.IsEMSCycle; if (!_emsMission.HasValue || _emsMission.Value == emsMode) { diff --git a/VectoCommon/VectoHashing/VectoHash.cs b/VectoCommon/VectoHashing/VectoHash.cs index be5bb557ff3b0980b2539f2dfea3007df251c437..f7e9cbaf24a0c5bf918d264651141ec90e61e144 100644 --- a/VectoCommon/VectoHashing/VectoHash.cs +++ b/VectoCommon/VectoHashing/VectoHash.cs @@ -113,7 +113,7 @@ namespace TUGraz.VectoHashing foreach (var component in EnumHelper.GetValues<VectoComponents>()) { var nodes = Document.SelectNodes(string.Format("//*[local-name()='{0}']//*[local-name()='{1}']", XMLNames.VectoInputDeclaration, component.XMLElementName())); - var count = nodes == null ? 0 : nodes.Count; + var count = nodes?.Count ?? 0; for (var i = 0; i < count; i++) { retVal.Add(component); } diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs index 3d039c3d1b099a6ac6239fe0d76ec9422501fec3..87fdde345f47aa5dfca1c115617a0aa4ebf98ef1 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs @@ -265,7 +265,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON $"Gear {gearNr} LossMap") : null, Efficiency = nextEfficiency, - MaxTorque = gear["MaxTorque"] != null ? gear["MaxTorque"].Value<double>().SI<NewtonMeter>() : null, + MaxTorque = gear["MaxTorque"]?.Value<double>().SI<NewtonMeter>(), ShiftPolygon = ReadTableData(gear.GetEx<string>(JsonKeys.Gearbox_Gear_ShiftPolygonFile), $"Gear {gearNr} shiftPolygon", false), }; diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs index 56a5b1d3a9a78c0ce98d0fc7cc7af9cf37cd8bac..1469c5ea0b797ab07df2326946dec0c69452ad8e 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs @@ -225,9 +225,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON public string LegislativeCategory => null; public virtual LegislativeClass? LegislativeClass => - Body["LegislativeClass"] != null - ? Body["LegislativeClass"].Value<string>().ParseEnum<LegislativeClass>() - : VectoCommon.Models.LegislativeClass.Unknown; + Body["LegislativeClass"]?.Value<string>().ParseEnum<LegislativeClass>() ?? VectoCommon.Models.LegislativeClass.Unknown; public virtual VehicleCategory VehicleCategory => (VehicleCategory)Enum.Parse(typeof(VehicleCategory), Body[JsonKeys.Vehicle_VehicleCategory].Value<string>(), true); diff --git a/VectoCore/VectoCore/InputData/FileIO/XMLReports/XMLManufacturerReportReader.cs b/VectoCore/VectoCore/InputData/FileIO/XMLReports/XMLManufacturerReportReader.cs index d64f9942d07e6246152c1e99396476e94ea68d11..eb989f43c3fd7b0651857bce5c73f34f1b0599a2 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XMLReports/XMLManufacturerReportReader.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XMLReports/XMLManufacturerReportReader.cs @@ -46,7 +46,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration foreach (var component in EnumHelper.GetValues<VectoComponents>()) { var nodes = xmlDocument.SelectNodes(string.Format("//*[local-name()='{0}']//*[local-name()='{1}']/*[local-name()='Model']", XMLNames.VectoManufacturerReport, component.XMLElementName())); - var count = nodes == null ? 0 : nodes.Count; + var count = nodes?.Count ?? 0; for (var i = 0; i < count; i++) { retVal.Add(component); } @@ -54,7 +54,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration foreach (var component in new[] { XMLNames.AxleWheels_Axles_Axle }) { var nodes = xmlDocument.SelectNodes(string.Format("//*[local-name()='{0}']//*[local-name()='{1}']", XMLNames.VectoManufacturerReport, component)); - var count = nodes == null ? 0 : nodes.Count; + var count = nodes?.Count ?? 0; for (var i = 0; i < count; i++) { retVal.Add(VectoComponents.Tyre); } diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index 13e7cf0bf8dc5357230762b4ef61ebeb92d0d5bf..69f78b39bc97698c4aa192c722160dd20753b95a 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -204,7 +204,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter (gbx != null && gbx.Type.AutomaticTransmission() ? torqueConverter.Inertia : 0.SI<KilogramSquareMeter>()); retVal.EngineStartTime = engine.EngineStartTime ?? DeclarationData.Engine.DefaultEngineStartTime; var limits = torqueLimits.ToDictionary(e => e.Gear); - var numGears = gbx == null ? 0 : gbx.Gears.Count; + var numGears = gbx?.Gears.Count ?? 0; var fullLoadCurves = new Dictionary<uint, EngineFullLoadCurve>(numGears + 1); fullLoadCurves[0] = FullLoadCurveReader.Create(engine.EngineModes.First().FullLoadCurve); fullLoadCurves[0].EngineData = retVal; diff --git a/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs b/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs index 905b0f873a452212cb4ec24d1bb80bfac4527792..5fb3957afde3f7de69342f8ecac93a867df7a643 100644 --- a/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs +++ b/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs @@ -246,7 +246,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Data var angledriveRatio = hasAngleDrive && angledriveData.Type == AngledriveType.SeparateAngledrive ? angledriveData.Angledrive.Ratio : 1.0; - var axlegearRatio = axleGearData != null ? axleGearData.AxleGear.Ratio : 1.0; + var axlegearRatio = axleGearData?.AxleGear.Ratio ?? 1.0; var dynamicTyreRadius = runData.VehicleData != null ? runData.VehicleData.DynamicTyreRadius : 0.0.SI<Meter>(); var vehicleMaxSpeed = runData.EngineData.FullLoadCurves[0].N95hSpeed / diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs index 3f301f8510dff97d6fc28657f4500069d2c5b1c6..3d7b1243e3bf60a1ce272132e21622b14835c4d9 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs @@ -264,7 +264,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl if (Validate) { ValidateVectoRunData( - run, data.JobType, data.ElectricMachinesData.FirstOrDefault()?.Item1, data.GearboxData == null ? (GearboxType?)null : data.GearboxData.Type, + run, data.JobType, data.ElectricMachinesData.FirstOrDefault()?.Item1, data.GearboxData?.Type, data.Mission != null && data.Mission.MissionType.IsEMS()); } return run; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs index 466874138ec53f71f21b389d44b6962638b703d3..6a33c200e9c2269b49e1add81c0b855e39ba9ad2 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs @@ -76,11 +76,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox { var validationService = context.GetService(typeof(VectoValidationModeServiceContainer)) as VectoValidationModeServiceContainer; - var mode = validationService != null ? validationService.Mode : ExecutionMode.Declaration; + var mode = validationService?.Mode ?? ExecutionMode.Declaration; var gbxType = validationService != null ? validationService.GearboxType : GearboxType.MT; var emsMission = validationService != null && validationService.IsEMSCycle; - var jobType = validationService != null ? validationService.JobType : VectoSimulationJobType.ConventionalVehicle; - var emPos = validationService != null ? validationService.EMPowertrainPosition : (PowertrainPosition?)null; + var jobType = validationService?.JobType ?? VectoSimulationJobType.ConventionalVehicle; + var emPos = validationService?.EMPowertrainPosition; if (gearData.HasTorqueConverter) { if (gearData.TorqueConverterShiftPolygon == null) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/ShiftPolygon.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/ShiftPolygon.cs index 2702ca1cf1832e66d30addf373d992c31e52d63a..20536240d6cb843012dc70f5fcd26052c524cc78 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/ShiftPolygon.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/ShiftPolygon.cs @@ -158,7 +158,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox { var validationService = validationContext.GetService(typeof(VectoValidationModeServiceContainer)) as VectoValidationModeServiceContainer; - var gbxType = validationService != null ? validationService.GearboxType : null; + var gbxType = validationService?.GearboxType; if (gbxType == null || gbxType.Value.AutomaticTransmission()) { return ValidationResult.Success; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs index 565fa8c12eb3bb2887dbc9c2f0aa7ffd84ac5b02..51d3fd037419492c81a9c000f79bfb7d7eed0e10 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs @@ -57,7 +57,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data { var validationService = context.GetService(typeof(VectoValidationModeServiceContainer)) as VectoValidationModeServiceContainer; - return validationService == null ? ExecutionMode.Declaration : validationService.Mode; + return validationService?.Mode ?? ExecutionMode.Declaration; } protected static bool GetEmsMode(ValidationContext context) @@ -71,7 +71,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data { var validationService = context.GetService(typeof(VectoValidationModeServiceContainer)) as VectoValidationModeServiceContainer; - return validationService != null ? validationService.JobType : VectoSimulationJobType.ConventionalVehicle; + return validationService?.JobType ?? VectoSimulationJobType.ConventionalVehicle; } @@ -79,7 +79,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data { var validationService = context.GetService(typeof(VectoValidationModeServiceContainer)) as VectoValidationModeServiceContainer; - return validationService != null ? validationService.EMPowertrainPosition : (PowertrainPosition?)null; + return validationService?.EMPowertrainPosition; } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs index 957eb1897fb40bfb496cb73fdb40acdf12ec03eb..30196371482534a9749b32a668b8ed62b448f4ad 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs @@ -64,7 +64,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return; } var transmissionRatio = runData.AxleGearData.AxleGear.Ratio * - (runData.AngledriveData == null ? 1.0 : runData.AngledriveData.Angledrive.Ratio) / + (runData.AngledriveData?.Angledrive.Ratio ?? 1.0) / runData.VehicleData.DynamicTyreRadius; var minEngineSpeed = (runData.EngineData.FullLoadCurves[0].RatedSpeed - runData.EngineData.IdleSpeed) * Constants.SimulationSettings.ClutchClosingSpeedNorm + runData.EngineData.IdleSpeed; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs index 68535805d4514a2e0f5e5aac93bcdb30bcae3e7c..a30715f3873a4573a9e9dd91b4d094dcfa0e5647 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs @@ -89,9 +89,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { var dt = Constants.SimulationSettings.TargetTimeInterval; - var tcLocked = DataBus.DrivingCycleInfo.CycleData.LeftSample.TorqueConverterActive != null - ? !DataBus.DrivingCycleInfo.CycleData.LeftSample.TorqueConverterActive - : null; + var tcLocked = !DataBus.DrivingCycleInfo.CycleData.LeftSample.TorqueConverterActive; Gear = new GearshiftPosition(GetGearFromCycle(), tcLocked); if (TorqueConverter != null && Gear.TorqueConverterLocked == null) { @@ -206,9 +204,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { Disengaged = null; - var tcLocked = DataBus.DrivingCycleInfo.CycleData.LeftSample.TorqueConverterActive != null - ? !DataBus.DrivingCycleInfo.CycleData.LeftSample.TorqueConverterActive - : null; + var tcLocked = !DataBus.DrivingCycleInfo.CycleData.LeftSample.TorqueConverterActive; Gear = new GearshiftPosition(GetGearFromCycle(), tcLocked); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs index b9689796aadfb73715bac2c91958392b25916302..a5f0127cdbaf26a95d97b4b57eaf6e3b83241ab1 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs @@ -68,7 +68,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl SkipGears = true; TransmissionRatio = runData.AxleGearData.AxleGear.Ratio * - (runData.AngledriveData == null ? 1.0 : runData.AngledriveData.Angledrive.Ratio) / + (runData.AngledriveData?.Angledrive.Ratio ?? 1.0) / runData.VehicleData.DynamicTyreRadius; //var minEngineSpeed = (runData.EngineData.FullLoadCurves[0].RatedSpeed - runData.EngineData.IdleSpeed) * // Constants.SimulationSettings.ClutchClosingSpeedNorm + runData.EngineData.IdleSpeed; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/VTPCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/VTPCycle.cs index 45b6c89e991c588b79590445d11970064611f39a..ea80b530199618eb4e0869185675b425646780d8 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/VTPCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/VTPCycle.cs @@ -174,7 +174,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return; } var transmissionRatio = RunData.AxleGearData.AxleGear.Ratio * - (RunData.AngledriveData == null ? 1.0 : RunData.AngledriveData.Angledrive.Ratio) / + (RunData.AngledriveData?.Angledrive.Ratio ?? 1.0) / RunData.VehicleData.DynamicTyreRadius; var cardanStartSpeed = (RunData.GearshiftParameters.StartSpeed * transmissionRatio).Cast<PerSecond>(); var minEngineSpeed = (RunData.EngineData.FullLoadCurves[0].RatedSpeed - RunData.EngineData.IdleSpeed) * diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/VelocitySpeedGearshiftPreprocessor.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/VelocitySpeedGearshiftPreprocessor.cs index 56ff12176d4561f0facfaee38baf4a3d26b186e6..cc71009281485d1c85e5196ddd3a5f923d2d72e5 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/VelocitySpeedGearshiftPreprocessor.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/VelocitySpeedGearshiftPreprocessor.cs @@ -127,7 +127,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var angledriveRatio = hasAngleDrive && angledriveData.Type == AngledriveType.SeparateAngledrive ? angledriveData.Angledrive.Ratio : 1.0; - var axlegearRatio = axleGearData != null ? axleGearData.AxleGear.Ratio : 1.0; + var axlegearRatio = axleGearData?.AxleGear.Ratio ?? 1.0; var dynamicTyreRadius = runData.VehicleData != null ? runData.VehicleData.DynamicTyreRadius : 0.0.SI<Meter>(); var vehicleMaxSpeed = GetMaxMotorspeed(runData) / diff --git a/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs b/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs index 9f94868905f1fbf4ea1269be3dfe7c682235c169..f44fe10656b85e6dc6608830b178c688d16d479f 100644 --- a/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs +++ b/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs @@ -390,7 +390,7 @@ public class JSONFileWriter : IOutputFileWriter { "EcoRoll", vehicle.ADAS.EcoRoll.ToString() }, { "PredictiveCruiseControl", vehicle.ADAS.PredictiveCruiseControl.ToString() }, { "ATEcoRollReleaseLockupClutch", - vehicle.ADAS.ATEcoRollReleaseLockupClutch.HasValue ? vehicle.ADAS.ATEcoRollReleaseLockupClutch.Value : false + vehicle.ADAS.ATEcoRollReleaseLockupClutch ?? false } }; if (airdrag.AirDragArea != null) diff --git a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs index 1267d1d2c6826df94fc68de87977c8cac5cca781..43c458c508f3f0fb7d0178d0d65bdf2b125997d8 100644 --- a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs @@ -174,12 +174,12 @@ namespace TUGraz.VectoCore.OutputData public VectoRun.Status RunStatus { get; protected set; } - public string Error => SimException == null ? null : SimException.Message; + public string Error => SimException?.Message; public string StackTrace => SimException == null ? null - : (SimException.StackTrace ?? (SimException.InnerException != null ? SimException.InnerException.StackTrace : null)); + : (SimException.StackTrace ?? SimException.InnerException?.StackTrace); public void Reset() diff --git a/VectoCore/VectoCore/Utils/DelaunayMap.cs b/VectoCore/VectoCore/Utils/DelaunayMap.cs index 4ce3f5bd88b03e278c06ee2818f2f22ba3c95c48..c9e483cd3203f182657487dcd11f57b667618fb8 100644 --- a/VectoCore/VectoCore/Utils/DelaunayMap.cs +++ b/VectoCore/VectoCore/Utils/DelaunayMap.cs @@ -180,10 +180,10 @@ namespace TUGraz.VectoCore.Utils private static void DrawGraph(int i, IEnumerable<Triangle> triangles, Triangle superTriangle, Point[] points, Point lastPoint = null) { - var xmin = Math.Min(points.Min(p => p.X), lastPoint != null ? lastPoint.X : double.NaN); - var xmax = Math.Max(points.Max(p => p.X), lastPoint != null ? lastPoint.X : double.NaN); - var ymin = Math.Min(points.Min(p => p.Y), lastPoint != null ? lastPoint.Y : double.NaN); - var ymax = Math.Max(points.Max(p => p.Y), lastPoint != null ? lastPoint.Y : double.NaN); + var xmin = Math.Min(points.Min(p => p.X), lastPoint?.X ?? double.NaN); + var xmax = Math.Max(points.Max(p => p.X), lastPoint?.X ?? double.NaN); + var ymin = Math.Min(points.Min(p => p.Y), lastPoint?.Y ?? double.NaN); + var ymax = Math.Max(points.Max(p => p.Y), lastPoint?.Y ?? double.NaN); using (var chart = new Chart { Width = 1000, Height = 1000 }) { chart.ChartAreas.Add(new ChartArea("main") {