Thursday, September 17, 2009

Optional keyword in C#

Hi there...

Wouldn't be nice if C# had a optional keyword for the methods/properties in an interface?

interface IMyInterface
{
optional void OptionalMethod();

void NotOptionalMethod();
}

public class MyClass1 : IMyInterface
{
public void NotOptionalMethod()
{
//implement the method...
}
}

public class MyClass2 : IMyInterface
{
public void NotOptionalMethod()
{
//implement the method...
}

public void OptionalMethod()
{
//implement the method...
}
}
I’ve created a thread where you can comment on this.

No comments: