/// <summary>
        /// Create a NetTypeDefinition wrapper for the given dex import.
        /// </summary>
        private NetTypeDefinition CreateNetTypeDef(AssemblyClassLoader.DexImport dexImport, Action <ClassFile> classLoaded,
                                                   Func <TypeDefinition, AssemblyClassLoader.DexImport> type2DexImport, TargetFramework target)
        {
            // Convert dex import to class file
            var dexMethods = new List <AssemblyClassLoader.DexImportMethod>();
            var classFile  = dexImport.Resolve(assemblyClassLoader, classLoaded, dexMethods);

            // Build type-definition
            var typeDef = new NetTypeDefinition(classFile, target, dexImport.Scope)
            {
                Namespace           = dexImport.FirstType.Namespace,
                Name                = StripGenerics(dexImport.FirstType.Name),
                Attributes          = (TypeAttributes)dexImport.FirstType.Attributes,
                ImportedFromMapping = true
            };

            // Build custom attribute
            typeDef.CustomAttributes.Add(BuildCustomAttribute(dexImport.ImportAttribute));

            // Add generic parameters
            if (dexImport.FirstType.HasGenericParameters)
            {
                foreach (var gp in dexImport.FirstType.GenericParameters)
                {
                    typeDef.GenericParameters.Add(new NetGenericParameter(gp.Name, gp.Name, typeDef));
                }
            }

            // Record builder to complete later
            implementationBuilders.Add(new NetTypeImplementationBuilder(this, classFile, typeDef, dexImport, dexMethods, type2DexImport));

            return(typeDef);
        }
 /// <summary>
 /// Default ctor
 /// </summary>
 public NetTypeImplementationBuilder(TypeNameMap typeNameMap, ClassFile classFile, NetTypeDefinition typeDef, AssemblyClassLoader.DexImport dexImport,
                                     List <AssemblyClassLoader.DexImportMethod> dexMethods,
                                     Func <TypeDefinition, AssemblyClassLoader.DexImport> type2DexImport)
 {
     this.typeNameMap    = typeNameMap;
     this.classFile      = classFile;
     this.typeDef        = typeDef;
     this.dexMethods     = dexMethods;
     this.type2DexImport = type2DexImport;
     this.dexImport      = dexImport;
 }