What is the difference between String and string in C#

3 Answers

0 votes
// string is an alias in C# for System.String. So there is no difference.

using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = "c# c c++ java";

            Console.WriteLine(s);
        }
    }
}

/*
run:
   
c# c c++ java
      
*/

 



answered Mar 30, 2017 by avibootz
0 votes
// string is an alias in C# for System.String. So there is no difference.

using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = string.Format("{0}", "c# c c++ java"); 

            Console.WriteLine(s);
        }
    }
}

/*
run:
   
c# c c++ java
      
*/

 



answered Mar 30, 2017 by avibootz
0 votes
// string is an alias in C# for System.String. So there is no difference.

using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = "c#", s2 = "java";

            string s = string.Format("{0} {1}", s1, s2); 

            Console.WriteLine(s);
        }
    }
}

/*
run:
   
c# java
      
*/

 



answered Mar 30, 2017 by avibootz

Related questions

...