I have create one console application with some new features in vs2015.Here I have used
1. Using static:( Accessible all static members)
Example
- using static System.Math;
2. Expression bodies on method-like members
Please find the below code:
- using System;
- //Using static
- using static System.Math;
- namespace ConsoleApplication1 {
- class Program {
- static void Main(string[] args) {
- Program obj = new Program();
- //Console.WriteLine(obj.GetSqrt(3));
- Console.WriteLine(obj.GetString());
- Console.ReadLine();
- }
- public string X = "Hi";
- public string Y = "How";
- public Int32 FastValue = 4;
- public Int32 Secondvalue = 5;
- //Expression bodies on method-like members
- public double GetTotalValu() = > Sqrt(FastValue + Secondvalue * FastValue + Secondvalue);
- public double GetSqrt(int x) = > Sqrt(x);
- //String.format=$
- public string GetString() = > $ "({X},{Y})";
- }
- }
Output:


Santhakumar MunuswamyPosted Jul 13, 2015, 3:20 PM
Thanks for sharing