internal static void CopyProperties(RequestMessageBase source, RequestMessageBase target)
 {
     Type sourceType = source.GetType();
     Type targetType = target.GetType();
     foreach (PropertyInfo property in targetType.GetProperties())
     {
         if (property.CanWrite == true)
         {
             var sourceProperty = sourceType.GetProperty(property.Name);
             if (sourceProperty != null)
             {
                 if (sourceProperty.GetValue(source, null) != null)
                 {
                     property.SetValue(target, sourceProperty.GetValue(source, null), null);
                 }
             }
         }
     }
 }
示例#2
0
        internal static void CopyProperties(RequestMessageBase source, RequestMessageBase target)
        {
            Type sourceType = source.GetType();
            Type targetType = target.GetType();

            foreach (PropertyInfo property in targetType.GetProperties())
            {
                if (property.CanWrite == true)
                {
                    var sourceProperty = sourceType.GetProperty(property.Name);
                    if (sourceProperty != null)
                    {
                        if (sourceProperty.GetValue(source, null) != null)
                        {
                            property.SetValue(target, sourceProperty.GetValue(source, null), null);
                        }
                    }
                }
            }
        }