Provides common behavior for ref classes and ref structs in Windows Runtime apps. All ref class and ref struct instances are implicitly convertible to Platform::Object^ and can override its virtual ToString method.
Syntaxpublic ref class Object : Object
Members Public Constructors Name Description Object::Object Initializes a new instance of the Object class. Public Methods Inheritance Hierarchy
Object
Object
Header: vccorlib.h
Namespace: Platform
Object::Equals MethodDetermines whether the specified object is equal to the current object.
Syntaxbool Equals(
Object^ obj
)
Parameters
obj
The object to compare.
true
if the objects are equal, otherwise false
.
Returns the IUnknown
* identity value for this instance if it is a COM object, or a computed hash value if it is not a COM object.
public:int GetHashCode();
Return Value
A numeric value that uniquely identifies this object.
You can use GetHashCode to create keys for objects in maps. You can compare hash codes by using Object::Equals. If the code path is extremely critical and GetHashCode
and Equals
are not sufficiently fast, then you can drop down to the underlying COM layer and do native IUnknown
pointer comparisons.
Returns a Platform::Type object that describes the runtime type of an object.
SyntaxObject::GetType();
Property Value/Return Value
A Platform::Type object that describes the runtime type of the object.
The static Type::GetTypeCode can be used to get a Platform::TypeCode Enumeration value that represents the current type. This is mostly useful for built-in types. The type code for any ref class besides Platform::String is Object (1).
The Windows::UI::Xaml::Interop::TypeName class is used in the Windows APIs as a language-independent way of passing type information between Windows components and apps. The Platform::Type Class has operators for converting between Type
and TypeName
.
Use the typeid operator to return a Platform::Type
object for a class name, for example when navigating between XAML pages:
rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
Object::Object Constructor
Initializes a new instance of the Object class.
Syntaxpublic:Object();
Object::ReferenceEquals Method
Determines whether the specified Object instances are the same instance.
Syntaxpublic:static bool ReferenceEquals( Object^ obj1, Object^ obj2);
Parameters
obj1
The first object to compare.
obj2
The second object to compare.
true
if the two objects are the same; otherwise, false
.
Returns a string that represents the current object.
Syntaxpublic:
virtual String^ ToString();
Return Value
A string that represents the current object. You can override this method to provide a custom string message in your ref class or struct:
public ref class Tree sealed
{
public:
Tree(){}
virtual Platform::String^ ToString() override
{
return "I'm a Tree";
}
};
See also
Platform Namespace
Platform::Type Class
Type System
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4