最近工作的时候遇到一个问题,根据Web端接收到的对象obj1,更新对应的对象值ogj2。先判断obj1中属性值是否为null,

若不等于null,则更新obj2中对应属性值;若等于null,则保持obj2中对应属性值不变。

      先创建Student Class:

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 
 6 namespace Property
 7 {
 8     public class Student
 9     {
10         public string Name { get; set; }
11 
12         public string  number { get; set; }
13 
14         public string School {get;set;}
15 
16         public string  Score { get; set; }
17     }
18 }
View Code

相关文章: