Click or drag to resize

ModelExtensionsMapPropertiesT Method

Copies all public properties from one class to another.

Read our blog on this topic: Revisiting Deep Copy in C#

Namespace:  Xcalibur.Extensions
Assembly:  Xcalibur.Extensions (in Xcalibur.Extensions.dll) Version: 1.0.4.0 (1.0.0.0)
Syntax
public static void MapProperties<T>(
	this T source,
	T destination
)
where T : class

Parameters

source
Type: T
The source.
destination
Type: T
The destination.

Type Parameters

T

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type . When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ExceptionSource and destination cannot be null and must be of the same type!
Examples
C#
1SomeType myNewObject = new SomeType();
2
3// Assumption: "myObject" is of type "SomeType"
4myObject.MapProperties(myNewObject);
See Also