aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs
blob: 5a1252b881442cfc34e56be79c9dc6093d3387ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Runtime.InteropServices;

namespace Google.GRPC.Core.Internal
{
    /// <summary>
    /// Safe handle to wrap native objects.
    /// </summary>
    internal abstract class SafeHandleZeroIsInvalid : SafeHandle
    {
        public SafeHandleZeroIsInvalid() : base(IntPtr.Zero, true)
        {
        }

        public SafeHandleZeroIsInvalid(bool ownsHandle) : base(IntPtr.Zero, ownsHandle)
        {
        }

        public override bool IsInvalid
        {
            get
            {
                return handle == IntPtr.Zero;
            }
        }
    }
}