1 // Copyright 2016 by Samsung Electronics, Inc.,
3 // This software is the confidential and proprietary information
4 // of Samsung Electronics, Inc. ("Confidential Information"). You
5 // shall not disclose such Confidential Information and shall use
6 // it only in accordance with the terms of the license agreement
7 // you entered into with Samsung.
14 /// Struct defining height and width as a pair of generic type.
16 public struct Size : IEquatable<Size>
19 /// Magnitude along the horizontal axis, in platform-defined units.
24 /// Magnitude along the vertical axis, in platform-specific units.
29 /// Initializes a new instance of the Size structure from the specified dimensions.
31 /// <param name="width">The width to set</param>
32 /// <param name="height">The height to set</param>
33 public Size(int width, int height)
40 /// A human-readable representation of the <see cref="T:Tizen.UI.Size" />.
42 /// <returns>The string is formatted as "{{Width={0} Height={1}}}".</returns>
43 public override string ToString()
45 return string.Format("{{Width={0} Height={1}}}", Width, Height);
49 /// Returns a hash value for the <see cref="T:Tizen.UI.Size" />.
51 /// <returns>A value intended for efficient insertion and lookup in hashtable-based data structures.</returns>
52 public override int GetHashCode()
56 return Width.GetHashCode() ^ (Height.GetHashCode() * 397);
61 /// Returns true if the Width and Height values of this are exactly equal to those in the argument.
63 /// <param name="obj">Another <see cref="T:Tizen.UI.Size" />.</param>
64 /// <returns>True if the Width and Height values are equal to those in <paramref name="obj" />. Returns false if <paramref name="obj" /> is not a <see cref="T:Tizen.UI.Size" />.</returns>
65 public override bool Equals(object obj)
70 return Equals((Size)obj);
74 /// Returns true if the Width and Height values of this are exactly equal to those in the argument.
76 /// <param name="other">Another <see cref="T:Tizen.UI.Size" />.</param>
77 /// <returns>True if the Width and Height values are equal to those in <paramref name="other" />.</returns>
78 public bool Equals(Size other)
80 return Width.Equals(other.Width) && Height.Equals(other.Height);
84 /// Whether the two <see cref="T:Tizen.UI.Size" />s are equal.
86 /// <param name="s1">A <see cref="T:Tizen.UI.Size" /> on the left hand side.</param>
87 /// <param name="s2">A <see cref="T:Tizen.UI.Size" /> on the right hand side.</param>
88 /// <returns>True if the two <see cref="T:Tizen.UI.Size" />s have equal values.</returns>
89 public static bool operator ==(Size s1, Size s2)
95 /// Whether two <see cref="T:Tizen.UI.Size" />s are not equal.
97 /// <param name="s1">A <see cref="T:Tizen.UI.Size" /> on the left hand side.</param>
98 /// <param name="s2">A <see cref="T:Tizen.UI.Size" /> on the right hand side.</param>
99 /// <returns>True if the two <see cref="T:Tizen.UI.Size" />s do not have equal values.</returns>
100 public static bool operator !=(Size s1, Size s2)
102 return !s1.Equals(s2);