SHARE
TWEET

Untitled

a guest Jun 20th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using Microsoft.CSharp;
  2. using BleachArgParse;
  3. using System;
  4.  
  5. namespace BleachArgParseExample {
  6.     class BleachArgParseExampleprogram {
  7.         static void Main(string[] arguments) {
  8.             StartTest();
  9.             Console.WriteLine("nThe program has finished, press any key to continue...");
  10.             Console.ReadKey();
  11.         }
  12.  
  13.         private static void StartTest() {
  14.             ArgumentParser parser = new ArgumentParser();
  15.  
  16.             parser.description  = "Calculates the volume of a cylinder.";
  17.             parser.include_help = true;
  18.             parser.name_prefix  = "--";
  19.             parser.short_prefix = "-";
  20.  
  21.             parser.AddArgument("radius", "The radius of the cylinder.", "r", true, type:ArgumentType.Double);
  22.             parser.AddArgument("height", "The height of the cylinder.", "h", true, type:ArgumentType.Double);
  23.  
  24.             var args = parser.ParseArguments();
  25.  
  26.             var x = Calculate(args.radius, args.height);
  27.             Console.WriteLine(x);
  28.         }
  29.  
  30.         private static double Calculate(double radius, double height) {
  31.             return (Math.PI) * (radius * radius) * height;
  32.         }
  33.     }
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top