Example #1
0
        /// <summary>
        /// Produces a string representation of the spin state.
        /// </summary>
        /// <returns>A string representation of the spin state.</returns>
        public override string ToString()
        {
            StringBuilder text = new StringBuilder(spin.ToString());

            text.AppendFormat(CultureInfo.CurrentCulture, ",");
            if (twoM > 0)
            {
                text.Append(CultureInfo.CurrentCulture.NumberFormat.PositiveSign);
            }
            else if (twoM < 0)
            {
                text.Append(CultureInfo.CurrentCulture.NumberFormat.NegativeSign);
            }
            text.Append(SpinString(Math.Abs(twoM)));
            return(text.ToString());
        }
Example #2
0
        private string ToString(IFormatProvider provider)
        {
            NumberFormatInfo numberFormat = (NumberFormatInfo)provider.GetFormat(typeof(NumberFormatInfo));
            StringBuilder    text         = new StringBuilder(spin.ToString());

            text.Append(",");
            if (twoM > 0)
            {
                text.Append(numberFormat.PositiveSign);
            }
            else if (twoM < 0)
            {
                text.Append(numberFormat.NegativeSign);
            }
            text.Append(SpinString(Math.Abs(twoM)));
            return(text.ToString());
        }