Tuesday, 10 July 2012

Instance Without A Class

Instance without class

To use var keyword you need .net framework 3.0 or latest than 3.0


using System;
using System.Linq;
class car
{ static int c;
public void Sum(int a, int b)
{
c=a+b;
Console.WriteLine("Sum is :"+c);
}
public static void Main()
{
var m=new car();
m.Sum(2, 4);
}
}

No comments:

Post a Comment