String ToUpper() does not modify String. it returns a new string that has been converted - CSharp Language Basics

CSharp examples for Language Basics:string

Description

String ToUpper() does not modify String. it returns a new string that has been converted

Demo Code

using System;/*  www  .  ja va  2s  .  co  m*/
class Program
{
   public static void Main(string[] args)
   {
      Student s1 = new Student();
      s1.Name = "B";
      Student s2 = new Student();
      s2.Name = s1.Name;
      s2.Name = s1.Name.ToUpper();
      Console.WriteLine("s1 - " + s1.Name + ", s2 - " + s2.Name);
   }
}
class Student
{
   public String Name;
}

Result


Related Tutorials