Mega Code Archive

 
Categories / C# / Language Basics
 

Declaring a reference type variable and creating an object the variable will reference

/* C# Programming Tips & Techniques by Charles Wright, Kris Jamsa Publisher: Osborne/McGraw-Hill (December 28, 2001) ISBN: 0072193794 */ // RefType.cs -- Demonstrate declaring a reference type variable //               and creating an object the variable will reference. // //               Compile this program with the following command line: //                   C:>csc RefType.cs using System; using System.IO; namespace nsRefType {     public class RefType123     {         static public void Main ()         { // Declare the reference type variable             FileStream strm; // Create the object the variable will reference             strm = new FileStream ("./File.txt",                                    FileMode.OpenOrCreate,                                    FileAccess.Write);         }     } }