I'm having one method in the C# in vs2010 which should return generic object of system. Because the methods return different type of result like int, datatable,string . the object can hold int as well as string but when i'm holding or assigning datatable to the generic object then it is throwing error as -
Server was unable to process request. ---> There was an error generating the XML document. ---> The type System.Data.DataTable may not be used in this context. To use System.Data.DataTable as a parameter, return type, or member of a class or struct, the parameter, return type, or member must be declared as type System.Data.DataTable (it cannot be object). Objects of type System.Data.DataTable may not be used in un-typed collections, such as ArrayLists.
because i'm developing the web method so that's why the other part of error it throws.
Can generic object hold the datatable object ?