示例#1
0
 /// <summary>
 /// Adds a scaled and signed 64-bit integer field to the current active message. <paramref name="decimals"/> can be between 0 and 19. A value of 12345 with <paramref name="decimals"/> set to 2 will be encoded as "123.45".
 /// </summary>
 /// <param name="tag">The field tag.</param>
 /// <param name="value">The scaled and signed 64-bit integer.</param>
 /// <param name="decimals">The number of decimals.</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="ArgumentException"><paramref name="decimals"/> is not between 0 and 19.</exception>
 /// <exception cref="InvalidOperationException">The installed version of the native library doesn't include the mdf_message_add_int function.</exception>
 /// <exception cref="ObjectDisposedException">The <see cref="Message"/> instance has been disposed.</exception>
 /// <remarks>The corresponding native function is mdf_message_add_int.</remarks>
 public bool AddInt64(uint tag, long value, int decimals)
 {
     if (decimals < 0 || decimals > 19)
     {
         throw new ArgumentException($"{nameof(decimals)} cannot be smaller than 0 or greater than 19.", nameof(decimals));
     }
     ThrowIfDisposed();
     return(_nativeImplementation.mdf_message_add_int(Handle, tag, value, decimals) == 1);
 }