示例#1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Simple delegate example");
            //create BinaryOp delegate pointing to Add
            BinaryOp b = new BinaryOp(SimpleMath.Add);

            //invoke the method via delegate
            Console.WriteLine("10 + 10 = {0}", b(10, 10));

            Console.WriteLine(b.ToString());
            Console.WriteLine(b.Method);
            Console.WriteLine(b.Target);

            SimpleMath math = new SimpleMath();

            b += math.Subtract;
            Console.WriteLine(b.ToString());
            Console.WriteLine(b.Method);
            Console.WriteLine(b.Target);
            Console.WriteLine("10 + 10 = {0}", b(10, 10));

            DisplayDelegateInfo(b);

            Console.ReadLine();
        }
示例#2
0
        public virtual bool IsOpSupportedByTable(OperationCapabilityMetadata metadata, TexlNode node, TexlBinding binding)
        {
            Contracts.AssertValue(metadata);
            Contracts.AssertValue(node);
            Contracts.AssertValue(binding);

            if (!metadata.IsBinaryOpInDelegationSupported(_binaryOp))
            {
                SuggestDelegationHint(node, binding, TexlStrings.OpNotSupportedByClientSuggestionMessage_OpNotSupportedByClient, _binaryOp.ToString());
                return(false);
            }

            if (!metadata.IsBinaryOpSupportedByTable(_binaryOp))
            {
                SuggestDelegationHint(node, binding, TexlStrings.OpNotSupportedByServiceSuggestionMessage_OpNotSupportedByService, _binaryOp.ToString());
                return(false);
            }

            return(true);
        }
示例#3
0
 public static DelegationTelemetryInfo CreateBinaryOpNoSupportedInfoTelemetryInfo(BinaryOp op)
 {
     return(new DelegationTelemetryInfo(op.ToString()));
 }