当前位置: 首页>>代码示例>>C#>>正文


C# UnaryOperatorKind.OperatorIndex方法代码示例

本文整理汇总了C#中UnaryOperatorKind.OperatorIndex方法的典型用法代码示例。如果您正苦于以下问题:C# UnaryOperatorKind.OperatorIndex方法的具体用法?C# UnaryOperatorKind.OperatorIndex怎么用?C# UnaryOperatorKind.OperatorIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnaryOperatorKind的用法示例。


在下文中一共展示了UnaryOperatorKind.OperatorIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OpKind

 public static UnaryOperatorKind OpKind(UnaryOperatorKind kind, TypeSymbol operand)
 {
     int? index = TypeToIndex(operand);
     if (index == null)
     {
         return UnaryOperatorKind.Error;
     }
     var result = opkind[kind.OperatorIndex()][index.Value];
     return result == UnaryOperatorKind.Error ? result : result | kind;
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:10,代码来源:Operators.cs

示例2: GetSimpleBuiltInOperators


//.........这里部分代码省略.........
                        GetSignature(UnaryOperatorKind.CharPrefixIncrement),
                        GetSignature(UnaryOperatorKind.FloatPrefixIncrement),
                        GetSignature(UnaryOperatorKind.DoublePrefixIncrement),
                        GetSignature(UnaryOperatorKind.DecimalPrefixIncrement),
                        GetSignature(UnaryOperatorKind.LiftedSBytePrefixIncrement),
                        GetSignature(UnaryOperatorKind.LiftedBytePrefixIncrement),
                        GetSignature(UnaryOperatorKind.LiftedShortPrefixIncrement),
                        GetSignature(UnaryOperatorKind.LiftedUShortPrefixIncrement),
                        GetSignature(UnaryOperatorKind.LiftedIntPrefixIncrement),
                        GetSignature(UnaryOperatorKind.LiftedUIntPrefixIncrement),
                        GetSignature(UnaryOperatorKind.LiftedLongPrefixIncrement),
                        GetSignature(UnaryOperatorKind.LiftedULongPrefixIncrement),
                        GetSignature(UnaryOperatorKind.LiftedCharPrefixIncrement),
                        GetSignature(UnaryOperatorKind.LiftedFloatPrefixIncrement),
                        GetSignature(UnaryOperatorKind.LiftedDoublePrefixIncrement),
                        GetSignature(UnaryOperatorKind.LiftedDecimalPrefixIncrement),
                    }).AsImmutableOrNull(),
                    (new []
                    {
                        GetSignature(UnaryOperatorKind.SBytePrefixDecrement),
                        GetSignature(UnaryOperatorKind.BytePrefixDecrement),
                        GetSignature(UnaryOperatorKind.ShortPrefixDecrement),
                        GetSignature(UnaryOperatorKind.UShortPrefixDecrement),
                        GetSignature(UnaryOperatorKind.IntPrefixDecrement),
                        GetSignature(UnaryOperatorKind.UIntPrefixDecrement),
                        GetSignature(UnaryOperatorKind.LongPrefixDecrement),
                        GetSignature(UnaryOperatorKind.ULongPrefixDecrement),
                        GetSignature(UnaryOperatorKind.CharPrefixDecrement),
                        GetSignature(UnaryOperatorKind.FloatPrefixDecrement),
                        GetSignature(UnaryOperatorKind.DoublePrefixDecrement),
                        GetSignature(UnaryOperatorKind.DecimalPrefixDecrement),
                        GetSignature(UnaryOperatorKind.LiftedSBytePrefixDecrement),
                        GetSignature(UnaryOperatorKind.LiftedBytePrefixDecrement),
                        GetSignature(UnaryOperatorKind.LiftedShortPrefixDecrement),
                        GetSignature(UnaryOperatorKind.LiftedUShortPrefixDecrement),
                        GetSignature(UnaryOperatorKind.LiftedIntPrefixDecrement),
                        GetSignature(UnaryOperatorKind.LiftedUIntPrefixDecrement),
                        GetSignature(UnaryOperatorKind.LiftedLongPrefixDecrement),
                        GetSignature(UnaryOperatorKind.LiftedULongPrefixDecrement),
                        GetSignature(UnaryOperatorKind.LiftedCharPrefixDecrement),
                        GetSignature(UnaryOperatorKind.LiftedFloatPrefixDecrement),
                        GetSignature(UnaryOperatorKind.LiftedDoublePrefixDecrement),
                        GetSignature(UnaryOperatorKind.LiftedDecimalPrefixDecrement),
                    }).AsImmutableOrNull(),
                    (new []
                    {
                        GetSignature(UnaryOperatorKind.IntUnaryPlus),
                        GetSignature(UnaryOperatorKind.UIntUnaryPlus),
                        GetSignature(UnaryOperatorKind.LongUnaryPlus),
                        GetSignature(UnaryOperatorKind.ULongUnaryPlus),
                        GetSignature(UnaryOperatorKind.FloatUnaryPlus),
                        GetSignature(UnaryOperatorKind.DoubleUnaryPlus),
                        GetSignature(UnaryOperatorKind.DecimalUnaryPlus),
                        GetSignature(UnaryOperatorKind.LiftedIntUnaryPlus),
                        GetSignature(UnaryOperatorKind.LiftedUIntUnaryPlus),
                        GetSignature(UnaryOperatorKind.LiftedLongUnaryPlus),
                        GetSignature(UnaryOperatorKind.LiftedULongUnaryPlus),
                        GetSignature(UnaryOperatorKind.LiftedFloatUnaryPlus),
                        GetSignature(UnaryOperatorKind.LiftedDoubleUnaryPlus),
                        GetSignature(UnaryOperatorKind.LiftedDecimalUnaryPlus),
                    }).AsImmutableOrNull(),
                    (new []
                    {
                        GetSignature(UnaryOperatorKind.IntUnaryMinus),
                        GetSignature(UnaryOperatorKind.LongUnaryMinus),
                        GetSignature(UnaryOperatorKind.FloatUnaryMinus),
                        GetSignature(UnaryOperatorKind.DoubleUnaryMinus),
                        GetSignature(UnaryOperatorKind.DecimalUnaryMinus),
                        GetSignature(UnaryOperatorKind.LiftedIntUnaryMinus),
                        GetSignature(UnaryOperatorKind.LiftedLongUnaryMinus),
                        GetSignature(UnaryOperatorKind.LiftedFloatUnaryMinus),
                        GetSignature(UnaryOperatorKind.LiftedDoubleUnaryMinus),
                        GetSignature(UnaryOperatorKind.LiftedDecimalUnaryMinus),
                    }).AsImmutableOrNull(),
                    (new []
                    {
                        GetSignature(UnaryOperatorKind.BoolLogicalNegation),
                        GetSignature(UnaryOperatorKind.LiftedBoolLogicalNegation),
                    }).AsImmutableOrNull(),
                    (new []
                    {
                        GetSignature(UnaryOperatorKind.IntBitwiseComplement),
                        GetSignature(UnaryOperatorKind.UIntBitwiseComplement),
                        GetSignature(UnaryOperatorKind.LongBitwiseComplement),
                        GetSignature(UnaryOperatorKind.ULongBitwiseComplement),
                        GetSignature(UnaryOperatorKind.LiftedIntBitwiseComplement),
                        GetSignature(UnaryOperatorKind.LiftedUIntBitwiseComplement),
                        GetSignature(UnaryOperatorKind.LiftedLongBitwiseComplement),
                        GetSignature(UnaryOperatorKind.LiftedULongBitwiseComplement),
                    }).AsImmutableOrNull(),
                    // No built-in operator true or operator false
                    (new UnaryOperatorSignature [0]).AsImmutableOrNull(),
                    (new UnaryOperatorSignature [0]).AsImmutableOrNull(),
                };

                Interlocked.CompareExchange(ref builtInUnaryOperators, allOperators, null);
            }

            operators.AddRange(builtInUnaryOperators[kind.OperatorIndex()]);
        }
开发者ID:riversky,项目名称:roslyn,代码行数:101,代码来源:BuiltInOperators.cs

示例3: OpKind

 public static UnaryOperatorKind OpKind(UnaryOperatorKind kind, TypeSymbol operand)
 {
     int? index = TypeToIndex(operand);
     if (index == null)
     {
         return UnaryOperatorKind.Error;
     }
     int kindIndex = kind.OperatorIndex();
     var result = (kindIndex >= s_opkind.Length) ? UnaryOperatorKind.Error : s_opkind[kindIndex][index.Value];
     return result == UnaryOperatorKind.Error ? result : result | kind;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:11,代码来源:UnaryOperatorEasyOut.cs


注:本文中的UnaryOperatorKind.OperatorIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。