OutputVar := instance.Equals(obj)
OutputVar := MfObject.Equals(objA, ObjB)
OutputVar := MfObject.Equals(objA, ObjB, CompareOpt)
Compares obj to current instance to see if they are the same
obj
The object to compare with current instance
Static Method
Compares objA and objB to see if they are the same. If objA and objB are vars (non-object) then they are compared as strings
objA
The first object or var to compare
objB
The second object orvar to compare.
Static Method
Compares objA and objB to see if they are the same. If objA and objB are vars (non-object) then they are compared as strings or number
depending on the value of CompareOpt.
objA
The object to compare to objB.
Can be object of any kind or var.
objB
The object to compare to objA.
Can be object of any kind or var.
CompareOpt
The options used to compare objA to objB.
Can be instance of MfEqualsOptions or MfEqualsOptions.Instance.EnumItem or integer matching one or more options of MfEqualsOptions.
Returns var containing Boolean value of true if the objects are the same; Otherwise false.
If Objects have the same memory address then they are considered to be equal. However if vars are compared the will compare by value.
That compare will be done as string or dynamicaly as set by MfEqualsOptions if CompareOpt has a flag CompareNumber set then
compare will be done on vars dynamically. If both objA and objB are numrical then they will be compared as numbers. If objA or objB are string then they will be compared as string.
If objA is a var but objB is an object then false will be returned.
if objA is an object but objB is a var then false will be returned.
if objA and objB are vars and StringCaseSense is on then they will be compare case sensitive; Otherwise compared case in-sensitive. This does not apply if CompareOpt has a flag CompareNumber set with both objA and objB numeric.
If CompareOpt has a flag CompareNumber set and StringCaseSense is on then objA and objB will be compared as case sensitive string if they are not numeric.
Any objects can be compared. It is not necessary the objects inherit from MfObject.
;--------------------------------------------------------------
i := new MfInteger(22)
j := i
; i and j have the same memory address
; the following displays True
MsgBox % MfObject.Equals(i, j) = true? "True":"False"
;--------------------------------------------------------------
i := new MfInteger(22)
j := new MfInteger(22)
; i and j have different memory address
; use MfInteger.Equals() to test MfInteger instances for Equal value
; the following displays False
MsgBox % MfObject.Equals(i, j) = true? "True":"False"
;--------------------------------------------------------------
; The following is compared as strings
; the following displays True
MsgBox % MfObject.Equals("22", 22) = true? "True":"False"
;--------------------------------------------------------------
; The following is compared as strings
; the following displays False
MsgBox % MfObject.Equals("022", 22) = true? "True":"False"
;--------------------------------------------------------------
; The following is compared as Number
opt := new MfObjectEqualsOptions()
opt.AddFlag(MfEqualsOptions.Instance.CompareNumber)
; the following displays True
MsgBox % MfObject.Equals("022", 22, opt) = true? "True":"False"
;--------------------------------------------------------------
; The following is compared as Number
; 1 is the numerical value of MfEqualsOptions.Instance.CompareNumber
; the following displays True
MsgBox % MfObject.Equals("022", 22, 1) = true? "True":"False"
;--------------------------------------------------------------
StringCaseSense On
; The following is compared as case sensitive strings
; the following displays False
MsgBox % MfObject.Equals("abc", "aBc") = true? "True":"False"
;--------------------------------------------------------------
StringCaseSense Off
; The following is compared as case sensitive strings
; the following displays True
MsgBox % MfObject.Equals("abc", "aBc") = true? "True":"False"