Esempio n. 1
0
 public override unsafe string this[int index]
 {
     get
     {
         if (index < 0 || index >= Length)
         {
             throw new ArgumentOutOfRangeException(nameof(index), "Array index may not be negative or above length of the array");
         }
         var arrayStartPointer = IntPtr.Add(Pointer, 4 * IntPtr.Size);
         var elementPointer    = IntPtr.Add(arrayStartPointer, index * IntPtr.Size);
         return(IL2CPP.Il2CppStringToManaged(*(IntPtr *)elementPointer));
     }
     set
     {
         if (index < 0 || index >= Length)
         {
             throw new ArgumentOutOfRangeException(nameof(index), "Array index may not be negative or above length of the array");
         }
         var arrayStartPointer = IntPtr.Add(Pointer, 4 * IntPtr.Size);
         var elementPointer    = IntPtr.Add(arrayStartPointer, index * IntPtr.Size);
         *(IntPtr *)elementPointer = IL2CPP.ManagedStringToIl2Cpp(value);
     }
 }