Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (WebConfigSettings.ComPartition == null && HttpContext.Current != null)
- Nses = new NSession();
- else
- Nses = (INSession)Marshal.BindToMoniker(string.Format("partition:{0}/new:NuntioServer.NSession", WebConfigSettings.ComPartition));
- if (WebConfigSettings.ComPartition == null && HttpContext.Current != null)
- apses.Wses = new WSession();
- else
- apses.Wses = (IWSession)Marshal.BindToMoniker(string.Format("partition:{0}/new:NuntioServer.WSession", WebConfigSettings.ComPartition));
- public static TInterface Get<TSubInterface, TInterface>() where TSubInterface: TInterface
- {
- <snip></snip>
- if (!useComPartitions)
- return Activator.CreateInstance<TSubInterface>(); // --> this is not cooperating
- return (TInterface)Marshal.BindToMoniker(.....);
- }
- class Program {
- static void Main(string[] args) {
- var shl = new Shell32.Shell();
- }
- }
- .method private hidebysig static void Main(string[] args) cil managed
- {
- .entrypoint
- // Code size 8 (0x8)
- .maxstack 1
- .locals init ([0] class [Interop.Shell32]Shell32.Shell 'shl')
- IL_0000: nop
- IL_0001: newobj instance void [Interop.Shell32]Shell32.ShellClass::.ctor()
- IL_0006: stloc.0
- IL_0007: ret
- } // end of method Program::Main
- var coClassAttribute = type.GetCustomAttribute<CoClassAttribute>(); // our extension method
- return (TSubInterface)Activator.CreateInstance(coClassAttribute.CoClass);
Add Comment
Please, Sign In to add comment