當前位置: 首頁>>代碼示例>>C#>>正文


C# Operand.Eq方法代碼示例

本文整理匯總了C#中TriAxis.RunSharp.Operand.Eq方法的典型用法代碼示例。如果您正苦於以下問題:C# Operand.Eq方法的具體用法?C# Operand.Eq怎麽用?C# Operand.Eq使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TriAxis.RunSharp.Operand的用法示例。


在下文中一共展示了Operand.Eq方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Compute

 private Operand Compute(Operand leftValue, string oper, Operand rightValue = null) {
     if (rightValue as object == null) {
         switch (oper) {
             case "+":
                 return +leftValue;
             case "-":
                 return -leftValue;
             case "!":
                 return !leftValue;
             case "~":
                 return ~leftValue;
             default:
                 throw new Exception("invalid unary operator "+ oper);
         }
     }
     else {
         switch (oper) {
             case "+":
                 return leftValue + rightValue;
             case "-":
                 return leftValue - rightValue;
             case "*":
                 return leftValue * rightValue;
             case "/":
                 return leftValue / rightValue;
             case "%":
                 return leftValue % rightValue;
             case ">>":
                 return leftValue.RightShift(rightValue);
             case "<<":
                 return leftValue.LeftShift(rightValue);
             case "&":
                 return leftValue.BitwiseOr(rightValue);
             case "|":
                 return leftValue.BitwiseOr(rightValue);
             case "^":
                 return leftValue.Xor(rightValue);
             case "&&":
                 return leftValue.LogicalAnd(rightValue);
             case "||":
                 return leftValue.LogicalOr(rightValue);
             case ">":
                 return leftValue.Gt(rightValue);
             case "<":
                 return leftValue.Lt(rightValue);
             case ">=":
                 return leftValue.Ge(rightValue);
             case "<=":
                 return leftValue.Le(rightValue);
             case "==":
                 return leftValue.Eq(rightValue);
             case "!=":
                 return leftValue.Ne(rightValue);
             case "^^":
                 throw new Exception("operator " + oper + "not implemented");
             default:
                 throw new Exception("invalid operator " +oper);        
         }
     }
 }
開發者ID:zackszhu,項目名稱:ZodiacLanguage,代碼行數:60,代碼來源:CodeGenerator.cs


注:本文中的TriAxis.RunSharp.Operand.Eq方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。