I am migrating my app from Windows Phone 8 to Windows Universal App. My requirement is to create a clone object from existing object. I used to do the same with below code in Windows Phone 8
public static object CloneObject(object o)
{
Type t = o.GetType();
PropertyInfo[] properties = t.GetProperties();
Object p = t.InvokeMember("", System.Reflection.BindingFlags.CreateInstance,
null, o, null);
foreach (PropertyInfo pi in properties)
{
if (pi.CanWrite)
{
pi.SetValue(p, pi.GetValue(o, null), null);
}
}
return p;
}
Can anyone suggest, how can I achieve this in Windows Universal Apps, as some methods like InvokeMemeber are not available.