linux-packaging-mono/mcs/class/corlib/Mono/SafeGPtrArrayHandle.cs
Xamarin Public Jenkins (auto-signing) 94b2861243 Imported Upstream version 4.8.0.309
Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
2016-11-10 13:04:39 +00:00

39 lines
767 B
C#

//
// Safe handle class for Mono.RuntimeGPtrArrayHandle
//
// Authors:
// Aleksey Kliger <aleksey@xamarin.com>
// Rodrigo Kumpera <kumpera@xamarin.com>
//
// Copyright 2016 Dot net foundation.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Runtime.CompilerServices;
namespace Mono {
internal struct SafeGPtrArrayHandle : IDisposable {
RuntimeGPtrArrayHandle handle;
internal SafeGPtrArrayHandle (IntPtr ptr)
{
handle = new RuntimeGPtrArrayHandle (ptr);
}
public void Dispose () {
RuntimeGPtrArrayHandle.DestroyAndFree (ref handle);
}
internal int Length {
get {
return handle.Length;
}
}
internal IntPtr this[int i] => handle[i];
}
}