can we define properties in interface c# code example
Example 1: c# interface property
interface InterfaceExample
{
int Number { get; set; }
}
class Example : InterfaceExample
{
int num = 0;
public int Number { get { return num; } set { num = value; } }
}
Example 2: c# interface properties
public interface ISampleInterface
{
// Property declaration:
string Name
{
get;
set;
}
}