Reflection extension method to copy properties from one object to another object.


/ Published in: Visual Basic
Save to your folder(s)

This copies all property values from Class A to Class B. Useful if you have many unrelated classes that share similar properties and you are constantly writing code like:

shirt.Color = pants.Color
shirt.Pattern = pants.Pattern
shirt.Style = pants.Style

Could change to:

pants.CopyPropertiesTo(shirt)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.