Пример #1
0
 /// <summary>
 /// Returns a string representation of this object.
 /// </summary>
 /// <returns>A string representation of this object.</returns>
 public override bool Equals(object obj)
 {
     if (obj is OptDouble)
     {
         OptInt optValue = (OptInt)obj;
         return((_activated == optValue._activated) && (_val == optValue._val));
     }
     return(false);
 }
Пример #2
0
        /// <summary>
        /// Converts the specified string to its <see cref="OptInt"/> equivalent.
        /// </summary>
        /// <param name="value">A string representation of a <see cref="OptInt"/>.</param>
        /// <param name="result">When this method returns, if the conversion succeeded,
        /// contains a <see cref="OptInt"/> reprensention the OptValue specified by <paramref name="value"/>.
        /// </param>
        /// <returns><see langword="true"/> if value was converted successfully; otherwise, <see langword="false"/>.</returns>
        public static bool TryParse(string value, out OptInt result)
        {
            Regex r = new Regex(@"\((?<o>),(?<v>)\)", RegexOptions.Singleline);
            Match m = r.Match(value);

            if (m.Success)
            {
                result = new OptInt(
                    bool.Parse(m.Result("${o}")),
                    int.Parse(m.Result("${v}"))
                    );
                return(true);
            }
            result = OptInt.Zero;
            return(false);
        }
Пример #3
0
 public OptInt(OptInt optValue)
 {
     _activated = optValue._activated;
     _val       = optValue._val;
 }
Пример #4
0
 /// <summary>
 /// Converts the specified string to its <see cref="OptInt"/> equivalent.
 /// </summary>
 /// <param name="value">A string representation of a <see cref="OptInt"/>.</param>
 /// <param name="result">When this method returns, if the conversion succeeded,
 /// contains a <see cref="OptInt"/> reprensention the OptValue specified by <paramref name="value"/>.
 /// </param>
 /// <returns><see langword="true"/> if value was converted successfully; otherwise, <see langword="false"/>.</returns>
 public static bool TryParse(string value, out OptInt result)
 {
     Regex r = new Regex(@"\((?<o>),(?<v>)\)", RegexOptions.Singleline);
     Match m = r.Match(value);
     if (m.Success)
     {
         result = new OptInt(
             bool.Parse(m.Result("${o}")),
             int.Parse(m.Result("${v}"))
             );
         return true;
     }
     result = OptInt.Zero;
     return false;
 }
Пример #5
0
 public OptInt(OptInt optValue)
 {
     _activated = optValue._activated;
     _val = optValue._val;
 }