forked from menees/Libraries
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComUtility.Framework.cs
More file actions
35 lines (26 loc) · 942 Bytes
/
ComUtility.Framework.cs
File metadata and controls
35 lines (26 loc) · 942 Bytes
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
29
30
31
32
33
34
35
namespace Menees.Windows
{
#region Using Directives
using System;
using System.Runtime.InteropServices;
#endregion
public static partial class ComUtility
{
#region Public Methods
/// <summary>
/// Performs the final release on a COM object's runtime callable wrapper (RCW).
/// </summary>
/// <param name="instance">The instance to release.</param>
/// <returns>
/// The new value of the reference count of the RCW associated with <paramref name="instance"/>,
/// which is 0 (zero) if the release is successful.
/// </returns>
public static int FinalRelease(object instance) => Marshal.FinalReleaseComObject(instance);
#endregion
#region Internal Methods
internal static object GetActiveObject(string progID) => Marshal.GetActiveObject(progID);
// .NET Framework fully supports the dynamic keyword for COM Interop.
internal static object EnsureDynamic(object value) => value;
#endregion
}
}