コード例 #1
0
 public InternString(IntPtr handle, Transfer ownership) : base(handle)
 {
     if (ownership != Transfer.None)
     {
         throw new InvalidOperationException("Interned strings can never be owned");
     }
     stringValue = GMarshal.Utf8PtrToString(handle);
 }
コード例 #2
0
        public static InternString Get(string @string)
        {
            var string_ = GMarshal.StringToUtf8Ptr(@string);
            var ret_    = g_intern_string(string_);

            GMarshal.Free(string_);
            var ret = new InternString(ret_, Transfer.None);

            return(ret);
        }