xtd
0.2.0
Loading...
Searching...
No Matches
◆
equals()
[2/2]
template<typename object_a_t , typename object_b_t >
static bool xtd::object::equals
(
const object_a_t &
object_a
,
const object_b_t &
object_b
)
inline
static
noexcept
Determines whether the specified object instances are considered equal.
Parameters
object_a
The first object to compare.
object_b
The second object to compare.
Returns
true if object_a is the same instance as object_b or if both are null references or if object_a(object_b) returns true. otherwise, false.
Examples
The following code example compares different objects.
#include <xtd/console>
using namespace
xtd
;
auto
main() ->
int
{
string
s1 =
"Tom"
;
string
s2 =
"Carol"
;
console::write_line
(
"object::equals(\"{0}\", \"{1}\") => {2}"
, s1, s2,
object::equals
(s1, s2));
s1 =
"Tom"
;
s2 =
"Tom"
;
console::write_line
(
"object::equals(\"{0}\", \"{1}\") => {2}"
, s1, s2,
object::equals
(s1, s2));
s1 =
""
;
s2 =
"Tom"
;
console::write_line
(
"object::equals(\"{0}\", \"{1}\") => {2}"
, s1, s2,
object::equals
(s1, s2));
s1 =
"Carol"
;
s2 =
""
;
console::write_line
(
"object::equals(\"{0}\", \"{1}\") => {2}"
, s1, s2,
object::equals
(s1, s2));
s1 =
""
;
s2 =
""
;
console::write_line
(
"object::equals(\"{0}\", \"{1}\") => {2}"
, s1, s2,
object::equals
(s1, s2));
}
// This code produces the following output :
//
// object::equals("Tom", "Carol") => false
// object::equals("Tom", "Tom") => true
// object::equals("", "Tom") => false
// object::equals("Carol", "") => false
// object::equals("", "") => true
xtd::console::write_line
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
xtd::object::equals
virtual bool equals(const object &obj) const noexcept
Determines whether the specified object is equal to the current object.
xtd
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition
xtd_about_box.h:10
xtd
object
Generated on Sat Sep 14 2024 21:25:18 for xtd by
Gammasoft
. All rights reserved.