コード例 #1
0
 /// <summary>
 /// Maps values from members on the source object to members with the same name on the target object.
 /// </summary>
 /// <param name="source">The source object from which member values are read.</param>
 /// <param name="target">The target object to which member values are written.</param>
 /// <param name="sourceTypes">The member types (Fields, Properties or both) to include on the source.</param>
 /// <param name="targetTypes">The member types (Fields, Properties or both) to include on the target.</param>
 /// <param name="bindingFlags">The <see href="Flags"/> used to define the scope when locating members. If
 /// <paramref name="sourceTypes"/> is different from <paramref name="targetTypes"/> the flag value
 /// <see cref="Flags.IgnoreCase"/> will automatically be applied.</param>
 /// <param name="names">The optional list of member names against which to filter the members that are
 /// to be mapped. If this parameter is <c>null</c> or empty no name filtering will be applied. The default
 /// behavior is to check for an exact, case-sensitive match. Pass <see href="Flags.PartialNameMatch"/> to
 /// filter members by substring and <see href="Flags.IgnoreCase"/> to ignore case.</param>
 public static void Map(this object source, object target, MemberTypes sourceTypes, MemberTypes targetTypes,
                        Flags bindingFlags, params string[] names)
 {
     DelegateForMap(source.GetType(), target.GetTypeAdjusted(), sourceTypes, targetTypes, bindingFlags, names)(
         source, target);
 }
コード例 #2
0
 /// <summary>
 /// Maps values from fields and properties on the source object to fields and properties with the
 /// same name on the target object.
 /// </summary>
 /// <param name="source">The source object from which member values are read.</param>
 /// <param name="target">The target object to which member values are written.</param>
 /// <param name="names">The optional list of member names against which to filter the members that are
 /// to be mapped. If this parameter is <c>null</c> or empty no name filtering will be applied. The default
 /// behavior is to check for an exact, case-sensitive match. Pass <see href="Flags.PartialNameMatch"/> to
 /// filter members by substring and <see href="Flags.IgnoreCase"/> to ignore case.</param>
 public static void Map(this object source, object target, params string[] names)
 {
     DelegateForMap(source.GetType(), target.GetTypeAdjusted(), names)(source, target);
 }