Improve error handling
[mono.git] / mcs / class / System.Web / System.Web.UI / DataBinding.cs
1 //
2 // System.Web.UI.DataBinding.cs
3 //
4 // Authors:
5 //      Duncan Mak  (duncan@ximian.com)
6 //      Gonzalo Paniagua Javier (gonzalo@ximian.com)
7 //
8 // (C) 2002 Ximian, Inc. (http://www.ximian.com)
9 //
10
11 using System;
12
13 namespace System.Web.UI {
14
15         public sealed class DataBinding
16         {
17                 string propertyName;
18                 Type propertyType;
19                 string expression;
20
21                 public DataBinding (string propertyName, Type propertyType,
22                                     string expression)
23                 {
24                         this.propertyName = propertyName;
25                         this.propertyType = propertyType;
26                         this.expression = expression;
27                 }
28
29                 public string Expression {
30                         get { return expression; }
31                         set { expression = value; }
32                 }
33
34                 public string PropertyName {
35                         get { return propertyName; }
36                 }
37
38                 public Type PropertyType {
39                         get { return propertyType; }
40                 }
41
42                 public override bool Equals (object obj)
43                 {
44                         if (!(obj is DataBinding))
45                                 return false;
46                         
47                         DataBinding o = (DataBinding) obj;
48                         return (o.Expression == expression &&
49                                 o.PropertyName == propertyName &&
50                                 o.PropertyType == propertyType);
51                 }
52
53                 public override int GetHashCode ()
54                 {
55                         return propertyName.GetHashCode () +
56                                (propertyType.GetHashCode () << 1) +
57                                (expression.GetHashCode () << 2) ;
58                 }
59         }
60 }