本文整理匯總了C#中BinaryOperatorType.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# BinaryOperatorType.ToString方法的具體用法?C# BinaryOperatorType.ToString怎麽用?C# BinaryOperatorType.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BinaryOperatorType
的用法示例。
在下文中一共展示了BinaryOperatorType.ToString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetBinaryOperatorText
//.........這裏部分代碼省略.........
return "/";
}
case BinaryOperatorType.GreaterThan:
{
return ">";
}
case BinaryOperatorType.GreaterThanOrEqual:
{
return ">=";
}
case BinaryOperatorType.LessThan:
{
return "<";
}
case BinaryOperatorType.LessThanOrEqual:
{
return "<=";
}
case BinaryOperatorType.Modulus:
{
return "%";
}
case BinaryOperatorType.Member:
{
return "in";
}
case BinaryOperatorType.NotMember:
{
return "not in";
}
case BinaryOperatorType.ReferenceEquality:
{
return "is";
}
case BinaryOperatorType.ReferenceInequality:
{
return "is not";
}
case BinaryOperatorType.TypeTest:
{
return "isa";
}
case BinaryOperatorType.Or:
{
return "or";
}
case BinaryOperatorType.And:
{
return "and";
}
case BinaryOperatorType.BitwiseOr:
{
return "|";
}
case BinaryOperatorType.BitwiseAnd:
{
return "&";
}
case BinaryOperatorType.ExclusiveOr:
{
return "^";
}
case BinaryOperatorType.ShiftLeft:
{
return "<<";
}
case BinaryOperatorType.ShiftRight:
{
return ">>";
}
case BinaryOperatorType.InPlaceShiftLeft:
{
return "<<=";
}
case BinaryOperatorType.InPlaceShiftRight:
{
return ">>=";
}
}
throw new NotImplementedException(op.ToString());
}
示例2: GetBinaryNumericPromotionCode
internal static TypeCode GetBinaryNumericPromotionCode(Type left, Type right, BinaryOperatorType exceptionType, bool raiseException)
{
TypeCode leftTC = Type.GetTypeCode(left);
TypeCode rightTC = Type.GetTypeCode(right);
Dictionary<TypeCode, TypeCode> rights;
if(!BinaryNumericPromotions.TryGetValue(leftTC, out rights)) {
if(raiseException)
throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, FilteringExceptionsText.ExpressionEvaluatorOperatorSubtypeNotSupportedForSpecificOperandType, typeof(BinaryOperator).Name, exceptionType.ToString(), left.FullName));
else return TypeCode.Object;
}
TypeCode result;
if(!rights.TryGetValue(rightTC, out result)) {
if(raiseException)
throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, FilteringExceptionsText.ExpressionEvaluatorOperatorSubtypeNotSupportedForSpecificOperandType, typeof(BinaryOperator).Name, exceptionType.ToString(), right.FullName));
else return TypeCode.Object;
}
return result;
}
示例3: GetMethodNameForOperator
public static string GetMethodNameForOperator(BinaryOperatorType op)
{
return "op_" + op.ToString();
}