Tuesday, July 12, 2011

WCF service throw custom details using FaultException < T >

For example, on the server side, there is code like

if(i>array.Lenght)
{
throw new FaultException< IndexOutOfBoundException >("Index Out Of Bound");
}

We can throw any custom class:

throw new FaultException < MyClass >();

Then on the client side call, we can

try , catch and extract the Custom Class information out.

No comments: