ObjectBase: ToString

ToString

Returns a string representation of the object instance with optional project name.



 Public Function ToString(
	  ByVal Obj As IObject,
	  Optional ByVal AppObject As Object ) As String

Parameters

Obj
[ByVal] IObject. The object to return a string representation of.
AppObject
[ByVal] Optional. Object. The classes App object used to determine the project name.

Return Values

String -  Returns a combination of the object type name and project name.

Remarks

The implementer of the IObject interface can use this method as the default behavior, or create custom behavior using their own logic.

Examples

This example shows the typical implementation of the IObject interface using the MyBase methods for default behavior.

Option Explicit
Implements IObject


Public Function Equals(ByRef Value As Variant) As Boolean
    Equals = MyBase.Equals(Me, Value)
End Function

Public Function GetHashCode() As Long
    GetHashCode = MyBase.GetHashCode(Me)
End Function

Public Function ToString() As String
    ToString = MyBase.ToString(Me, App)
End Function


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IObject
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IObject_Equals(Value As Variant) As Boolean
    IObject_Equals = Equals(Value)
End Function

Private Function IObject_GetHashCode() As Long
    IObject_GetHashCode = GetHashCode
End Function

Private Function IObject_ToString() As String
    IObject_ToString = ToString
End Function

See Also

Project CorLib Overview

Class ObjectBase Overview