sometimes returning an object and sometimes returning a serialization of the object
<p>I have 2 methods that are very similar.</p>

<pre><code>public string GetMyObjectInJson(parameters)
{
 MyObject TheObject = new MyObject(); 
 ...lots of work here
 Javascript Serializer = new Javascript Serializer();
 return Serializer.serialize(TheObject); 
}

public MyObject GetMyObject(parameters)
{
 MyObject TheObject = new MyObject(); 
 ...lots of work here
 return TheObject; 
}
</code></pre>

<p>How should I rewrite this so that I only have one method that can return 2 different types: sometimes a string and sometimes an object.</p>

<p>Thanks.</p>
