I'm passing an object into a method, which accepts it as an Object. The method then needs to use this object in its original type, which it does a bit like this:
Public Function SomeFunction(ByVal obj as Object) As Boolean Dim newObj as Object newObj = Activator.CreateInstance(obj.GetType()) newObj = obj 'Use newObj to do the work 'etc... However, I may be passing in objects with no public or parameterless constructors, which seems to be a problem for "Activator.CreateInstance". Given I have my object (albeit as an Object) and its type, which doesn't have a public constructor, how do I create a new object ("newObj") of the correct type? Alternatively, how do I cast my object ("obj") to its type, which right now seems a more likely solution? Thanks in advance for any help (doesn't have to be VB). You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.