public object MarshalNativeToManaged(IntPtr nativeData)
        {
            // Get the the size of the string
            string value = Utf8Marshal.PtrToStringUtf8(nativeData);

            return(value);
        }
        public object MarshalNativeToManaged(IntPtr nativeData)
        {
            List <string> values = new List <string>();

            if (nativeData != IntPtr.Zero)
            {
                IntPtr arrayIndex = nativeData;

                while (true)
                {
                    IntPtr stringPointer = Marshal.ReadIntPtr(arrayIndex);

                    if (stringPointer == IntPtr.Zero)
                    {
                        break;
                    }

                    string value = Utf8Marshal.PtrToStringUtf8(stringPointer);

                    if (value == string.Empty)
                    {
                        break;
                    }

                    values.Add(value);
                    arrayIndex += IntPtr.Size;
                }
            }

            return(new ReadOnlyCollection <string>(values));
        }