16 using System.Collections.Generic;
19 namespace CodeGeneration {
25 #region SingletonDesingPattern
29 get {
return instance; }
34 this.requireBoxing =
new List<string>();
35 this.requireBoxing.Add(
"bool");
36 this.requireBoxing.Add(
"char");
37 this.requireBoxing.Add(
"int32");
38 this.requireBoxing.Add(
"float64");
40 this.mappings =
new Dictionary<string, string>();
41 this.mappings[
"bool"] =
"System.Boolean";
42 this.mappings[
"char"] =
"System.Char";
43 this.mappings[
"int32"] =
"System.Int32";
44 this.mappings[
"float64"] =
"System.Double";
45 this.mappings[
"string"] =
"System.String";
46 this.mappings[
"object"] =
"System.Object";
51 private IList<string> requireBoxing;
61 private IDictionary<string, string> mappings;
65 #region RequiresBoxing
72 return this.requireBoxing.Contains(ilType);
83 public string GetBCLName(
string ilType,
bool includeLibrary) {
84 if (this.mappings.ContainsKey(ilType))
86 return includeLibrary ?
"[mscorlib]"+this.mappings[ilType] : this.mappings[ilType];
87 if (this.mappings.Values.Contains(ilType))
89 return includeLibrary ?
"[mscorlib]" + ilType : ilType;
bool RequireBoxing(string ilType)
Tells if an IL type requires boxing to convert into an object
static TypeMapping Instance
Offers the mappings between different representations of types in IL.
string GetBCLName(string ilType, bool includeLibrary)
Obtains the BCL representation of an IL type