Files
DotNetAlpm/Alpm/SafePackageHandle.cs
2020-04-30 20:42:46 -04:00

28 lines
761 B
C#

using System;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
namespace Foodsoft.Alpm
{
internal abstract class SafePackageHandle : SafeHandle
{
protected SafePackageHandle(SafeAlpmHandle safeAlpmHandle) : base(IntPtr.Zero, true)
{
SafeAlpmHandle = safeAlpmHandle;
}
internal SafeAlpmHandle SafeAlpmHandle
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[PrePrepareMethod]
get;
}
public override bool IsInvalid
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[PrePrepareMethod]
get => handle == IntPtr.Zero;
}
}
}