Revision: 5087
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 11, 2008 08:46 by RichardIII
Initial Code
using System; namespace parameters { public static class democlass { //normal use public static int Add(int left, int right) { return left + right; } //use the ref Parameter, e.g. for increment public static void AddPlus(ref int number) { number = number + 1; } //use the out Parameter public static void GetHundred(out int number) { number = 100; } } class Program { static void Main(string[] args) { int a = 10; int b = 20; int c; c = democlass.Add(a, b); Console.WriteLine(c); //30 democlass.AddPlus(ref c); Console.WriteLine(c); //31 democlass.GetHundred(out c); Console.WriteLine(c); //100 } } }
Initial URL
Initial Description
In Delphi you have the possibility to modify Methods' Parameters (e.g. procedure AddPlus(var number: integer);) - in C# you will find the following realm of possibility:
Initial Title
Methods and Different Kind of Parameters Passing
Initial Tags
Initial Language
C#