Change throw exceptions to use nameof in parameter
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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++)
|
||||
|
||||
Reference in New Issue
Block a user