CSharp examples for Custom Type:Method Parameter
Demonstrate argument passing.
using System;/* w ww . j a v a 2 s . co m*/ public class Program { public static void Main(string[] args) { AverageAndDisplay("grade 1", 3.5, "grade 2", 4.0); } public static void AverageAndDisplay(string s1, double d1, string s2, double d2) { double average = (d1 + d2) / 2; Console.WriteLine("The average of " + s1 + " whose value is " + d1 + " and " + s2 + " whose value is " + d2 + " is " + average); } }