Difference between String and string C#

The 'string' keyword is equivalent of 'System.String' so you don't need to using namespace System like following code.

//using System;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = string.Empty;
            System.String s2 = System.String.Empty;
            String s3 = String.Empty; // compile error namespace could not be found
        }
    }
}

Posted in . Bookmark the permalink. RSS feed for this post.

Search

Swedish Greys - a WordPress theme from Nordic Themepark. Converted by LiteThemes.com.