Recipientinfo. CS
Code
1 using system;
2 using system. Collections. Generic;
3 using system. text;
4
5 namespace leleapplication1
6 {
7 public class recipientinfo
8 {
9 // recipient class, including the email address and recipient's name
10 private string mailaddress;
11 private string name;
12
13 public recipientinfo (string mailaddress, string name)
14 {
15 this. mailaddress = mailaddress;
16 this. Name = Name;
17}
18
19 Public String mailaddress
20 {
21 get {return mailaddress ;}
22 set {mailaddress = value ;}
23}
24
25 public string name
26 {
27 get {return name ;}
28 set {name = value ;}
29}
30
31 public override bool equals (Object OBJ)
32 {
33 If (OBJ = NULL)
34 {
35 return false;
36}
37
38 If (obj. GetType () = typeof (recipientinfo ))
39 {
40 if (this. name. trim () = (recipientinfo) OBJ ). name. trim () & this. mailaddress. trim () = (recipientinfo) OBJ ). mailaddress. trim ())
41 {
42 return true;
43}
44 else
45 {
46 Return false;
47}
48}
49 else
50 {
51 return false;
52}
53}
54}
55}
56
Call page:
Code
1 List <recipientinfo> List = new list <recipientinfo> ();
2
3 recipientinfo info1 = new recipientinfo ("ss@ss.com", "name1 ");
4 recipientinfo info2 = new recipientinfo ("ss@ss.com", "name2 ");
5 recipientinfo info3 = new recipientinfo ("ss@ss.com", "name1 ");
6
7 List. Add (info1 );
8 list. Add (info2 );
9
10 if (list. Contains (info3 ))
11 {
12 console. writeline ("pinned ded ");
13}
Output result, encoded DED