コード例 #1
0
 public void CopyTo(article article)
 {
     foreach (var propertyInfo in article.GetType().GetProperties())
     {
         if (!propertyInfo.Name.Contains("Id") && (propertyInfo.PropertyType.IsValueType || propertyInfo.PropertyType.Name == "String"))
         {
             propertyInfo.SetValue(article, propertyInfo.GetValue(this));
         }
     }
 }
コード例 #2
0
 public NewArticleModel(article article)
 {
     foreach (var propertyInfo in article.GetType().GetProperties())
     {
         if (propertyInfo.PropertyType.IsValueType || propertyInfo.PropertyType.Name == "String")
         {
             propertyInfo.SetValue(this, propertyInfo.GetValue(article));
         }
     }
     SubCategories = article.articlesubcategory.Select(sc => sc.CategoryId).ToList();
 }