1 ///****************************************************************************
2 /// CLR版本 :4.0.30319.42000
3 /// 邮 箱 :282780854@qq.com
4 /// 博 客 :https://www.cnblogs.com/it89/
5 /// 创 建 者 :龙腾虎跃
6 /// 创建日期 :2019/1/15 21:03:04
7 /// 功能描述 :
8 /// 使用说明 :
9 ///****************************************************************************
10 using System;
11 using System.ComponentModel;
12 using System.Runtime.CompilerServices;
13
14 namespace TestDataGridViewBind
15 {
16 /// <summary>
17 ///
18 /// </summary>
19 public class People : INotifyPropertyChanged
20 {
21 #region "Public Section"
22 public string Name
23 {
24 get => mName;
25 set { mName = value; NotifyPropertyChanged("Name"); }
26 }
27
28 public string Address
29 {
30 get => mAddresss;
31 set { mAddresss = value; NotifyPropertyChanged("Address"); }
32 }
33
34 public int Age
35 {
36 get => mAge;
37 set { mAge = value; NotifyPropertyChanged("Age"); }
38 }
39
40 public People(string name, string address, int age)
41 {
42 mName = name;
43 mAddresss = address;
44 mAge = age;
45 }
46
47 public event PropertyChangedEventHandler PropertyChanged;
48
49 #endregion
50
51 #region "Private Section"
52 private string mName;
53 private string mAddresss;
54 private int mAge;
55
56 /// <summary>
57 /// 该方法由每个属性Set访问器调用。
58 /// </summary>
59 /// <param name="propertyName"></param>
60 private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
61 {
62 PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
63 }
64
65 #endregion
66 }
67 }