Example #1
0
        public object Clone()
        {
            var otherEmail = new Email();

            this.SetPropertyValues(otherEmail);

            return otherEmail;
        }
Example #2
0
        private void SetPropertyValues(Email otherEmail)
        {
            var propertyInfo = this.GetType().GetProperties().Where(p => p.CanWrite && (p.PropertyType.IsValueType || p.PropertyType.IsEnum || p.PropertyType.Equals(typeof(System.String))));

            foreach (PropertyInfo property in propertyInfo)
            {
                if (property.CanWrite)
                {
                    property.SetValue(otherEmail, property.GetValue(this, null), null);
                }
            }
        }