Пример #1
0
        static TypeExtensions()
        {
            OperatorNameLookup["+"]  = "op_Addition";
            OperatorNameLookup["-"]  = "op_Subtraction";
            OperatorNameLookup["*"]  = "op_Multiply";
            OperatorNameLookup["*d"] = "op_Multiply";
            OperatorNameLookup["/"]  = "op_Division";
            OperatorNameLookup["/d"] = "op_Division";
            OperatorNameLookup["%"]  = "op_Modulus";
            OperatorNameLookup["%d"] = "op_Modulus";

            foreach (var pair in OperatorNameLookup)
            {
                KnownSupportedOperators.TryAdd(
                    pair.Key, new HashSet <Type> {
                    typeof(long), typeof(ulong), typeof(int), typeof(uint), typeof(short), typeof(ushort), typeof(double), typeof(float), typeof(decimal), typeof(byte), typeof(sbyte)
                });
            }
        }
Пример #2
0
        static TypeExtensions()
        {
            OperatorNameLookup = new Dictionary <string, string>
            {
                { "+", "op_Addition" },
                { "-", "op_Subtraction" },
                { "*", "op_Multiply" },
                { "*d", "op_Multiply" },
                { "/", "op_Division" },
                { "/d", "op_Division" },
                { "%", "op_Modulus" },
                { "%d", "op_Modulus" },
            };

            foreach (var pair in OperatorNameLookup)
            {
                KnownSupportedOperators.Add(
                    pair.Key, new HashSet <Type> {
                    typeof(long), typeof(ulong), typeof(int), typeof(uint), typeof(short), typeof(ushort), typeof(double), typeof(float), typeof(decimal), typeof(byte), typeof(sbyte)
                });
            }
        }