Wednesday, January 20, 2016

Obsolete method

I learned something today Smile

You can render a method obsolete like this

/// <summary>
/// An obsolete method in a class far, far away.
/// </summary>

[SysObsoleteAttribute('This is the error message you will see when you compile code that callse this method even though it is obsolete.', true)]
public void obsoleteMethod()
{
    throw error(Error::wrongUseOfFunction(funcName()));
}

Now when you try to compile code that calls this method, you will see:

image

I don’t care what you say. I think it’s pretty cool.

No comments:

Post a Comment