From 51edbded7cd3c896abba3634404423a5a5be489d Mon Sep 17 00:00:00 2001 From: David Hall Date: Mon, 8 Apr 2019 11:42:16 -0600 Subject: [PATCH] Added static Instance properties to IMemoryMethods implementations --- Core/InteropServices/SafeCoTaskMemHandle.cs | 4 ++++ Core/InteropServices/SafeHGlobalHandle.cs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Core/InteropServices/SafeCoTaskMemHandle.cs b/Core/InteropServices/SafeCoTaskMemHandle.cs index 07e5e402..affc40c3 100644 --- a/Core/InteropServices/SafeCoTaskMemHandle.cs +++ b/Core/InteropServices/SafeCoTaskMemHandle.cs @@ -29,6 +29,10 @@ namespace Vanara.InteropServices public Action FreeSecureStringUni => Marshal.ZeroFreeCoTaskMemUnicode; /// Gets the Ansi free method. public Action FreeSecureStringAnsi => Marshal.ZeroFreeCoTaskMemAnsi; + + + /// Static instance to methods. + public static IMemoryMethods Instance { get; } = new CoTaskMemoryMethods(); } /// A for memory allocated via COM. diff --git a/Core/InteropServices/SafeHGlobalHandle.cs b/Core/InteropServices/SafeHGlobalHandle.cs index 4cf7625d..2e1660ee 100644 --- a/Core/InteropServices/SafeHGlobalHandle.cs +++ b/Core/InteropServices/SafeHGlobalHandle.cs @@ -29,6 +29,9 @@ namespace Vanara.InteropServices public Action FreeSecureStringUni => Marshal.ZeroFreeGlobalAllocUnicode; /// Gets the Ansi free method. public Action FreeSecureStringAnsi => Marshal.ZeroFreeGlobalAllocAnsi; + + /// Static instance to methods. + public static IMemoryMethods Instance { get; } = new HGlobalMemoryMethods(); } /// A for memory allocated via LocalAlloc.