public void MapUserWithStaticMapper2()
{
var users = new[]
{
new User(1, "Bob Almighty", "Green", DateTimeOffset.Now),
new User(2, "Alice Wunder", "Orange", DateTimeOffset.Now)
};
var view = users.Select(u => UserSummary.MapFrom(u));
}
.method public hidebysig
instance void MapUserWithStaticMapper2 () cil managed
{
// Method begins at RVA 0x228c
// Code size 95 (0x5f)
.maxstack 7
.locals init (
[0] class MappingStyles.User[] users,
[1] class [System.Runtime]System.Collections.Generic.IEnumerable`1<class MappingStyles.UserSummary> view
)
// {
IL_0000: nop
// User[] source = new User[2]
// {
// new User(1, "Bob Almighty", "Green", DateTimeOffset.Now),
// new User(2, "Alice Wunder", "Orange", DateTimeOffset.Now)
// };
IL_0001: ldc.i4.2
IL_0002: newarr MappingStyles.User
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.1
IL_000a: ldstr "Bob Almighty"
IL_000f: ldstr "Green"
IL_0014: call valuetype [System.Runtime]System.DateTimeOffset [System.Runtime]System.DateTimeOffset::get_Now()
IL_0019: newobj instance void MappingStyles.User::.ctor(int32, string, string, valuetype [System.Runtime]System.DateTimeOffset)
IL_001e: stelem.ref
IL_001f: dup
IL_0020: ldc.i4.1
IL_0021: ldc.i4.2
IL_0022: ldstr "Alice Wunder"
IL_0027: ldstr "Orange"
IL_002c: call valuetype [System.Runtime]System.DateTimeOffset [System.Runtime]System.DateTimeOffset::get_Now()
IL_0031: newobj instance void MappingStyles.User::.ctor(int32, string, string, valuetype [System.Runtime]System.DateTimeOffset)
IL_0036: stelem.ref
IL_0037: stloc.0
// IEnumerable<UserSummary> enumerable = source.Select((User u) => UserSummary.MapFrom(u));
IL_0038: ldloc.0
IL_0039: ldsfld class [System.Runtime]System.Func`2<class MappingStyles.User, class MappingStyles.UserSummary> MappingStyles.MappingTests/'<>c'::'<>9__3_0'
IL_003e: dup
IL_003f: brtrue.s IL_0058
// }
IL_0041: pop
IL_0042: ldsfld class MappingStyles.MappingTests/'<>c' MappingStyles.MappingTests/'<>c'::'<>9'
IL_0047: ldftn instance class MappingStyles.UserSummary MappingStyles.MappingTests/'<>c'::'<MapUserWithStaticMapper2>b__3_0'(class MappingStyles.User)
IL_004d: newobj instance void class [System.Runtime]System.Func`2<class MappingStyles.User, class MappingStyles.UserSummary>::.ctor(object, native int)
IL_0052: dup
IL_0053: stsfld class [System.Runtime]System.Func`2<class MappingStyles.User, class MappingStyles.UserSummary> MappingStyles.MappingTests/'<>c'::'<>9__3_0'
IL_0058: call class [System.Runtime]System.Collections.Generic.IEnumerable`1<!!1> [System.Linq]System.Linq.Enumerable::Select<class MappingStyles.User, class MappingStyles.UserSummary>(class [System.Runtime]System.Collections.Generic.IEnumerable`1<!!0>, class [System.Runtime]System.Func`2<!!0, !!1>)
IL_005d: stloc.1
IL_005e: ret
} // end of method MappingTests::MapUserWithStaticMapper2