diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2015-02-03 17:54:38 -0800 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2015-02-03 18:11:10 -0800 |
commit | a7608b081e30f6fef5fd36935f8c8591381d4bde (patch) | |
tree | 43c7d282a57a969cc5272422f431c270cd5ba3be /src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs | |
parent | ea6f6d99f46cc0445840408da8d6096405fc209c (diff) |
Prototype of gRPC C# library (Core and API examples)
Diffstat (limited to 'src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs')
-rw-r--r-- | src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs b/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs new file mode 100644 index 0000000000..5a1252b881 --- /dev/null +++ b/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs @@ -0,0 +1,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; + } + } + } +} + |