Beispiel #1
0
 public void OnSerialized(ref Library.Writer writer)
 {
     writer.WriteInt((int)type);
     if (type == PointerType.Text)
     {
         var ptr  = new IntPtr(value);
         var gcp  = GCHandle.FromIntPtr(ptr);
         var text = gcp.Target as string;
         writer.WriteString(text);
     }
     else if (type == PointerType.Reference)
     {
         throw new NotSupportedException("reference type pointer can't serialized.");
     }
 }