Esempio n. 1
0
        public object Clone()
        {
            PropertyInfo[] properties = this.GetType().GetProperties();
            FeedItem       newItem    = new FeedItem();

            foreach (PropertyInfo propInfo in properties)
            {
                PropertyInfo newPropInfo = newItem.GetType().GetProperty(propInfo.Name);
                newPropInfo.SetValue(newItem, propInfo.GetValue(this, null), null);
            }
            FieldInfo[] fields = this.GetType().GetFields();
            foreach (FieldInfo fieldInfo in fields)
            {
                FieldInfo newFieldInfo = newItem.GetType().GetField(fieldInfo.Name);
                newFieldInfo.SetValue(newItem, fieldInfo.GetValue(this));
            }
            newItem.GUID = Guid.NewGuid().ToString();
            return(newItem);
        }