本文整理汇总了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();
}