// Token: 0x06000FE0 RID: 4064 RVA: 0x0006580C File Offset: 0x00063A0C
 public static void CopyProperties <T>(T config, BaseUberStrikeItemView item) where T : BaseUberStrikeItemView
 {
     CloneUtil.CopyAllFields <BaseUberStrikeItemView>(config, item);
     foreach (FieldInfo fieldInfo in ItemConfigurationUtil.GetAllFields(config.GetType()))
     {
         string customPropertyName = ItemConfigurationUtil.GetCustomPropertyName(fieldInfo);
         if (!string.IsNullOrEmpty(customPropertyName) && item.CustomProperties != null && item.CustomProperties.ContainsKey(customPropertyName))
         {
             fieldInfo.SetValue(config, ItemConfigurationUtil.Convert(item.CustomProperties[customPropertyName], fieldInfo.FieldType));
         }
     }
 }
Exemple #2
0
    // Token: 0x06001C26 RID: 7206 RVA: 0x0008F1C0 File Offset: 0x0008D3C0
    public static T Clone <T>(T instance) where T : class
    {
        Type            type        = instance.GetType();
        ConstructorInfo constructor = type.GetConstructor(new Type[0]);

        if (constructor != null)
        {
            T t = constructor.Invoke(new object[0]) as T;
            CloneUtil.CopyAllFields <T>(t, instance);
            return(t);
        }
        return((T)((object)null));
    }