Answer: A property with a static keyword is considered as static property. This makes the property available to access at any time, even if no instance of the class exists. Below is the example for a static property.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Value
{
private static int i = 3;
public static int i
{
et
{
return i;
}
}
}
class Main
{
public static void Main()
{
Console.WriteLine(Value.i);
}
}
Asked In: Many Interviews |
Alert Moderator