summaryrefslogtreecommitdiff
path: root/DSACore/Auxiliary/Calculator/Argument.cs
diff options
context:
space:
mode:
authornatrixaeria <janng@gmx.de>2019-05-19 17:40:59 +0200
committernatrixaeria <janng@gmx.de>2019-05-19 17:40:59 +0200
commit1509b5ef3d7e9e71d9294e234ec0e39f2d831998 (patch)
tree78300ffff230958101b422a4e6026925b287822f /DSACore/Auxiliary/Calculator/Argument.cs
parentc3bb858bb54dc8c64bbd48054c2c58dc0073f09c (diff)
parentc4d046858e0822b7c2c540ac2368b2c0e88e7a26 (diff)
Merge branch 'scribble' of https://github.com/TrueDoctor/DiscoBot into scribble
Diffstat (limited to 'DSACore/Auxiliary/Calculator/Argument.cs')
-rw-r--r--DSACore/Auxiliary/Calculator/Argument.cs23
1 files changed, 10 insertions, 13 deletions
diff --git a/DSACore/Auxiliary/Calculator/Argument.cs b/DSACore/Auxiliary/Calculator/Argument.cs
index 52f33a9..5ed9ee3 100644
--- a/DSACore/Auxiliary/Calculator/Argument.cs
+++ b/DSACore/Auxiliary/Calculator/Argument.cs
@@ -1,9 +1,9 @@
-namespace DSACore.Auxiliary.Calculator
+using System;
+
+namespace DSACore.Auxiliary.Calculator
{
- using System;
-
/// <summary>
- /// Provides an ISolvable class to save numbers. The class handles Argument checking and conversion from string to int.
+ /// Provides an ISolvable class to save numbers. The class handles Argument checking and conversion from string to int.
/// </summary>
public class Argument : ISolvable
{
@@ -12,27 +12,24 @@
public Argument(string value)
{
// check whether the value given is an empty string
- if (string.IsNullOrEmpty(value))
- {
- throw new ArgumentException("Argument kann nicht mit einem leeren string instanziert werden. ", nameof(value));
- }
+ if (string.IsNullOrEmpty(value))
+ throw new ArgumentException("Argument kann nicht mit einem leeren string instanziert werden. ",
+ nameof(value));
- if (!int.TryParse(value, out int result))
- {
+ if (!int.TryParse(value, out var result))
throw new ArgumentException($"Kann {value} nicht in Integer konvertieren");
- }
this.value = result;
}
public int Solve()
{
- return this.value;
+ return value;
}
public override string ToString()
{
- return this.value.ToString();
+ return value.ToString();
}
}
} \ No newline at end of file