Exemplo n.º 1
0
        private static void Sample_3()
        {
            var client = new Learning_WCF.ServiceClient();

            try
            {
                client.ThrowGenericFaultException();
            }
            catch (Exception e)
            {
                Console.WriteLine("=============");
                Console.WriteLine(e);
                Console.WriteLine("=============\n\n\n\n");
            }

            try
            {
                client.ThrowGenericFaultException();
            }
            catch (Exception e)
            {
                Console.WriteLine("=============");
                Console.WriteLine(e);
                Console.WriteLine("=============\n\n\n\n");
            }
        }
Exemplo n.º 2
0
        private static void Sample_4()
        {
            var client = new Learning_WCF.ServiceClient();

            try
            {
                client.ThrowGenericFaultException();
            }
            catch (FaultException<Learning_WCF.ErrorDetails> e)
            {
                Console.WriteLine("=============");
                Console.WriteLine(e);
                Console.WriteLine("=============");
                Console.WriteLine("Code: {0}", e.Code.Name);
                Console.WriteLine("Action: {0}", e.Action);
                Console.WriteLine("Reason: {0}", e.Reason);
                Console.WriteLine("Detail Code: {0}", e.Detail.Code);
                Console.WriteLine("Detail Description: {0}", e.Detail.Description);
                Console.WriteLine("Detail Name: {0}", e.Detail.Name);
                Console.WriteLine("=============\n\n\n\n");
            }

            try
            {
                client.ThrowGenericFaultException();
            }
            catch (FaultException<Learning_WCF.ErrorDetails> e)
            {
                Console.WriteLine("=============");
                Console.WriteLine(e);
                Console.WriteLine("=============");
                Console.WriteLine("Code: {0}", e.Code.Name);
                Console.WriteLine("Action: {0}", e.Action);
                Console.WriteLine("Reason: {0}", e.Reason);
                Console.WriteLine("Detail Code: {0}", e.Detail.Code);
                Console.WriteLine("Detail Description: {0}", e.Detail.Description);
                Console.WriteLine("Detail Name: {0}", e.Detail.Name);
                Console.WriteLine("=============\n\n\n\n");
            }
        }