Example #1
0
 // Token: 0x06000156 RID: 342 RVA: 0x0000BA60 File Offset: 0x00009C60
 private static void FindTypeRefsInternal(TypeSig typeSig, IList <ITypeDefOrRef> ret)
 {
     while (typeSig.Next != null)
     {
         if (typeSig is ModifierSig)
         {
             ret.Add(((ModifierSig)typeSig).Modifier);
         }
         typeSig = typeSig.Next;
     }
     if (typeSig is GenericInstSig)
     {
         GenericInstSig genInst = (GenericInstSig)typeSig;
         ret.Add(genInst.GenericType.TypeDefOrRef);
         using (IEnumerator <TypeSig> enumerator = genInst.GenericArguments.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 TypeSig genArg = enumerator.Current;
                 DnlibUtils.FindTypeRefsInternal(genArg, ret);
             }
             return;
         }
     }
     if (typeSig is TypeDefOrRefSig)
     {
         for (ITypeDefOrRef type = ((TypeDefOrRefSig)typeSig).TypeDefOrRef; type != null; type = type.DeclaringType)
         {
             ret.Add(type);
         }
     }
 }
Example #2
0
        /// <summary>
        ///     Find the type references within the specified type signature.
        /// </summary>
        /// <param name="typeSig">The type signature to find the type references.</param>
        /// <returns>A list of <see cref="T:dnlib.DotNet.ITypeDefOrRef" /> instance.</returns>
        // Token: 0x06000155 RID: 341 RVA: 0x0000BA44 File Offset: 0x00009C44
        public static IList <ITypeDefOrRef> FindTypeRefs(this TypeSig typeSig)
        {
            List <ITypeDefOrRef> ret = new List <ITypeDefOrRef>();

            DnlibUtils.FindTypeRefsInternal(typeSig, ret);
            return(ret);
        }