-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathCharArrayMapper.cs
More file actions
67 lines (62 loc) · 1.77 KB
/
CharArrayMapper.cs
File metadata and controls
67 lines (62 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by AgileObjects.AgileMapper.Buildable.
// Runtime Version: 0.1.0.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
using System;
using System.CodeDom.Compiler;
using System.Linq;
using AgileObjects.AgileMapper;
using AgileObjects.AgileMapper.Extensions;
using AgileObjects.AgileMapper.ObjectPopulation;
namespace AgileObjects.AgileMapper.Buildable.UnitTests.Mappers
{
[GeneratedCode("AgileObjects.AgileMapper.Buildable", "0.1.0.0")]
public class CharArrayMapper : MappingExecutionContextBase<char[]>
{
public CharArrayMapper
(
char[] source
)
: base(source)
{
}
public int[] Over
(
int[] target
)
{
return CharArrayMapper.Overwrite(this.CreateRootMappingData(target));
}
private static int[] Overwrite
(
IObjectMappingData<char[], int[]> caToIaData
)
{
try
{
return caToIaData.Source.Project(c => CharArrayMapper.GetInt(c)).ToArray();
}
catch (Exception ex)
{
throw MappingException.For(
"Overwrite",
"char[]",
"int[]",
ex);
}
}
private static int GetInt
(
char c
)
{
int intValue;
return int.TryParse(c.ToString(), out intValue) ? intValue : default(int);
}
}
}