/// <summary> /// To the decimal form. /// </summary> /// <param name="source">The source.</param> /// <param name="notation">Notation object.</param> /// <returns>decimal form of number</returns> /// <exception cref="ArgumentNullException">source is null</exception> public static int ToDecimalForm(this string source, Notation notation) { int index = notation.NotationBase; if (source == null) { throw new ArgumentNullException(nameof(source)); } int result = 0; char[] array = source.ToCharArray(); for (int i = array.Length - 1; i >= 0; i--) { int temp = notation.DigitToDecimal(array[i]); checked { result += temp * (int)Math.Pow(index, array.Length - i - 1); } } return(result); }