/ Published in: VB.NET

Dado un objeto original, este método copia los valores de ese objeto en un segundo objeto de la misma clase, utilizando reflection.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Public Sub Asimilar(of T)(ByVal target as T, ByVal source As T) Dim propiedades As PropertyInfo() Dim type As Type = target.GetType() propiedades = type.GetProperties() For Each pi As PropertyInfo In propiedades If pi.CanWrite Then pi.SetValue(target, pi.GetValue(source, Nothing), Nothing) Next End Sub
Comments
