Luke Luke - 1 year ago 62 Question

Xor doesn't fire

No more answers please, the problem was solved. Skip to the end of the question to see what i have done wrong.

I am running the following
to read the syntax of a specific standard either by
reads the
file first
to get the string) or by the
itself (
skips file reading

Public Function ReadStandard(Optional ByVal FilePath As String = Nothing, _
Optional ByVal Standard_Text As String = Nothing) As Boolean

to make this possible only one of those parameter must be set, while the other must not be set. I do not want to use a function like

Public Function ReadStandard(str as String, isFilePath as Booelean) As Boolean

So to make this possible I want to use Xor, since it should do the exact job
(if you pass 2 Booleans to XOR it should only return True, when A != B). Doing some research i found that this works in MSDN

But for some reason it doesn't work for me;

If IsNothing(FilePath) Xor IsNothing(Standard_Text) Then (...)

Is there a reason for it? Or did I forget what i learned back in the days?

Turns out that I just mixed something up in my logic. In the following function I forgot to put the
into the

If Not (IsNothing(FilePath) Xor IsNothing(Standard_Text)) Then
Throw New ArgumentException("FilePath or Standard_Text must be set.")
Return False
End If

Answer Source

XOR can be thought of as binary addition without carry.

    If False Xor False Then '0+0
    End If

    If True Xor False Then '1+0
    End If

    If False Xor True Then '0+1
    End If

    If True Xor True Then '1+1
    End If
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download