1.
what will be the output of the following program?
[serviceContract()]
public interface ImyService
{
[OperationContract]
int MyMethod();
}
[ServiceBehavior(InstanceContectMode=InstanceContectMode.PerSession)]
public class myservice:IMyService
{
static int m_counter=0;
public int MyMethod()
{
m_Counter++;
return m_counter;
}
}
what will be the output of the following program?
public class myservice:IMyService
{
static int m_counter=0;
public int MyMethod()
{
m_Counter++;
return m_counter;
}
}
static void main(string() args[])
{
MyCalculatorServicesProxy.MyServiceProxy proxy = new MyCalculatorServicesProxy.MyServiceProxy();
Console.wrileline("Counter: " + Proxy.MyMethod());
Console.wrileline("Counter: " + Proxy.MyMethod());
Console.wrileline("Counter: " + Proxy.MyMethod());
Console.wrileline("Counter: " + Proxy.MyMethod());
Console.ReadLine();
}
output
;
1 Counter:1
Counter:2
Counter:3
Counter:4
2 Counter: 1
Counter: 1
Counter: 1
Counter: 1
3 Counter: 0
Counter: 1
Counter: 2
Counter: 3
4 Compilation error in services