Deserialize return value if error

Last Reply 5 days ago By arjunv

Posted 6 days ago

Hi

I have a deserialize method which convert xml into desired object type and in catch method i am returning default(type) which is null, Is there any detailed way to pass <Type> deserialize, because when xml failed to deserialize it is returning null, i have to catpure that exception and pass in place of <Type>.

public static Type Deserialize(string xml)
{
    Type obj1 = (Type).handler.Deserialize(typeof(Type,xml)
    return obj1
    }
    catch
    {
        return default(type)
    }

Inside deserialize method, I have deserialize the xml into desired objects.

You are viewing reply posted by: arjunv 5 days ago.