Monday, September 30, 2013

mult params web service

To avoid this pitfall use the single point of exit idiom:

public string CalculateAmount(string val1, string val2, string val3)
{
string result = string.Empty;
if(val1 == "Level 1")
result = val2;
if(val1 == "Level 2")
result = val3;
return result;
}



btw, Get is a verb which should only be used for implementing getter methods of class properties. Nothing else. Same applies for Set and setter methodes.

No comments:

Post a Comment