/// <summary>
        /// Formats a value as string for serilization or display.
        /// </summary>
        public static string FormatValue(Opc.Ua.Variant value)
        {
            if (value == Variant.Null)
            {
                return(String.Empty);
            }

            double?doubleValue = value.Value as double?;

            if (doubleValue != null)
            {
                if (doubleValue.Value != Math.Truncate(doubleValue.Value))
                {
                    return(String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0:F4}", doubleValue));
                }
            }

            return(String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", value));
        }
示例#2
0
 /// <summary>
 /// Constructs an operand from a value.
 /// </summary>
 /// <param name="value">The value.</param>
 public LiteralOperand(object value)
 {
     m_value = new Variant(value);
 }
示例#3
0
        /// <summary>
        /// Initializes the object with a value.
        /// </summary>
        /// <remarks>
        /// Initializes the object with a value from a <see cref="Variant"/>
        /// </remarks>
        /// <param name="value">The value to set</param>
        public DataValue(Variant value)
        {
            Initialize();

            m_value = value;
        }