Пример #1
0
        /// <summary>
        /// Gets the key's value.
        /// </summary>
        /// <returns></returns>
        public virtual string AsString()
        {
            if (!IsDefined || _asStringBlacklist.Contains(NativeType))
            {
                return(String.Empty);
            }

            SizeT  ptLen    = 0;
            string valueKey = Key;

            if (CanConvertToDegrees)
            {
                valueKey = BuildTokenForDouble();
            }

            // not sure it's worth checking the length here--could just use MAX_VAL_LEN
            GribApiProxy.GribGetLength(_handle, valueKey, ref ptLen);
            StringBuilder msg = new StringBuilder((int)ptLen);

            GribApiProxy.GribGetString(_handle, valueKey, msg, ref ptLen);

            return(msg.ToString().Trim());
        }