private TypeDefTreatment GetWellKnownTypeDefinitionTreatment(TypeDefinitionHandle typeDef) { InitializeProjectedTypes(); StringHandle name = TypeDefTable.GetName(typeDef); int index = StringStream.BinarySearchRaw(s_projectedTypeNames, name); if (index < 0) { return(TypeDefTreatment.None); } StringHandle namespaceName = TypeDefTable.GetNamespace(typeDef); if (StringStream.EqualsRaw(namespaceName, StringStream.GetVirtualValue(s_projectionInfos[index].ClrNamespace))) { return(s_projectionInfos[index].Treatment); } // TODO: we can avoid this comparison if info.DotNetNamespace == info.WinRtNamespace if (StringStream.EqualsRaw(namespaceName, s_projectionInfos[index].WinRTNamespace)) { return(s_projectionInfos[index].Treatment | TypeDefTreatment.MarkInternalFlag); } return(TypeDefTreatment.None); }
private int GetProjectionIndexForTypeReference(TypeReferenceHandle typeRef, out bool isIDisposable) { InitializeProjectedTypes(); int index = StringStream.BinarySearchRaw(s_projectedTypeNames, TypeRefTable.GetName(typeRef)); if (index >= 0 && StringStream.EqualsRaw(TypeRefTable.GetNamespace(typeRef), s_projectionInfos[index].WinRTNamespace)) { isIDisposable = s_projectionInfos[index].IsIDisposable; return(index); } isIDisposable = false; return(-1); }