FMOD.Studio.MarshallingHelper.stringFromNativeUtf8 C# (CSharp) Method

stringFromNativeUtf8() public static method

public static stringFromNativeUtf8 ( IntPtr nativeUtf8 ) : string
nativeUtf8 System.IntPtr
return string
        public static string stringFromNativeUtf8(IntPtr nativeUtf8)
        {
            // There is no one line marshal IntPtr->string for UTF8
            int len = stringLengthUtf8(nativeUtf8);
            if (len == 0) return string.Empty;
            byte[] buffer = new byte[len];
            Marshal.Copy(nativeUtf8, buffer, 0, buffer.Length);
            return Encoding.UTF8.GetString(buffer, 0, len);
        }
    }

Usage Example

 public void assign(out PARAMETER_DESCRIPTION publicDesc)
 {
     publicDesc.name    = MarshallingHelper.stringFromNativeUtf8(this.name);
     publicDesc.minimum = this.minimum;
     publicDesc.maximum = this.maximum;
     publicDesc.type    = this.type;
 }
All Usage Examples Of FMOD.Studio.MarshallingHelper::stringFromNativeUtf8