Author: joncham
Date: 2006-10-06 11:19:32 -0400 (Fri, 06 Oct 2006)
New Revision: 66358

Modified:
   trunk/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog
   
trunk/mcs/class/corlib/System.Runtime.InteropServices/ExtensibleClassFactory.cs
Log:
2006-10-06  Jonathan Chambers  <[EMAIL PROTECTED]>

        * ExtensibleClassFactory.cs: Implement RegisterObjectCreationCallback.
        


Modified: trunk/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog     
2006-10-06 15:05:37 UTC (rev 66357)
+++ trunk/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog     
2006-10-06 15:19:32 UTC (rev 66358)
@@ -1,3 +1,7 @@
+2006-10-06  Jonathan Chambers  <[EMAIL PROTECTED]>
+
+       * ExtensibleClassFactory.cs: Implement RegisterObjectCreationCallback.
+       
 2006-08-31 Robert Jordan  <[EMAIL PROTECTED]>
 
        * Marshal.cs: Replaced the *Auto internal calls with managed

Modified: 
trunk/mcs/class/corlib/System.Runtime.InteropServices/ExtensibleClassFactory.cs
===================================================================
--- 
trunk/mcs/class/corlib/System.Runtime.InteropServices/ExtensibleClassFactory.cs 
    2006-10-06 15:05:37 UTC (rev 66357)
+++ 
trunk/mcs/class/corlib/System.Runtime.InteropServices/ExtensibleClassFactory.cs 
    2006-10-06 15:19:32 UTC (rev 66358)
@@ -3,10 +3,12 @@
 //
 // Author:
 //   Andreas Nahr ([EMAIL PROTECTED])
+//   Jonathan Chambers ([EMAIL PROTECTED])
 //
 
 //
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2006 Jonathan Chambers
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -28,18 +30,35 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Diagnostics;
+using System.Threading;
+using System.Collections;
+
 namespace System.Runtime.InteropServices
 {
        public sealed class ExtensibleClassFactory
        {
+               static Hashtable hashtable;
+
+               static ExtensibleClassFactory ()
+               {
+                       hashtable = new Hashtable ();
+               }
+
                private ExtensibleClassFactory ()
                {
                }
 
-               [MonoTODO ("implement")]
+               internal static ObjectCreationDelegate 
GetObjectCreationCallback (Type t)
+               {
+                       return hashtable[t] as ObjectCreationDelegate;
+               }
+
                public static void RegisterObjectCreationCallback 
(ObjectCreationDelegate callback)
                {
-                       throw new NotImplementedException ();
+                       StackTrace trace = new StackTrace 
(Thread.CurrentThread, false);
+                       StackFrame frame = trace.GetFrame (0);
+                       hashtable.Add (frame.GetMethod ().DeclaringType, 
callback);
                }
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to