Interviews2 answers
Can we have a private method in webservices ?
2 Answers
Yes we can have private methods in web service but we can access then in service.
Vishal JadavPosted Aug 7, 2016, 11:26 PM EDT
Yes you can have a private method in webservices but you will use it only within webservice's class,you will not be able to call it from outside the webservice at all
Example:
[WebMethod]
public static string WebMethod(string postCode)
{
// My webmethod code
string str = Add(2,5);
}
private static string Add(int a, int b)
{
// My private method code
}
Vamsi KrishnaPosted Oct 7, 2015, 3:23 AM EDT


