Change throw exceptions to use nameof in parameter

This commit is contained in:
teinarss
2021-02-28 17:35:36 +01:00
committed by abcdefg30
parent 53b781960c
commit ed295ae315
30 changed files with 46 additions and 46 deletions

View File

@@ -38,7 +38,7 @@ namespace OpenRA
public virtual void CopyValuesFrom(CellLayerBase<T> anotherLayer)
{
if (Size != anotherLayer.Size || GridType != anotherLayer.GridType)
throw new ArgumentException("Layers must have a matching size and shape (grid type).", "anotherLayer");
throw new ArgumentException("Layers must have a matching size and shape (grid type).", nameof(anotherLayer));
Array.Copy(anotherLayer.entries, entries, entries.Length);
}

View File

@@ -62,7 +62,7 @@ namespace OpenRA
public static CellRegion BoundingRegion(MapGridType shape, IEnumerable<CPos> cells)
{
if (cells == null || !cells.Any())
throw new ArgumentException("cells must not be null or empty.", "cells");
throw new ArgumentException("cells must not be null or empty.", nameof(cells));
var minU = int.MaxValue;
var minV = int.MaxValue;

View File

@@ -1246,10 +1246,10 @@ namespace OpenRA
public IEnumerable<CPos> FindTilesInAnnulus(CPos center, int minRange, int maxRange, bool allowOutsideBounds = false)
{
if (maxRange < minRange)
throw new ArgumentOutOfRangeException("maxRange", "Maximum range is less than the minimum range.");
throw new ArgumentOutOfRangeException(nameof(maxRange), "Maximum range is less than the minimum range.");
if (maxRange >= Grid.TilesByDistance.Length)
throw new ArgumentOutOfRangeException("maxRange",
throw new ArgumentOutOfRangeException(nameof(maxRange),
"The requested range ({0}) cannot exceed the value of MaximumTileSearchRange ({1})".F(maxRange, Grid.MaximumTileSearchRange));
for (var i = minRange; i <= maxRange; i++)