private static string MapManagedTypeToWinRtType(MrType t) { var map = new Dictionary <string, string> { { typeof(Object).FullName, "Windows.Foundation.IInspectable" }, { "System.Collections.Generic.IList`1", "Windows.Foundation.Collections.IVector`1" }, { "System.Collections.Generic.IReadOnlyList`1", "Windows.Foundation.Collections.IVectorView`1" }, { "System.Collections.Generic.IDictionary`2", "Windows.Foundation.Collections.IMap`2" }, { "System.Collections.Generic.IReadOnlyDictionary`2", "Windows.Foundation.Collections.IMapView`2" }, }; if (map.ContainsKey(t.GetFullName())) { return(map[t.GetFullName()]); } if (t.GetNamespace() == "System") { return(t.GetName()); } else { return(t.GetFullName()); } }
private static string GetSimpleTypeName(MrType t, ImmutableArray <MrType> gargs, ImmutableArray <MrType> gparams) { string name; if (t.IsTypeCode) { name = t.TypeCode.ToString(); } else if (t.GetNamespace() == "System") { name = MapManagedTypeToWinRtType(t); } else if (!gargs.IsEmpty || !gparams.IsEmpty) { name = MapManagedTypeToWinRtType(t); name = name.Substring(0, name.IndexOf('`')); } else { name = t.GetFullName(); } return(name); }