diff options
author | Dennis Kobert <d-kobert@web.de> | 2019-05-19 16:03:38 +0200 |
---|---|---|
committer | Dennis Kobert <d-kobert@web.de> | 2019-05-19 16:03:38 +0200 |
commit | f89f308c525e9deebc6d2cf6416e27dfe1a299dc (patch) | |
tree | 7097ef871ead0245efda696198443eab8e443d3a /DSACore/Auxiliary/Calculator/Argument.cs | |
parent | f3983341be939235c1a6cd522b3bb5cc318a6d1a (diff) |
Cleanup DiscoBot Project
Diffstat (limited to 'DSACore/Auxiliary/Calculator/Argument.cs')
-rw-r--r-- | DSACore/Auxiliary/Calculator/Argument.cs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/DSACore/Auxiliary/Calculator/Argument.cs b/DSACore/Auxiliary/Calculator/Argument.cs index 52f33a9..14982aa 100644 --- a/DSACore/Auxiliary/Calculator/Argument.cs +++ b/DSACore/Auxiliary/Calculator/Argument.cs @@ -1,7 +1,7 @@ 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. /// </summary> @@ -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 |