Пример #1
0
      public Task SwitchAsync(OSPlatform oSPlatform, Func <Task> windowsActionAsync, Func <Task> osxActionAsync, Func <Task> linuxActionAsync)
      {
          if (oSPlatform == OSPlatform.Windows)
          {
              var task = windowsActionAsync();

              return(task);
          }

          if (oSPlatform == OSPlatform.OSX)
          {
              var task = osxActionAsync();

              return(task);
          }

          if (oSPlatform == OSPlatform.Linux)
          {
              var task = linuxActionAsync();

              return(task);
          }

          throw D0024Utilities.GetUnknownOSPlatformException();
      }
Пример #2
0
      public void Switch(OSPlatform oSPlatform, Action windowsAction, Action osxAction, Action linuxAction)
      {
          if (oSPlatform == OSPlatform.Windows)
          {
              windowsAction();

              return;
          }

          if (oSPlatform == OSPlatform.OSX)
          {
              osxAction();

              return;
          }

          if (oSPlatform == OSPlatform.Linux)
          {
              linuxAction();

              return;
          }

          throw D0024Utilities.GetUnknownOSPlatformException();
      }