示例#1
0
        static void Main(string[] args)
        {
            int i = 5;
            var j = 5;
            // j = "hello"; not work

            GreetingString greet1 = new GreetingString();
            string         greet2 = "Hello Dev Ramp-Up!";

            ModifyGreeting(greet1);
            PrintLineBreaks(1);
            Console.WriteLine("Printing greet object value in Main method");
            Console.WriteLine(greet1.text);

            PrintLineBreaks(2);

            ModifyGreeting(greet2);
            PrintLineBreaks(1);
            Console.WriteLine("Printing local variable greet");
            Console.WriteLine(greet2);
        }
示例#2
0
 static void ModifyGreeting(GreetingString temp)
 {
     temp.text = temp.text.ToUpper();
     Console.WriteLine("Printing greet object value in function");
     Console.WriteLine(temp.text);
 }