Преглед изворни кода

Fixed clone to create correct instance type

Brad Robinson пре 11 година
родитељ
комит
476d4739a9
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      PetaJson.cs

+ 2 - 2
PetaJson.cs

@@ -200,13 +200,13 @@ namespace PetaJson
         // Create a clone of an object
         public static T Clone<T>(T source)
         {
-            return Reparse<T>(source);
+            return (T)Reparse(source.GetType(), source);
         }
 
         // Create a clone of an object (untyped)
         public static object Clone(object source)
         {
-            return Reparse(typeof(object), source);
+            return Reparse(source.GetType(), source);
         }
 
         // Clone an object into another instance