Beispiel #1
0
        /// <summary>Parses a byte2 from a string</summary>
        /// <param name="s">The string value</param>
        /// <param name="resolver">A string resolver function</param>
        /// <param name="defaultValue">The default value</param>
        /// <returns>A byte2 value, or the default value if the parsing fails</returns>
        public static byte2 Parse(string s, IResolver resolver, byte2 defaultValue)
        {
            byte[] list  = Parser.Parse(s.Trim('{', '}'), resolver, new byte[0]);
            byte2  value = defaultValue;

            for (int i = 0; i < list.Length; i++)
            {
                value[i] = list[i];
            }

            return(value);
        }
Beispiel #2
0
 /// <summary>Returns true if the value of another object is equal to this object</summary>
 /// <param name="other">The object to compare for equality</param>
 public bool Equals(byte2 other)
 {
     return(x == other.x && y == other.y);
 }
Beispiel #3
0
 /// <summary>Parses a byte2 from a string</summary>
 /// <param name="s">The string value</param>
 /// <param name="resolver">A string resolver function</param>
 /// <param name="defaultValue">The default value</param>
 /// <param name="result">The parsed value</param>
 /// <returns>True if the parse is successful</returns>
 public static bool TryParse(string s, out byte2 result, IResolver resolver, byte2 defaultValue = default)
 {
     result = defaultValue; try { result = Parse(s, resolver, defaultValue); return(true); } catch { return(false); }
 }
Beispiel #4
0
 /// <summary>Parses a byte2 from a string</summary>
 /// <param name="s">The string value</param>
 /// <param name="result">The parsed value</param>
 /// <returns>True if the parse is successful</returns>
 public static bool TryParse(string s, out byte2 result)
 {
     result = default; try { result = Parse(s); return(true); } catch { return(false); }
 }