Advertisement
Guest User

ClientWCF

a guest
Dec 12th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 KB | None | 0 0
  1. using ConsoleAppClient.ServiceReference1;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace WcfServiceClient {
  8.     class Program  
  9.     {
  10.         static void Main(string[] args) { //Krok 1: Utworzenie instancji WCF proxy.
  11.         KalkulatorClient mojKlient = new KalkulatorClient(); // Krok 2: Wywolanie operacji uslugi.
  12.                                                             // Operacja Dodaj: ...
  13.         double result = mojKlient.Dodaj(22, 2);
  14.         Console.WriteLine("Uruchamiam Dodaj..." + result);
  15.              
  16.         result = mojKlient.Odejmij(22, 2);
  17.         Console.WriteLine("Uruchamiam Odejmij..." + result);
  18.              
  19.         result = mojKlient.Pomnoz(22, 2);
  20.         Console.WriteLine("Uruchamiam Pomnoz..." + result);
  21.         // Operacja Podziel: ...      
  22.         //result = mojKlient.Podziel(22, 2);
  23.         //Console.WriteLine("Uruchamiam Podziel..."); // Krok 3: Zamknięcie klienta zamyka polaczenie i czysci zasoby.      
  24.         mojKlient.Close();
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement