/*
C# Programming Tips & Techniques
by Charles Wright, Kris Jamsa
Publisher: Osborne/McGraw-Hill (December 28, 2001)
ISBN: 0072193794
*/
//
// TestInt.cs -- shows that using an instance of the System.Int32 stucture
// is the same as using the int keyword.
//
// Compile this program with the following command line:
// C:>csc TestInt.cs
//
namespace nsTestInt
{
using System;
public class TestInt
{
static public void Main ()
{
System.Int32 x;
OutInt (out x);
Console.WriteLine ("The integer is " + x);
x = 42;
ShowInt (x);
ChangeInt (ref x);
Console.WriteLine ("The integer is " + x);
}
static void OutInt (out int val)
{
val = 42;
}
static void ShowInt (int val)
{
Console.WriteLine ("The value passed is " + val.ToString());
}
static void ChangeInt (ref System.Int32 val)
{
val *= 2;
}
}
}
|