2 // System.Windows.Forms.DataGridCell.cs
5 // Dennis Hayes (dennish@raytek.com)
7 // (C) 2002 Ximian, Inc. http://www.ximian.com
12 namespace System
.Windows
.Forms
{
14 public struct DataGridCell
{
16 private int rownumber
;
17 private int columnnumber
;
19 // -----------------------
21 // -----------------------
31 public DataGridCell (int r
, int c
)
37 // -----------------------
38 // Public Shared Members
39 // -----------------------
42 /// Compares two DataGridCell objects. The return value is
43 /// based on the equivalence of the RowNumber and ColumnNumber properties of the two objects.
46 public static bool operator == (DataGridCell dgc_a
,
49 return ((dgc_a
.rownumber
== dgc_b
.rownumber
) &&
50 (dgc_a
.columnnumber
== dgc_b
.columnnumber
));
54 /// Inequality Operator
58 /// Compares two DataGridCell objects. The return value is
59 /// based on the equivalence of the RowNumber and ColumnNumber properties of the two objects.
61 public static bool operator != (DataGridCell dgc_a
,
63 return ((dgc_a
.rownumber
!= dgc_b
.rownumber
) ||
64 (dgc_a
.columnnumber
!= dgc_b
.columnnumber
));
67 // -----------------------
68 // Public Instance Members
69 // -----------------------
72 public int RowNumber
{
81 public int ColumeNumber
{
95 /// Checks equivalence of this DataGridCell and another object.
98 public override bool Equals (object obj
)
100 if (!(obj
is DataGridCell
))
103 return (this == (DataGridCell
) obj
);
107 /// GetHashCode Method
111 /// Calculates a hashing value.
114 public override int GetHashCode ()
116 return (int)( rownumber ^ columnnumber
);
124 /// Formats the DataGridCell as a string.
127 public override string ToString ()
129 return String
.Format ("[{0},{1}]", rownumber
, columnnumber
);