DataBinding.cs 1.2 KB

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