Wednesday, 4 November 2015

Features of C# 6.0 

There are following features.

1. Use of Static Members with Namespace
2. Auto Property Initialize


1. Use of Static Members with Namespace


We can use static classes in namespaces.

Example: 

a) Use of static class of system namespace.


using static System.Console;
using static System.Convert;

namespace CSharp6._0NewFeatures
{
    class Program
    {
        static void UsingStaticMember()
        {
            WriteLine("Use of System.Console\n\n");

            string age = "10";
            WriteLine("System.Convert: " + ToInt32(age));
        }

        static void Main(string[] args)
        {
            UsingStaticMember();
            ReadKey();
        }
    }
}

Output:
using static System.ClassName