static void Main(string[] args) { MyClass mc = new MyClass(); double volume, volume1; volume = mc.GetCylinderVolume(3.0, 4.0); volume1 = mc.GetCylinderVolume(radius:3.0, height:4.0); Console.WriteLine(volume); Console.WriteLine(volume1); }
static void Main(string[] args) { MyClass mc = new MyClass(); double volume; volume = mc.GetCylinderVolume(3.0, 4.0); // Positional. Console.WriteLine("Volume = " + volume); volume = mc.GetCylinderVolume(radius: 2.0); // Use default height. Console.WriteLine("Volume = " + volume); volume = mc.GetCylinderVolume(height: 2.0); // Use default radius. Console.WriteLine("Volume = " + volume); volume = mc.GetCylinderVolume(); // Use both default. Console.WriteLine("Volume = " + volume); }