Reputation: 1107
i have the following class:
namespace Mentionfunctions
{
class MFunctions
{
public bool availability(string ean)
{
//do
return true;
}
}
}
I call this one with
MFunctions mf = new MFunctions();
mf.availability(EAN);
I want to add a property to call the function with a different "mode"
I want to do something like:
mf.availability.global(EAN);
mf.availability.onlysupplier(EAN);
I googled this for ours but i'm not sure how do to that or i'm using the wrong words for searching.
Upvotes: 0
Views: 78
Reputation: 9772
Don't use a property to change the behaviour of a function. Use an additional argument to the function instead:
bool availability(string ean, string mode);
Then make mode an Enumeration
Upvotes: 1
Reputation: 101681
You can use enums for that:
enum Mode
{
global,
onlysupplier
}
public bool availability(string ean, Mode m) { }
Then you can call your method like this:
mf.availability(EAN, Mode.global);
Upvotes: 5