/// <summary> /// Adds a numeric field to the current active message. /// </summary> /// <param name="tag">The field tag.</param> /// <param name="value">The numeric field value.</param> /// <returns><see langword="true" /> if the field was successfully added, or <see langword="false"/> if the value could not be added (because there was no more memory, the message handle does not contain any messages, or the supplied value is not of the type specified).</returns> /// <exception cref="ObjectDisposedException">The <see cref="Message"/> instance has been disposed.</exception> /// <remarks>The corresponding native function is mdf_message_add_numeric.</remarks> public bool AddNumeric(uint tag, string value) { ThrowIfDisposed(); if (value == null) { return(_nativeImplementation.mdf_message_add_numeric(Handle, tag, IntPtr.Zero) == 1); } byte *bytes = stackalloc byte[value.Length + 1]; if (!TryGetAsciiBytes(value, bytes)) { return(false); } return(_nativeImplementation.mdf_message_add_numeric(Handle, tag, (IntPtr)bytes) == 1); }