2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 /// The Size is a struct that defining height and width as a pair of generic type.
24 public struct Size : IEquatable<Size>
27 /// Magnitude along the horizontal axis, in platform-defined units.
32 /// Magnitude along the vertical axis, in platform-specific units.
37 /// Initializes a new instance of the Size structure from the specified dimensions.
39 /// <param name="width">The width to set</param>
40 /// <param name="height">The height to set</param>
41 public Size(int width, int height)
48 /// A human-readable representation of the <see cref="T:Tizen.UI.Size" />.
50 /// <returns>The string is formatted as "{{Width={0} Height={1}}}".</returns>
51 public override string ToString()
53 return string.Format("{{Width={0} Height={1}}}", Width, Height);
56 public override int GetHashCode()
60 return Width.GetHashCode() ^ (Height.GetHashCode() * 397);
64 public override bool Equals(object obj)
69 return Equals((Size)obj);
72 public bool Equals(Size other)
74 return Width.Equals(other.Width) && Height.Equals(other.Height);
78 /// Whether the two <see cref="T:Tizen.UI.Size" />s are equal.
80 /// <param name="s1">A <see cref="T:Tizen.UI.Size" /> on the left hand side.</param>
81 /// <param name="s2">A <see cref="T:Tizen.UI.Size" /> on the right hand side.</param>
82 /// <returns>True if the two <see cref="T:Tizen.UI.Size" />s have equal values.</returns>
83 public static bool operator ==(Size s1, Size s2)
89 /// Whether two <see cref="T:Tizen.UI.Size" />s are not equal.
91 /// <param name="s1">A <see cref="T:Tizen.UI.Size" /> on the left hand side.</param>
92 /// <param name="s2">A <see cref="T:Tizen.UI.Size" /> on the right hand side.</param>
93 /// <returns>True if the two <see cref="T:Tizen.UI.Size" />s do not have equal values.</returns>
94 public static bool operator !=(Size s1, Size s2)
96 return !s1.Equals(s2);