src/Misc/EFTools/DesignXmlCore/Common/VsTextBufferFactory.cs
/// <summary>
///     Instanciates a new VsTextBuffer from the local registry
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="localRegistry"></param>
/// <returns></returns>
Instanciates a new VsTextBuffer from the local registry
Instanciates a new VsTextBuffer from the local registry
private static T CreateObject<T>(ILocalRegistry localRegistry)
        {
            object obj = null;
            var iid = typeof(T).GUID;
            var ptr = IntPtr.Zero;
            NativeMethods.ThrowOnFailure(
                localRegistry.CreateInstance(typeof(VsTextBufferClass).GUID, null, ref iid, (uint)CLSCTX.CLSCTX_INPROC_SERVER, out ptr));
            try
            {
                obj = Marshal.GetObjectForIUnknown(ptr);
            }
            finally
            {
                Marshal.Release(ptr);
            }
            return (T)obj;
        }
private static T CreateObject < T > ( ILocalRegistry localRegistry ) { object obj = null ; var iid = typeof ( T ) . GUID ; var ptr = IntPtr . Zero ; NativeMethods . ThrowOnFailure ( localRegistry . CreateInstance ( typeof ( VsTextBufferClass ) . GUID , null , ref iid , ( uint ) CLSCTX . CLSCTX_INPROC_SERVER , out ptr ) ) ; try { obj = Marshal . GetObjectForIUnknown ( ptr ) ; } finally { Marshal . Release ( ptr ) ; } return ( T ) obj ; }
Instanciates a new VsTextBuffer from the local registry
Instanciates a new VsTextBuffer from the local registry
None
localRegistry
ILocalRegistry
None
typeparam
None