Beispiel #1
0
 private static void SimulateReuqestFail <T>(T input)
 {
     try
     {
         //  Do something
         throw new Exception("Failed to do something");
     }
     catch (Exception ex)
     {
         var successfulResponse = new DataResponse <T>(input, ex.ToString());
         GenericTest.PrintToConsole(successfulResponse);
     }
 }
Beispiel #2
0
        private static void GenericMethodExample()
        {
            var output = GenericTest.ReturnGenericParam(5);

            GenericTest.PrintToConsole(output);
            var output1 = GenericTest.ReturnGenericParam("Hello");

            GenericTest.PrintToConsole(output1);
            var output2 = GenericTest.ReturnGenericParam(111.55f);

            GenericTest.PrintToConsole(output2);
            var output3 = GenericTest.ReturnGenericParam(true);

            GenericTest.PrintToConsole(output3);
            var cleaner = new Cleaner("Dirk", DateTime.Now, 600);
            var output4 = GenericTest.ReturnGenericParam(cleaner);

            GenericTest.PrintToConsole(output4);
            Console.ReadLine();
        }
Beispiel #3
0
        private static void SimulateReuqestSuccess <T>(T input)
        {
            var successfulResponse = new DataResponse <T>(input);

            GenericTest.PrintToConsole(successfulResponse);
        }