I am doing C #, with no experience with VB, and I don't have VB. I look at the code below to understand how this works, can someone take a look at this?
So, if I call this method with Cat and Cat and do not pass an optional parameter, does it return true and say that Cat and Cat are equal?
Public Function AreStringsEqual(ByRef sString1 As String, ByRef sString2 As String, Optional ByVal eCompareMethod As VbCompareMethod = vbBinaryCompare) As Boolean If LenB(sString1) = LenB(sString2) Then If LenB(sString1) = 0 Then AreStringsEqual = True ElseIf eCompareMethod = vbBinaryCompare Then AreStringsEqual = (InStrB(1, sString1, sString2, eCompareMethod) <> 0) Else AreStringsEqual = (StrComp(sString1, sString2, eCompareMethod) = 0) End If End If End Function
source share