This functoid does not take a lot of explanation, it simply fills another gap in the
functoid library.  For those who may not be familiar with the glories of XOR,
allow me to present the truth table for it.

As you can see, the difference between this operator and “Or” is that when both inputs
are true, it returns false.  This is very nice when you need to handle edge cases
where you could use either x or y but want to do something different
when both are present.

The code, as always, is included below.  I’m trying Scott Dunn’s Windows
Live Writer Code Formatter on this post for the first time.  If there are problems,
let me know and I’ll go back to CopySourceAsHtml which I have been using.
 
Scratch that, it just blew up as I tried to publish this post, so we’re back to using
CopySourceAsHtml.

Download
TimRayburn.CustomFunctoids v1.0

 

   13     
   public LogicalXorFunctoid()
   14     
       : base()
   15     
   {
   16     
       // Assign a "unique" id
to this functiod.
   17     
       this.ID = 24605;
   18 
   19     
       // Setup the resource assembly
to use.
   20     
       SetupResourceAssembly(
   21     
          "TimRayburn.CustomFunctoids.CustomFunctoidsResources",
   22     
          Assembly.GetExecutingAssembly());
   23 
   24     
       SetName("IDS_LOGICALXORFUNCTOID_NAME");
   25     
       SetTooltip("IDS_LOGICALXORFUNCTOID_TOOLTIP");
   26     
       SetDescription("IDS_LOGICALXORFUNCTOID_DESCRIPTION");
   27     
       SetBitmap("IDS_LOGICALXORFUNCTOID_BITMAP");
   28 
   29     
       this.SetMinParams(2);
   30     
       this.SetMaxParams(2);
   31 
   32     
       //set the function name
that needs to be 
   33     
       //called when this Functoid
is invoked. This means that
   34     
       //this Functoid assembly
need to be present in GAC 
   35     
       //for its availability
during Test..Map and Runtime.
   36     
       SetExternalFunctionName(this.GetType().Assembly.FullName,
   37     
          "TimRayburn.CustomFunctoids.LogicalXorFunctoid",
   38     
          "LogicalXor");
   39 
   40     
       this.Category = FunctoidCategory.Logical;
   41     
       this.OutputConnectionType
= ConnectionType.AllExceptRecord;
   42 
   43     
       AddInputConnectionType(ConnectionType.AllExceptRecord);
   44     
   }
   45 
   46     
   public string LogicalXor(string firstVal, string secondVal)
   47     
   {
   48     
       bool bFirst = System.Convert.ToBoolean(firstVal);
   49     
       bool bSecond = System.Convert.ToBoolean(secondVal);
   50     
       bool result = bFirst
^ bSecond;
   51 
   52     
       if (result)
   53     
          return "true";
   54     
       else
   55     
          return "false";
   56     
   }
   57    
}