main
1namespace MoMoney.Service.Infrastructure.Security
2{
3 public class Role
4 {
5 readonly string name;
6
7 public Role(string name)
8 {
9 this.name = name;
10 }
11
12 static public implicit operator string(Role role)
13 {
14 return role.name;
15 }
16
17 static public implicit operator Role(string role)
18 {
19 return new Role(role);
20 }
21
22 public bool Equals(Role other)
23 {
24 if (ReferenceEquals(null, other)) return false;
25 if (ReferenceEquals(this, other)) return true;
26 return Equals(other.name, name);
27 }
28
29 public override bool Equals(object obj)
30 {
31 if (ReferenceEquals(null, obj)) return false;
32 if (ReferenceEquals(this, obj)) return true;
33 if (obj.GetType() != typeof (Role)) return false;
34 return Equals((Role) obj);
35 }
36
37 public override int GetHashCode()
38 {
39 return (name != null ? name.GetHashCode() : 0);
40 }
41 }
42}