.net 3.5, VS 2010... this is for an asp.net website.
I have an class called Agency. there is a second class called Agency_Queries. Agency_Queries inhertis the Agen
I took a little of this and that and came up with this:
Imports System.Reflection
Public Class ObjectHelper
' Creates a copy of an object
Public Shared Function GetCopy(Of SourceType As {Class, New})(ByVal Source As SourceType) As SourceType
Dim ReturnValue As New SourceType
Dim sourceProperties() As PropertyInfo = Source.GetType().GetProperties()
For Each sourceProp As PropertyInfo In sourceProperties
sourceProp.SetValue(ReturnValue, sourceProp.GetValue(Source, Nothing), Nothing)
Next
Return ReturnValue
End Function
End Class